Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
OpenClaw’s Gateway can serve an OpenResponses-compatible
POST /v1/responsesThis endpoint is disabled by default. Enable it in config first.
POST /v1/responseshttp://<gateway-host>:<port>/v1/responsesUnder the hood, requests are executed as a normal Gateway agent run (same codepath as
openclaw agentOperational behavior matches OpenAI Chat Completions:
gateway.auth.mode="token""password"Authorization: Bearer <token-or-password>gateway.auth.mode="trusted-proxy"gateway.auth.trustedProxy.allowLoopback = truegateway.auth.mode="none"tokenpasswordx-openclaw-scopesgateway.auth.mode="none"x-openclaw-scopesmodel: "openclaw"model: "openclaw/default"model: "openclaw/<agentId>"x-openclaw-agent-idx-openclaw-modelx-openclaw-session-keyx-openclaw-message-channelAuth matrix:
gateway.auth.mode="token""password"Authorization: Bearer ...x-openclaw-scopesoperator.adminoperator.approvalsoperator.pairingoperator.readoperator.talk.secretsoperator.writegateway.auth.mode="none"x-openclaw-scopesoperator.adminEnable or disable this endpoint with
gateway.http.endpoints.responses.enabledThe same compatibility surface also includes:
GET /v1/modelsGET /v1/models/{id}POST /v1/embeddingsPOST /v1/chat/completionsFor the canonical explanation of how agent-target models,
openclaw/defaultBy default the endpoint is stateless per request (a new session key is generated each call).
If the request includes an OpenResponses
userThe request follows the OpenResponses API with item-based input. Current support:
inputinstructionstoolstool_choicestreammax_output_tokensuserAccepted but currently ignored:
max_tool_callsreasoningmetadatastoretruncationSupported:
previous_response_idmessageRoles:
systemdeveloperuserassistantsystemdeveloperuserfunction_call_outputfunction_call_outputSend tool results back to the model:
json{ "type": "function_call_output", "call_id": "call_123", "output": "{\"temperature\": \"72F\"}" }
reasoningitem_referenceAccepted for schema compatibility but ignored when building the prompt.
Provide tools with
tools: [{ type: "function", function: { name, description?, parameters? } }]If the agent decides to call a tool, the response returns a
function_callfunction_call_outputinput_imageSupports base64 or URL sources:
json{ "type": "input_image", "source": { "type": "url", "url": "https://example.com/image.png" } }
Allowed MIME types (current):
image/jpegimage/pngimage/gifimage/webpimage/heicimage/heifinput_fileSupports base64 or URL sources:
json{ "type": "input_file", "source": { "type": "base64", "media_type": "text/plain", "data": "SGVsbG8gV29ybGQh", "filename": "hello.txt" } }
Allowed MIME types (current):
text/plaintext/markdowntext/htmltext/csvapplication/jsonapplication/pdfMax size (current): 5MB.
Current behavior:
<<<EXTERNAL_UNTRUSTED_CONTENT id="...">>><<<END_EXTERNAL_UNTRUSTED_CONTENT id="...">>>Source: ExternalSECURITY NOTICE:[PDF content rendered to images]PDF parsing is provided by the bundled
document-extractpdfjs-distURL fetch defaults:
files.allowUrltrueimages.allowUrltruemaxUrlParts8input_fileinput_imagefiles.urlAllowlistimages.urlAllowlist"cdn.example.com""*.assets.example.com"files.allowUrl: falseimages.allowUrl: falseDefaults can be tuned under
gateway.http.endpoints.responsesjson5{ gateway: { http: { endpoints: { responses: { enabled: true, maxBodyBytes: 20000000, maxUrlParts: 8, files: { allowUrl: true, urlAllowlist: ["cdn.example.com", "*.assets.example.com"], allowedMimes: [ "text/plain", "text/markdown", "text/html", "text/csv", "application/json", "application/pdf", ], maxBytes: 5242880, maxChars: 200000, maxRedirects: 3, timeoutMs: 10000, pdf: { maxPages: 4, maxPixels: 4000000, minTextChars: 200, }, }, images: { allowUrl: true, urlAllowlist: ["images.example.com"], allowedMimes: [ "image/jpeg", "image/png", "image/gif", "image/webp", "image/heic", "image/heif", ], maxBytes: 10485760, maxRedirects: 3, timeoutMs: 10000, }, }, }, }, }, }
Defaults when omitted:
maxBodyBytesmaxUrlPartsfiles.maxBytesfiles.maxCharsfiles.maxRedirectsfiles.timeoutMsfiles.pdf.maxPagesfiles.pdf.maxPixelsfiles.pdf.minTextCharsimages.maxBytesimages.maxRedirectsimages.timeoutMsinput_imageSecurity note:
Set
stream: trueContent-Type: text/event-streamevent: <type>data: <json>data: [DONE]Event types currently emitted:
response.createdresponse.in_progressresponse.output_item.addedresponse.content_part.addedresponse.output_text.deltaresponse.output_text.doneresponse.content_part.doneresponse.output_item.doneresponse.completedresponse.failedusageinput_tokensoutput_tokensprompt_tokenscompletion_tokensErrors use a JSON object like:
json{ "error": { "message": "...", "type": "invalid_request_error" } }
Common cases:
401400405Non-streaming:
bashcurl -sS http://127.0.0.1:18789/v1/responses \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -H 'x-openclaw-agent-id: main' \ -d '{ "model": "openclaw", "input": "hi" }'
Streaming:
bashcurl -N http://127.0.0.1:18789/v1/responses \ -H 'Authorization: Bearer YOUR_TOKEN' \ -H 'Content-Type: application/json' \ -H 'x-openclaw-agent-id: main' \ -d '{ "model": "openclaw", "stream": true, "input": "hi" }'
© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine