POST /v1/responses एंडपॉइंट सर्व कर सकता है.
यह एंडपॉइंट डिफ़ॉल्ट रूप से अक्षम है. पहले इसे कॉन्फ़िग में सक्षम करें.
POST /v1/responses- Gateway जैसा ही पोर्ट (WS + HTTP मल्टीप्लेक्स):
http://<gateway-host>:<port>/v1/responses
openclaw agent जैसा ही कोडपाथ), इसलिए रूटिंग/अनुमतियां/कॉन्फ़िग आपके Gateway से मेल खाते हैं.
प्रमाणीकरण, सुरक्षा, और रूटिंग
ऑपरेशनल व्यवहार OpenAI Chat Completions से मेल खाता है:- मिलते-जुलते Gateway HTTP प्रमाणीकरण पथ का उपयोग करें:
- साझा-गुप्त प्रमाणीकरण (
gateway.auth.mode="token"या"password"):Authorization: Bearer <token-or-password> - विश्वसनीय-प्रॉक्सी प्रमाणीकरण (
gateway.auth.mode="trusted-proxy"): कॉन्फ़िगर किए गए विश्वसनीय प्रॉक्सी स्रोत से पहचान-जागरूक प्रॉक्सी हेडर; same-host लूपबैक प्रॉक्सी के लिए स्पष्टgateway.auth.trustedProxy.allowLoopback = trueचाहिए - विश्वसनीय-प्रॉक्सी स्थानीय सीधा फ़ॉलबैक: बिना
Forwarded,X-Forwarded-*, याX-Real-IPहेडर वाले same-host कॉलरgateway.auth.password/OPENCLAW_GATEWAY_PASSWORDका उपयोग कर सकते हैं - निजी-इनग्रेस खुला प्रमाणीकरण (
gateway.auth.mode="none"): कोई प्रमाणीकरण हेडर नहीं
- साझा-गुप्त प्रमाणीकरण (
- एंडपॉइंट को Gateway इंस्टेंस के लिए पूर्ण ऑपरेटर एक्सेस मानें
- साझा-गुप्त प्रमाणीकरण मोड (
tokenऔरpassword) के लिए, संकरे bearer-घोषितx-openclaw-scopesमानों को अनदेखा करें और सामान्य पूर्ण ऑपरेटर डिफ़ॉल्ट वापस लाएं - विश्वसनीय पहचान-युक्त HTTP मोड के लिए (उदाहरण के लिए विश्वसनीय प्रॉक्सी प्रमाणीकरण या
gateway.auth.mode="none"), मौजूद होने परx-openclaw-scopesका सम्मान करें और अन्यथा सामान्य ऑपरेटर डिफ़ॉल्ट स्कोप सेट पर फ़ॉलबैक करें - एजेंट चुनें
model: "openclaw",model: "openclaw/default",model: "openclaw/<agentId>", याx-openclaw-agent-idसे - जब आप चुने गए एजेंट के बैकएंड मॉडल को ओवरराइड करना चाहते हैं, तो
x-openclaw-modelका उपयोग करें - स्पष्ट सत्र रूटिंग के लिए
x-openclaw-session-keyका उपयोग करें - जब आप गैर-डिफ़ॉल्ट कृत्रिम इनग्रेस चैनल संदर्भ चाहते हैं, तो
x-openclaw-message-channelका उपयोग करें
gateway.auth.mode="token"या"password"+Authorization: Bearer ...- साझा Gateway ऑपरेटर गुप्त के कब्जे को सिद्ध करता है
- संकरे
x-openclaw-scopesको अनदेखा करता है - पूर्ण डिफ़ॉल्ट ऑपरेटर स्कोप सेट वापस लाता है:
operator.admin,operator.approvals,operator.pairing,operator.read,operator.talk.secrets,operator.write - इस एंडपॉइंट पर चैट टर्न को स्वामी-प्रेषक टर्न मानता है
- विश्वसनीय पहचान-युक्त HTTP मोड (उदाहरण के लिए विश्वसनीय प्रॉक्सी प्रमाणीकरण, या निजी इनग्रेस पर
gateway.auth.mode="none")- हेडर मौजूद होने पर
x-openclaw-scopesका सम्मान करते हैं - हेडर अनुपस्थित होने पर सामान्य ऑपरेटर डिफ़ॉल्ट स्कोप सेट पर फ़ॉलबैक करते हैं
- स्वामी semantics केवल तब खोते हैं जब कॉलर स्पष्ट रूप से स्कोप संकरे करता है और
operator.adminछोड़ देता है
- हेडर मौजूद होने पर
gateway.http.endpoints.responses.enabled से सक्षम या अक्षम करें.
उसी संगतता सतह में यह भी शामिल है:
GET /v1/modelsGET /v1/models/{id}POST /v1/embeddingsPOST /v1/chat/completions
openclaw/default, embeddings पास-थ्रू, और बैकएंड मॉडल ओवरराइड कैसे साथ काम करते हैं, इसकी canonical व्याख्या के लिए OpenAI Chat Completions और मॉडल सूची और एजेंट रूटिंग देखें.
सत्र व्यवहार
डिफ़ॉल्ट रूप से एंडपॉइंट प्रति अनुरोध stateless है (हर कॉल में नई सत्र कुंजी बनती है). यदि अनुरोध में OpenResponsesuser स्ट्रिंग शामिल है, तो Gateway उससे स्थिर सत्र कुंजी निकालता है, ताकि दोहराई गई कॉल एजेंट सत्र साझा कर सकें.
अनुरोध आकार (समर्थित)
अनुरोध item-आधारित इनपुट के साथ OpenResponses API का पालन करता है. वर्तमान समर्थन:input: स्ट्रिंग या item ऑब्जेक्ट की array.instructions: सिस्टम prompt में merge किया जाता है.tools: client tool परिभाषाएं (function tools).tool_choice: client tools को फ़िल्टर या आवश्यक करने के लिए"auto","none","required", या{ "type": "function", "name": "..." }.stream: SSE streaming सक्षम करता है.max_output_tokens: best-effort output सीमा (provider पर निर्भर).temperature: provider को forward किया गया best-effort sampling temperature. ChatGPT-आधारित Codex Responses backend द्वारा अनदेखा किया जाता है, जो fixed server-side sampling का उपयोग करता है.top_p: provider को forward किया गया best-effort nucleus sampling.temperatureजैसी ही Codex Responses सावधानी लागू है.user: स्थिर सत्र रूटिंग.
max_tool_callsreasoningmetadatastoretruncation
previous_response_id: जब अनुरोध उसी एजेंट/user/अनुरोधित-सत्र scope में रहता है, OpenClaw पहले के response सत्र को फिर से उपयोग करता है.
Items (इनपुट)
message
भूमिकाएं: system, developer, user, assistant.
systemऔरdeveloperसिस्टम prompt में जोड़े जाते हैं.- सबसे हाल का
userयाfunction_call_outputitem “वर्तमान संदेश” बनता है. - पहले के user/assistant संदेश संदर्भ के लिए history के रूप में शामिल किए जाते हैं.
function_call_output (turn-आधारित tools)
Tool परिणाम model को वापस भेजें:
reasoning और item_reference
Schema संगतता के लिए स्वीकार किए जाते हैं, लेकिन prompt बनाते समय अनदेखे किए जाते हैं.
Tools (client-side function tools)
Toolstools: [{ type: "function", name, description?, parameters? }] से दें.
यदि एजेंट किसी tool को call करने का निर्णय लेता है, तो response function_call output item लौटाता है.
फिर आप turn जारी रखने के लिए function_call_output के साथ follow-up अनुरोध भेजते हैं.
tool_choice: "required" और function-pinned tool_choice के लिए, endpoint exposed client function-tool set को संकरा करता है, runtime को response देने से पहले client tool call करने का निर्देश देता है, और यदि turn में matching structured client-tool call शामिल नहीं है तो उसे reject करता है. यह contract caller-supplied HTTP tools list पर लागू होता है, हर internal OpenClaw agent tool पर नहीं. Non-streaming अनुरोध api_error के साथ 502 लौटाते हैं; streaming अनुरोध response.failed event emit करते हैं. यह /v1/chat/completions contract से मेल खाता है.
Images (input_image)
base64 या URL sources समर्थित हैं:
image/jpeg, image/png, image/gif, image/webp, image/heic, image/heif.
अधिकतम आकार (वर्तमान): 10MB.
Files (input_file)
base64 या URL sources समर्थित हैं:
text/plain, text/markdown, text/html, text/csv,
application/json, application/pdf.
अधिकतम आकार (वर्तमान): 5MB.
वर्तमान व्यवहार:
- File content decode किया जाता है और system prompt में जोड़ा जाता है, user message में नहीं, इसलिए यह ephemeral रहता है (session history में persist नहीं होता).
- Decoded file text को जोड़े जाने से पहले untrusted external content के रूप में wrap किया जाता है, इसलिए file bytes को data माना जाता है, trusted instructions नहीं.
- Injected block स्पष्ट boundary markers जैसे
<<<EXTERNAL_UNTRUSTED_CONTENT id="...">>>/<<<END_EXTERNAL_UNTRUSTED_CONTENT id="...">>>का उपयोग करता है औरSource: Externalmetadata line शामिल करता है. - यह file-input path prompt budget बचाने के लिए लंबे
SECURITY NOTICE:banner को जानबूझकर छोड़ता है; boundary markers और metadata फिर भी मौजूद रहते हैं. - PDFs को पहले text के लिए parse किया जाता है. यदि कम text मिलता है, तो पहले pages images में rasterize किए जाते हैं और model को दिए जाते हैं, और injected file block
placeholder
[PDF content rendered to images]का उपयोग करता है.
document-extract Plugin द्वारा दी जाती है, जो text extraction और page rendering के लिए clawpdf और उसके packaged PDFium WebAssembly runtime का उपयोग करता है.
URL fetch defaults:
files.allowUrl:trueimages.allowUrl:truemaxUrlParts:8(प्रति अनुरोध कुल URL-basedinput_file+input_imageparts)- अनुरोध सुरक्षित रखे जाते हैं (DNS resolution, private IP blocking, redirect caps, timeouts).
- Optional hostname allowlists प्रति input type समर्थित हैं (
files.urlAllowlist,images.urlAllowlist).- Exact host:
"cdn.example.com" - Wildcard subdomains:
"*.assets.example.com"(apex से match नहीं करता) - खाली या छोड़ी गई allowlists का अर्थ है कोई hostname allowlist restriction नहीं.
- Exact host:
- URL-based fetches को पूरी तरह अक्षम करने के लिए,
files.allowUrl: falseऔर/याimages.allowUrl: falseset करें.
File + image limits (config)
Defaults कोgateway.http.endpoints.responses के अंतर्गत tune किया जा सकता है:
maxBodyBytes: 20MBmaxUrlParts: 8files.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- HEIC/HEIF
input_imagesources तब स्वीकार किए जाते हैं जब system converter उपलब्ध हो और provider delivery से पहले JPEG में normalize किए जाते हैं. समर्थित converters macOSsips, ImageMagick, GraphicsMagick, या ffmpeg हैं.
- URL allowlists fetch से पहले और redirect hops पर enforce की जाती हैं.
- किसी hostname को allowlist करना private/internal IP blocking को bypass नहीं करता.
- internet-exposed gateways के लिए, app-level guards के अतिरिक्त network egress controls लागू करें. Security देखें.
Streaming (SSE)
Server-Sent Events (SSE) प्राप्त करने के लिएstream: true set करें:
Content-Type: text/event-stream- प्रत्येक event line
event: <type>औरdata: <json>होती है - Stream
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(error पर)
उपयोग
जब underlying provider token counts report करता है, तबusage populate होता है.
OpenClaw उन counters के downstream status/session surfaces तक पहुंचने से पहले common OpenAI-style aliases normalize करता है, जिनमें input_tokens / output_tokens
और prompt_tokens / completion_tokens शामिल हैं.
Errors
Errors ऐसा JSON object उपयोग करते हैं:401missing/invalid auth400invalid request body405wrong method