OpenResponses API (HTTP)
Clawdia’s Gateway can serve an OpenResponses-compatiblePOST /v1/responses endpoint.
This endpoint is disabled by default. Enable it in config first.
POST /v1/responses- Same port as the Gateway (WS + HTTP multiplex):
http://<gateway-host>:<port>/v1/responses
clawdia agent), so routing/permissions/config match your Gateway.
Authentication
Uses the Gateway auth configuration. Send a bearer token:Authorization: Bearer <token>
- When
gateway.auth.mode="token", usegateway.auth.token(orCLAWDIA_GATEWAY_TOKEN). - When
gateway.auth.mode="password", usegateway.auth.password(orCLAWDIA_GATEWAY_PASSWORD).
Choosing an agent
No custom headers required: encode the agent id in the OpenResponsesmodel field:
model: "clawdia:<agentId>"(example:"clawdia:main","clawdia:beta")model: "agent:<agentId>"(alias)
x-clawdia-agent-id: <agentId>(default:main)
x-clawdia-session-key: <sessionKey>to fully control session routing.
Enabling the endpoint
Setgateway.http.endpoints.responses.enabled to true:
Disabling the endpoint
Setgateway.http.endpoints.responses.enabled to false:
Session behavior
By default the endpoint is stateless per request (a new session key is generated each call). If the request includes an OpenResponsesuser string, the Gateway derives a stable session key
from it, so repeated calls can share an agent session.
Request shape (supported)
The request follows the OpenResponses API with item-based input. Current support:input: string or array of item objects.instructions: merged into the system prompt.tools: client tool definitions (function tools).tool_choice: filter or require client tools.stream: enables SSE streaming.max_output_tokens: best-effort output limit (provider dependent).user: stable session routing.
max_tool_callsreasoningmetadatastoreprevious_response_idtruncation
Items (input)
message
Roles: system, developer, user, assistant.
systemanddeveloperare appended to the system prompt.- The most recent
userorfunction_call_outputitem becomes the “current message.” - Earlier user/assistant messages are included as history for context.
function_call_output (turn-based tools)
Send tool results back to the model:
reasoning and item_reference
Accepted for schema compatibility but ignored when building the prompt.
Tools (client-side function tools)
Provide tools withtools: [{ type: "function", function: { name, description?, parameters? } }].
If the agent decides to call a tool, the response returns a function_call output item.
You then send a follow-up request with function_call_output to continue the turn.
Images (input_image)
Supports base64 or URL sources:
image/jpeg, image/png, image/gif, image/webp.
Max size (current): 10MB.
Files (input_file)
Supports base64 or URL sources:
text/plain, text/markdown, text/html, text/csv,
application/json, application/pdf.
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 into images and passed to the model.
pdfjs-dist legacy build (no worker). The modern
PDF.js build expects browser workers/DOM globals, so it is not used in the Gateway.
URL fetch defaults:
files.allowUrl:trueimages.allowUrl:true- Requests are guarded (DNS resolution, private IP blocking, redirect caps, timeouts).
File + image limits (config)
Defaults can be tuned undergateway.http.endpoints.responses:
maxBodyBytes: 20MBfiles.maxBytes: 5MBfiles.maxChars: 200kfiles.maxRedirects: 3files.timeoutMs: 10sfiles.pdf.maxPages: 4files.pdf.maxPixels: 4,000,000files.pdf.minTextChars: 200images.maxBytes: 10MBimages.maxRedirects: 3images.timeoutMs: 10s
Streaming (SSE)
Setstream: true to receive Server-Sent Events (SSE):
Content-Type: text/event-stream- Each event line is
event: <type>anddata: <json> - Stream ends with
data: [DONE]
response.createdresponse.in_progressresponse.output_item.addedresponse.content_part.addedresponse.output_text.deltaresponse.output_text.doneresponse.content_part.doneresponse.output_item.doneresponse.completedresponse.failed(on error)
Usage
usage is populated when the underlying provider reports token counts.
Errors
Errors use a JSON object like:401missing/invalid auth400invalid request body405wrong method
