mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-29 01:02:03 +03:00
chore: Run pnpm format:fix.
This commit is contained in:
@@ -4,6 +4,7 @@ read_when:
|
||||
- Integrating clients that speak the OpenResponses API
|
||||
- You want item-based inputs, client tool calls, or SSE events
|
||||
---
|
||||
|
||||
# OpenResponses API (HTTP)
|
||||
|
||||
OpenClaw’s Gateway can serve an OpenResponses-compatible `POST /v1/responses` endpoint.
|
||||
@@ -23,6 +24,7 @@ Uses the Gateway auth configuration. Send a bearer token:
|
||||
- `Authorization: Bearer <token>`
|
||||
|
||||
Notes:
|
||||
|
||||
- When `gateway.auth.mode="token"`, use `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`).
|
||||
- When `gateway.auth.mode="password"`, use `gateway.auth.password` (or `OPENCLAW_GATEWAY_PASSWORD`).
|
||||
|
||||
@@ -38,6 +40,7 @@ Or target a specific OpenClaw agent by header:
|
||||
- `x-openclaw-agent-id: <agentId>` (default: `main`)
|
||||
|
||||
Advanced:
|
||||
|
||||
- `x-openclaw-session-key: <sessionKey>` to fully control session routing.
|
||||
|
||||
## Enabling the endpoint
|
||||
@@ -49,10 +52,10 @@ Set `gateway.http.endpoints.responses.enabled` to `true`:
|
||||
gateway: {
|
||||
http: {
|
||||
endpoints: {
|
||||
responses: { enabled: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
responses: { enabled: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -65,10 +68,10 @@ Set `gateway.http.endpoints.responses.enabled` to `false`:
|
||||
gateway: {
|
||||
http: {
|
||||
endpoints: {
|
||||
responses: { enabled: false }
|
||||
}
|
||||
}
|
||||
}
|
||||
responses: { enabled: false },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -103,6 +106,7 @@ Accepted but **currently ignored**:
|
||||
## Items (input)
|
||||
|
||||
### `message`
|
||||
|
||||
Roles: `system`, `developer`, `user`, `assistant`.
|
||||
|
||||
- `system` and `developer` are appended to the system prompt.
|
||||
@@ -168,6 +172,7 @@ Allowed MIME types (current): `text/plain`, `text/markdown`, `text/html`, `text/
|
||||
Max size (current): 5MB.
|
||||
|
||||
Current behavior:
|
||||
|
||||
- File content is decoded and added to the **system prompt**, not the user message,
|
||||
so it stays ephemeral (not persisted in session history).
|
||||
- PDFs are parsed for text. If little text is found, the first pages are rasterized
|
||||
@@ -177,6 +182,7 @@ PDF parsing uses the Node-friendly `pdfjs-dist` legacy build (no worker). The mo
|
||||
PDF.js build expects browser workers/DOM globals, so it is not used in the Gateway.
|
||||
|
||||
URL fetch defaults:
|
||||
|
||||
- `files.allowUrl`: `true`
|
||||
- `images.allowUrl`: `true`
|
||||
- Requests are guarded (DNS resolution, private IP blocking, redirect caps, timeouts).
|
||||
@@ -195,7 +201,14 @@ Defaults can be tuned under `gateway.http.endpoints.responses`:
|
||||
maxBodyBytes: 20000000,
|
||||
files: {
|
||||
allowUrl: true,
|
||||
allowedMimes: ["text/plain", "text/markdown", "text/html", "text/csv", "application/json", "application/pdf"],
|
||||
allowedMimes: [
|
||||
"text/plain",
|
||||
"text/markdown",
|
||||
"text/html",
|
||||
"text/csv",
|
||||
"application/json",
|
||||
"application/pdf",
|
||||
],
|
||||
maxBytes: 5242880,
|
||||
maxChars: 200000,
|
||||
maxRedirects: 3,
|
||||
@@ -203,24 +216,25 @@ Defaults can be tuned under `gateway.http.endpoints.responses`:
|
||||
pdf: {
|
||||
maxPages: 4,
|
||||
maxPixels: 4000000,
|
||||
minTextChars: 200
|
||||
}
|
||||
minTextChars: 200,
|
||||
},
|
||||
},
|
||||
images: {
|
||||
allowUrl: true,
|
||||
allowedMimes: ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
||||
maxBytes: 10485760,
|
||||
maxRedirects: 3,
|
||||
timeoutMs: 10000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
timeoutMs: 10000,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
Defaults when omitted:
|
||||
|
||||
- `maxBodyBytes`: 20MB
|
||||
- `files.maxBytes`: 5MB
|
||||
- `files.maxChars`: 200k
|
||||
@@ -242,6 +256,7 @@ Set `stream: true` to receive Server-Sent Events (SSE):
|
||||
- Stream ends with `data: [DONE]`
|
||||
|
||||
Event types currently emitted:
|
||||
|
||||
- `response.created`
|
||||
- `response.in_progress`
|
||||
- `response.output_item.added`
|
||||
@@ -266,6 +281,7 @@ Errors use a JSON object like:
|
||||
```
|
||||
|
||||
Common cases:
|
||||
|
||||
- `401` missing/invalid auth
|
||||
- `400` invalid request body
|
||||
- `405` wrong method
|
||||
@@ -273,6 +289,7 @@ Common cases:
|
||||
## Examples
|
||||
|
||||
Non-streaming:
|
||||
|
||||
```bash
|
||||
curl -sS http://127.0.0.1:18789/v1/responses \
|
||||
-H 'Authorization: Bearer YOUR_TOKEN' \
|
||||
@@ -285,6 +302,7 @@ curl -sS http://127.0.0.1:18789/v1/responses \
|
||||
```
|
||||
|
||||
Streaming:
|
||||
|
||||
```bash
|
||||
curl -N http://127.0.0.1:18789/v1/responses \
|
||||
-H 'Authorization: Bearer YOUR_TOKEN' \
|
||||
|
||||
Reference in New Issue
Block a user