生成响应
发送一条输入,返回模型生成的一条响应;可流式。
/openai/v1/responses● 支持请求体
modelstring必填◐ 部分支持已验证支持 glm-5.3-flash、deepseek-flash;没有 Responses 协议的模型返回 404。
streamboolean可选◐ 部分支持deepseek-flash 生效;glm-5.3-flash 返回 400。
temperaturenumber可选◐ 部分支持glm-5.3-flash 部分生效,2 可能返回空文本或乱码;deepseek-flash 的效果不可观测。
top_pnumber可选◐ 部分支持glm-5.3-flash 观察到采样变化;deepseek-flash 不可观测。
toolsarray可选◐ 部分支持function 生效;web_search、code_interpreter、image_generation、mcp、computer_use 接受但当前不生效;file_search 返回 404。
tool_choicestring | object可选◐ 部分支持How the model picks tools: a mode string or a specific tool.
auto 生效;deepseek-flash 的 required/具名函数需 reasoning.effort=none;allowed_tools 在 glm-5.3-flash 被忽略,在 deepseek-flash 返回 422。
▸ 展开子字段(4)
namestring必填Name of the function or tool the model must call.
typestring必填Kind of tool the model must call.
modestring必填auto lets the model pick among the allowed tools or none; required forces a call to one of them.
toolsarray必填The allowed tools, each as a tool reference such as {type: function, name}.
backgroundboolean可选◐ 部分支持是否让模型在后台生成响应。仅当路由到的模型具备 Router 自建后台能力时可用——Router 会立即返回 status queued,随后自行以流式方式调用上游、跑到终态并恰好一次结算用量, 客户端通过 GET /v1/responses/{id} 轮询(这不代表上游原生支持 OpenAI 的 background 参数)。不具备该能力的 provider 设置为 true 仍返回 400(错误码 native_responses_background_unsupported)。取消(POST /v1/responses/{id}/cancel) 只能停止我方对上游流的继续读取,不能保证已发往上游的算力停止计算;用量按实际收到的 部分结算,未收到用量时按平台通用的"上游未报用量"规则处理。
deepseek-flash 生效;glm-5.3-flash 返回 400。background 与 stream 同传时返回 JSON。
includearray可选◐ 部分支持原样转发给上游模型;只对该模型具备的能力生效(例如推理内容、联网搜索来源),模型不具备的项会被忽略。
deepseek-flash 返回 logprobs;reasoning.encrypted_content 仅为占位串。glm-5.3-flash 接受但当前不生效。
inputstring | array可选◐ 部分支持Input for a response request - can be a string or array of items
字符串、消息数组、input_text、input_image 和函数往返生效;input_file 在 glm-5.3-flash 报错、deepseek-flash 忽略;托管文件引用返回 400。
instructionsstring可选已验证生效。
▸ 更多参数(21)
max_output_tokensinteger可选正数控制输出预算;0 返回 400。
metadataobject可选◐ 部分支持Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
glm-5.3-flash 回显;deepseek-flash 接受但当前不生效,响应及读取均为空对象。
parallel_tool_callsboolean可选◐ 部分支持true 可返回多个调用;false 接受但当前不生效,仍可能返回多个调用。
previous_response_idany可选要续接的上一条响应 ID。仅所有者可续接,续接时可以省略 model 字段;平台会展开保存的历史后再请求上游。
平台将祖先的输入与输出和本轮 input 合并,发往上游前移除 previous_response_id;没有活副本或不属于当前租户时返回 404 previous_response_not_found。
promptobject可选○ 未支持引用一个已保存的提示词模板及其变量。我方目前没有 Prompts(提示词模板)资源,传入任何 id 都会返回 404 object_not_found。
当前没有可引用的提示词模板;传入模板 id 返回 404。
▸ 展开子字段(2)
idstring必填Id of the stored prompt template.
variablesobject可选Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part.
prompt_cache_keystring可选prompt_cache_optionsobject可选Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer.
▸ 展开子字段(2)
modestring必填Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
ttlstring可选Lifetime of cache entries, for example 30m; null leaves the provider default.
reasoningobject可选Configuration for reasoning mode in the response
▸ 展开子字段(6)
contextstring可选Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer.
effortstring可选◐ 部分支持How much reasoning the model should spend.
deepseek-flash 的 none 可关闭思考,其余档位不保证单调;glm-5.3-flash 接受但当前不生效,none 仍思考。
modestring可选Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer.
summarystring可选◐ 部分支持How detailed the reasoning summary should be.
glm-5.3-flash 的 concise 偶发有摘要,auto/detailed 未见;deepseek-flash 接受但当前不生效。
enabledboolean可选max_tokensinteger可选
safety_identifierstring可选建议为终端用户设置的稳定标识符,用于滥用隔离。使用稳定的 ID、哈希值或化名。若上游 provider 需要用户身份,我们会把它折算进转发的哈希身份、不会原样转发;省略时请求使用账号级身份,滥用处置可能影响整个账号。
service_tierstring可选请求使用的服务档位;当前效果不可观测。
storeboolean可选是否在服务端保存这条响应,以便之后通过 previous_response_id 读取或续接。默认 true;传 false 可关闭保存。
true 保存响应供读取;false 不保存,读取返回 404。
textobject可选Text output configuration including format and verbosity
▸ 展开子字段(2)
formatobject可选◐ 部分支持Text response format configuration
json_object、json_schema 生效(预算需足够);text 在 glm-5.3-flash 偶发 400,在 deepseek-flash 生效。
verbositystring可选○ 当前不生效接受但当前不生效。glm-5.3-flash、deepseek-flash 均未观察到长度变化。
top_logprobsinteger可选◐ 部分支持deepseek-flash 生效,允许 0–20;glm-5.3-flash 返回空 logprobs。
truncationstring可选How to handle input that exceeds the context window.
userstring可选A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.
conversationstring可选该响应所属的对话(会话 id 字符串,或 `{id}` 对象)。发往上游前,我们会把这个对话里已有的条目拼接到本次 input 前面;响应完成后,本次的输入与输出条目会被追加回这个对话。只有对话的所有者可以引用它,否则返回 404 object_not_found;不能和 previous_response_id 同时使用,同传返回 400。
会话历史进入本次输入,响应条目追加到会话;不能与 previous_response_id 同传。
context_managementarray可选本次请求的上下文管理配置(例如输入超过阈值时自动压缩)。
moderationobject可选对本次响应的输入和输出运行审核(moderation)的配置。
prompt_cache_retentionstring可选提示词缓存的保留策略;设为 24h 可以让缓存前缀存活更久,最长 24 小时。
stream_optionsobject可选流式响应的附加选项,只在 stream=true 时生效(例如流末尾是否附带用量统计)。
access_programsobject可选○ 未支持已识别的官方字段;平台未实现访问计划,传入返回 400 并明确说明不支持。
返回
200 response
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 OpenAI 格式返回,参见 错误码
响应
HTTP 200
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| background | boolean | null | Whether the response was started in background mode. |
| completed_at | integer | null | Unix time in seconds at which the response finished; null while it has not finished. |
| created_at | integer | Unix time in seconds at which the response was created. |
| error | object | null | Error information returned from the API |
| error.code | string | Machine-readable error code. |
| error.message | string | Human-readable error message. |
| frequency_penalty | number | null | The frequency penalty that applied to the request, if any. |
| id | string | Unique id of the response; use it as response_id to retrieve, cancel or delete it, or as previous_response_id to continue the conversation. |
| incomplete_details | object | null | Why the response stopped before finishing; null for complete responses. |
| incomplete_details.reason | string | Why the response is incomplete. |
| instructions | string | array<object> | null | Input of the request: a string or an array of input items. |
| max_output_tokens | integer | null | Upper bound on generated tokens that applied to the request; null when none was set. |
| max_tool_calls | integer | null | Upper bound on built-in tool calls that applied to the request; null when none was set. |
| metadata | object | null | Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed. |
| model | string | Model that produced the response. |
| object | string | Object type; always `response`. |
| output | array<object> | Items the model produced, in order: messages, reasoning, tool calls and tool results. |
| output[].content | array<object> | array | null | string | Content parts of the message: output text or refusal. / Reasoning text parts, when the provider returns them. / Text content of the fetched page. |
| output[].id | string | Id of the message item. / Id of the reasoning item. / Id of the function call item. / Id of the web search call item. / Id of the file search call item. / Id of the image generation call item. / Id of the code interpreter call item. / Id of the computer call item. / Id of the datetime server tool item. / Id of the web search server tool item. / Id of the code interpreter server tool item. / Id of the file search server tool item. / Id of the image generation server tool item. / Id of the browser use server tool item. / Id of the bash server tool item. / Id of the text editor server tool item. / Id of the apply_patch server tool item. / Id of the apply_patch call item. / Id of the shell call item. / Id of the shell call output item. / Id of the shell server tool item. / Id of the web fetch server tool item. / Id of the tool search server tool item. / Id of the memory server tool item. / Id of the MCP server tool item. / Id of the model search server tool item. / Id of the fusion server tool item. / Id of the advisor server tool item. / Id of the subagent server tool item. / Id of the files server tool item. / Id of the custom tool call item. |
| output[].phase | string | null | The phase of an assistant message. Use `commentary` for an intermediate assistant message and `final_answer` for the final assistant message. For follow-up requests with models like `gpt-5.3-codex` and later, preserve and resend phase on all assistant messages. Omitting it can degrade performance. Not used for user messages. |
| output[].role | string | Role of the author; always assistant. |
| output[].status | string | Status of the message item. / Status of the reasoning item. / Status of the function call item. / Status of a web search call. / Status of a web search call. / Status of an image generation call. / Status of the code interpreter call. / Status of the computer call item. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Lifecycle state of an `apply_patch_call` output item. / Status of a shell call or its output. / Status of a shell call or its output. / Status of a tool call that can fail. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call. / Status of a tool call that can fail. / Status of a tool call that can fail. / Status of a tool call. / Status of the custom tool call item. |
| output[].type | string | Always `message`. Discriminator that marks this object as a OutputMessage in a `type`-tagged union. / Always `reasoning`. Discriminator that marks this object as a OutputItemReasoning in a `type`-tagged union. / Always `function_call`. Discriminator that marks this object as a OutputItemFunctionCall in a `type`-tagged union. / Always `web_search_call`. Discriminator that marks this object as a OutputItemWebSearchCall in a `type`-tagged union. / Always `file_search_call`. Discriminator that marks this object as a OutputItemFileSearchCall in a `type`-tagged union. / Always `image_generation_call`. Discriminator that marks this object as a OutputItemImageGenerationCall in a `type`-tagged union. / Always `code_interpreter_call`. Discriminator that marks this object as a OutputItemCodeInterpreterCall in a `type`-tagged union. / Always `computer_call`. Discriminator that marks this object as a OutputComputerCallItem in a `type`-tagged union. / Always `openrouter:datetime`. Discriminator that marks this object as a OutputDatetimeItem in a `type`-tagged union. / Always `openrouter:web_search`. Discriminator that marks this object as a OutputWebSearchServerToolItem in a `type`-tagged union. / Always `openrouter:code_interpreter`. Discriminator that marks this object as a OutputCodeInterpreterServerToolItem in a `type`-tagged union. / Always `openrouter:file_search`. Discriminator that marks this object as a OutputFileSearchServerToolItem in a `type`-tagged union. / Always `openrouter:image_generation`. Discriminator that marks this object as a OutputImageGenerationServerToolItem in a `type`-tagged union. / Always `openrouter:browser_use`. Discriminator that marks this object as a OutputBrowserUseServerToolItem in a `type`-tagged union. / Always `openrouter:bash`. Discriminator that marks this object as a OutputBashServerToolItem in a `type`-tagged union. / Always `openrouter:text_editor`. Discriminator that marks this object as a OutputTextEditorServerToolItem in a `type`-tagged union. / Always `openrouter:apply_patch`. Discriminator that marks this object as a OutputApplyPatchServerToolItem in a `type`-tagged union. / Always `apply_patch_call`. Discriminator that marks this object as a OutputApplyPatchCallItem in a `type`-tagged union. / Always `shell_call`. Discriminator that marks this object as a OutputShellCallItem in a `type`-tagged union. / Always `shell_call_output`. Discriminator that marks this object as a OutputShellCallOutputItem in a `type`-tagged union. / Always `openrouter:shell`. Discriminator that marks this object as a OutputShellServerToolItem in a `type`-tagged union. / Always `openrouter:web_fetch`. Discriminator that marks this object as a OutputWebFetchServerToolItem in a `type`-tagged union. / Always `openrouter:tool_search`. Discriminator that marks this object as a OutputToolSearchServerToolItem in a `type`-tagged union. / Always `openrouter:memory`. Discriminator that marks this object as a OutputMemoryServerToolItem in a `type`-tagged union. / Always `openrouter:mcp`. Discriminator that marks this object as a OutputMcpServerToolItem in a `type`-tagged union. / Always `openrouter:experimental__search_models`. Discriminator that marks this object as a OutputSearchModelsServerToolItem in a `type`-tagged union. / Always `openrouter:fusion`. Discriminator that marks this object as a OutputFusionServerToolItem in a `type`-tagged union. / Always `openrouter:advisor`. Discriminator that marks this object as a OutputAdvisorServerToolItem in a `type`-tagged union. / Always `openrouter:subagent`. Discriminator that marks this object as a OutputSubagentServerToolItem in a `type`-tagged union. / Always `openrouter:files`. Discriminator that marks this object as a OutputFilesServerToolItem in a `type`-tagged union. / Always `custom_tool_call`. Discriminator that marks this object as a OutputCustomToolCallItem in a `type`-tagged union. |
| output[].encrypted_content | string | null | Opaque encrypted reasoning; send it back unchanged to let the model continue its reasoning on the next turn. |
| output[].summary | array<object> | Summary parts of the reasoning. |
| output[].format | string | null | Wire format of the reasoning details, which names the provider family that produced them. |
| output[].signature | string | null | A signature for the reasoning content, used for verification |
| output[].arguments | string | string | null | string | null | string | null | string | string | null | JSON-encoded arguments the model produced for the function. / The raw tool-call arguments string as emitted by the model. / The raw tool-call arguments string as emitted by the model. Echo back unchanged when replaying history; used verbatim to preserve provider prompt-cache prefixes. / The raw tool-call arguments string as emitted by the model. / The JSON arguments submitted to the search tool (e.g. {"query":"Claude"}) / The raw tool-call arguments string as emitted by the model. |
| output[].async | boolean | True when the model called a tool declared with `async: true` and may continue its turn before the output is returned. Return the result in a later request as a `function_call_output` with this `call_id`. |
| output[].call_id | string | string | null | string | string | string | string | string | null | string | string | null | string | Id of the call; the function_call_output item that answers it repeats it as call_id. / Id of the call; the computer_call_output item that answers it repeats it as call_id. / The model-generated tool call id from the originating turn. / Id of the apply_patch tool call. / Id of the call; the apply_patch_call_output item that answers it repeats it as call_id. / Id of the call; the shell_call_output item that answers it repeats it as call_id. / Id of the shell call this output answers. / The model-generated tool call id from the originating turn. / EXPERIMENTAL — subject to change without notice. The `call_id` of the tool call that spawned this subagent. This id will also be included as the `subagent_id` on any `function_call` items created by the subagent. This must be returned in the request so the `function_call` can be matched with the correct subagent. A suspended `in_progress` item is announced once and never re-emitted or terminally closed — completion arrives as a new item with the same `call_id`. / The model-generated tool call id from the originating turn. / Id of the call; the custom_tool_call_output item that answers it repeats it as call_id. |
| output[].name | string | Name of the function being called. / Configured name of the subagent that executed the task (the `name` on its tool entry). Present only for named subagents; omitted for an unnamed (default) subagent. / Name of the custom tool being called. |
| output[].namespace | string | Namespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server) |
| output[].subagent_id | string | EXPERIMENTAL — subject to change without notice. String id that matches the `call_id` of the `openrouter:subagent` server tool call that spawned the subagent. Present on every `function_call` item the subagent projects; absent on ordinary function calls. |
| output[].subagent_items | array<object> | EXPERIMENTAL — subject to change without notice. The subagent's output items produced on this turn. Treat this as an opaque object; you must replay it in the request so that the subagent can continue execution of the tool with the same context. If a subagent created multiple parallel tool calls, only the first tool call will have this field. The other tool calls will only have `subagent_id`. Present only if the tool call originates from a subagent spawned by the `openrouter:subagent` server tool. |
| output[].action | object | any | object | string | object | object | string | The search action the model took: a search, opening a page, or finding a pattern in a page. / The action the model asks the client to perform on the computer. / The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider. / The browser action that was performed. / The commands the model asks the client to run. / The commands that were run. / Memory action that was performed. |
| output[].queries | array<string> | Queries the model ran against the vector stores. / Queries that ran against the vector stores. |
| output[].result | string | null | string | Base64-encoded generated image; null while generation has not finished. / The generated image as a base64-encoded string or URL, matching OpenAI image_generation_call format / JSON-serialized result of the file operation. |
| output[].prompt | string | The prompt (possibly rewritten) that the image was generated from. / The prompt the executor sent to the advisor. |
| output[].code | string | null | string | The code the interpreter ran; null while it is still being written. / The code that ran. |
| output[].container_id | string | Id of the container the code ran in. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. / The canonical container id the command ran under — the `{container_id}` for the Container Files API, reusable as a `container_reference` in later requests. Present on every sandbox-executed call, even when no files changed. |
| output[].outputs | array | null | Outputs of the run: logs and images; null while the run has not finished. |
| output[].pending_safety_checks | array<object> | Safety checks that must be acknowledged before the action is performed. |
| output[].datetime | string | ISO 8601 datetime string |
| output[].timezone | string | IANA timezone name |
| output[].exitCode | integer | Exit code of the run; 0 means success. / Exit code of the command; 0 means success. |
| output[].language | string | Language of the code that ran. |
| output[].stderr | string | Standard error output of the code. / Standard error output of the command. |
| output[].stdout | string | Standard output of the code. / Standard output of the command. |
| output[].imageB64 | string | Base64-encoded generated image. |
| output[].imageUrl | string | URL of the generated image. |
| output[].revisedPrompt | string | Prompt after the image model rewrote it. |
| output[].screenshotB64 | string | Base64-encoded screenshot taken after the action. |
| output[].command | string | The bash command that ran. / Editor command that ran. |
| output[].error | string | The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. A non-zero `exitCode` is a command failure, not a tool failure. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'incomplete'` and an empty `output`; absent on a successful call. / The error message when the sandbox call failed before producing a result (for example, the per-user container limit was reached). Set together with `status: 'failed'`; absent on a successful call. `output` is omitted when `error` is set. / The error message if the fetch failed. / Error message when the fusion run did not produce an analysis result. / Error message when the advisor call did not produce advice. Set together with `status: 'failed'` on the terminal item. / Error message when the subagent task did not produce an outcome. Set together with `status: 'failed'` on the terminal item. / Error message when the file operation failed. |
| output[].files | array<object> | Citations for the files the sandbox command created or modified, most-recently-touched first (at most 10). Retrieve them via the Container Files API. |
| output[].filePath | string | Path of the file the command worked on. |
| output[].operation | object | string | The patch operation requested by an `apply_patch_call`. `create_file` and `update_file` carry a V4A diff; `delete_file` omits it. / The file operation performed (list, read, write, or edit). |
| output[].max_output_length | integer | null | Maximum number of characters of output that was kept; null for no limit. |
| output[].output | array<object> | Output of each command, in the order the commands ran. |
| output[].httpStatus | integer | The HTTP status code returned by the upstream URL fetch. |
| output[].title | string | Title of the fetched page. |
| output[].url | string | URL that was fetched. |
| output[].query | string | The tool search query. / The model search query. |
| output[].key | string | Key of the memory entry. |
| output[].value | any | Value of the memory entry; absent for reads that found nothing and for deletes. |
| output[].serverLabel | string | Label of the MCP server. |
| output[].toolName | string | Name of the MCP tool that was called. |
| output[].analysis | object | Structured analysis produced by the fusion analyst model. |
| output[].failed_models | array<object> | Models that were requested as part of the analysis panel but did not produce a response. Present when at least one requested analysis model failed. The fusion result is still usable but was produced from a degraded panel. |
| output[].failure_reason | string | Typed failure reason when the fusion run failed. Possible values include: all_panels_failed, insufficient_credits, rate_limited, invalid_model, judge_not_valid_json, judge_schema_mismatch, judge_upstream_error, judge_empty_completion. The four analysis-stage codes keep their pre-rename `judge_` spelling so existing consumers keep matching. The consumer-cancellation code is `cancelled`. |
| output[].responses | array<object> | Analysis models that produced a response in this fusion run, with each model's full panel content. |
| output[].sources | array<object> | Web pages the analysis panels and analyst retrieved via web search during this fusion run, deduplicated by URL across the whole run. Present when at least one model cited a source. |
| output[].advice | string | The advisor model's response (the advice text returned to the executor). |
| output[].instance_name | string | Provider-safe function name of the specific advisor instance that produced this item (e.g. `openrouter_advisor__1`). Present only when more than one advisor tool is configured; omitted for the default single advisor. Echo this field back unchanged so the advisor's cross-request memory stays namespaced to the correct instance. This identity is positional: it is derived from the index of the advisor entry in the request `tools` array, so clients must keep the order of advisor tool entries stable across requests in a conversation. Reordering or inserting advisor entries shifts these names and causes each advisor's cross-request memory to be attributed to the wrong instance. / Provider-safe function name of the specific subagent instance that produced this item (e.g. `openrouter_subagent__1`). Present only on items from non-default instances — the second and later subagent entries in the request `tools` array. The first (default) instance omits it, even when multiple subagents are configured. When a replayed item echoes this field back, the transcript rehydrates the call under that instance's tool. This identity is positional: it is derived from the index of the subagent entry in the request `tools` array, so keep the order of subagent entries stable across requests in a conversation. |
| output[].model | string | Slug of the advisor model that was consulted. / Slug of the worker model that executed the task. |
| output[].outcome | string | The worker model's result (the outcome text returned to the delegating model). |
| output[].task_description | string | The task description the delegating model sent to the worker. |
| output[].task_name | string | The short task identifier the delegating model supplied. |
| output[].file_id | string | The target file id supplied in the tool-call arguments. |
| output[].filename | string | The target filename supplied in the tool-call arguments. |
| output[].input | string | Free-form input the model produced for the custom tool. |
| output_text | string | Convenience concatenation of all output text of the response. |
| parallel_tool_calls | boolean | Whether the model was allowed to call several tools in one turn. |
| presence_penalty | number | null | The presence penalty that applied to the request, if any. |
| previous_response_id | string | null | Id of the response this one continued; null when it started a new conversation. |
| prompt | object | null | Reference to a stored prompt template with its variables. |
| prompt.id | string | Id of the stored prompt template. |
| prompt.variables | object | null | Values for the template variables, keyed by variable name; a value is a string or an input text, image or file part. |
| prompt_cache_key | string | null | Cache key the request supplied to improve prompt cache hits; null when none was set. |
| prompt_cache_options | object | null | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. |
| prompt_cache_options.mode | string | Prompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint. |
| prompt_cache_options.ttl | string | null | Lifetime of cache entries, for example 30m; null leaves the provider default. |
| reasoning | object | null | Reasoning settings that applied: effort, summary verbosity, mode and context. |
| reasoning.context | string | null | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.effort | string | null | How much reasoning the model should spend. |
| reasoning.mode | string | null | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. |
| reasoning.summary | string | null | How detailed the reasoning summary should be. |
| safety_identifier | string | null | End-user identifier the request supplied for abuse monitoring; null when none was set. |
| service_tier | string | null | Service tier the provider used for the response; null when not reported. |
| status | string | Lifecycle status of the response. |
| store | boolean | Whether the response is stored so it can be retrieved later. |
| temperature | number | null | Sampling temperature that applied to the request, if any. |
| text | object | Text output configuration including format and verbosity |
| text.format | object | Text response format configuration |
| text.verbosity | string | null | How long the answer should be. |
| tool_choice | string | object | How the model picks tools: a mode string or a specific tool. |
| tool_choice.name | string | Name of the function or tool the model must call. |
| tool_choice.type | string | Kind of tool the model must call. / Always `allowed_tools`. Discriminator that marks this object as a ToolChoiceAllowed in a `type`-tagged union. / Kind of tool the model must call. / Kind of tool the model must call. |
| tool_choice.mode | string | auto lets the model pick among the allowed tools or none; required forces a call to one of them. |
| tool_choice.tools | array<object> | The allowed tools, each as a tool reference such as {type: function, name}. |
| tools | array<object> | Tools that were available to the model for this response. |
| tools[].description | string | null | string | string | What the function does and when to use it; the model reads this to decide whether to call it. / What the custom tool does and when to use it. / What the group of tools is for. |
| tools[].name | string | Name of the function; the model uses it in function_call items. / Name of the custom tool. / Name of the namespace that groups the tools. |
| tools[].parameters | object | null | JSON Schema of the function arguments; null when the function takes none. |
| tools[].strict | boolean | null | Whether to enforce strict argument validation against the schema; null leaves the provider default. |
| tools[].type | string | Always `function`. Discriminator that marks this object as a FunctionTool in a `type`-tagged union. / Always `web_search_preview`. Discriminator that marks this object as a Preview_WebSearchServerTool in a `type`-tagged union. / Always `web_search_preview_2025_03_11`. Discriminator that marks this object as a Preview_20250311_WebSearchServerTool in a `type`-tagged union. / Always `web_search`. Discriminator that marks this object as a Legacy_WebSearchServerTool in a `type`-tagged union. / Always `web_search_2025_08_26`. Discriminator that marks this object as a WebSearchServerTool in a `type`-tagged union. / Comparison operator. / Always `computer_use_preview`. Discriminator that marks this object as a ComputerUseServerTool in a `type`-tagged union. / Always `code_interpreter`. Discriminator that marks this object as a CodeInterpreterServerTool in a `type`-tagged union. / Always `mcp`. Discriminator that marks this object as a McpServerTool in a `type`-tagged union. / Always `image_generation`. Discriminator that marks this object as a ImageGenerationServerTool in a `type`-tagged union. / Always `local_shell`. Discriminator that marks this object as a CodexLocalShellTool in a `type`-tagged union. / Always `shell`. Discriminator that marks this object as a ShellServerTool in a `type`-tagged union. / Always `apply_patch`. Discriminator that marks this object as a ApplyPatchServerTool in a `type`-tagged union. / Always `custom`. Discriminator that marks this object as a CustomTool in a `type`-tagged union. / Always `namespace`. Discriminator that marks this object as a NamespaceTool in a `type`-tagged union. |
| tools[].async | boolean | Lets the model keep working after calling this tool instead of waiting for its output. The tool is still executed by the client; return the result in a later request as a `function_call_output` with the original `call_id`. Only honored by providers whose Responses API supports async tools; ignored elsewhere. |
| tools[].defer_loading | boolean | Withhold this tool from the model until `openrouter:tool_search` finds it. Requires the tool search server tool; at least one tool must remain non-deferred. |
| tools[].engine | string | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). |
| tools[].filters | object | null | Restricts web search by domain. / Attribute filter applied to the search: a comparison or a compound filter. |
| tools[].max_results | integer | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. |
| tools[].max_uses | integer | Maximum number of web searches the model may perform in a single request. Once reached, further search calls return an error result instead of executing. Applies to the Exa, Firecrawl, Parallel, and Perplexity engines. With native provider search, forwarded only to Anthropic (as `max_uses`); other native search providers have no equivalent parameter and ignore it. |
| tools[].mode | string | Engine-native search mode. Exa supports instant, fast, auto (default), deep-lite, deep, and deep-reasoning. Parallel supports turbo, fast, basic (default), and advanced. Modes unsupported by the selected engine are ignored. |
| tools[].search_context_size | string | Size of the search context for web search tools |
| tools[].user_location | object | null | Approximate location of the user, used to bias web search results. / User location information for web search / User location information for web search |
| tools[].max_num_results | integer | Maximum number of results to return, between 1 and 50. |
| tools[].ranking_options | object | Ranking options for the search. |
| tools[].vector_store_ids | array<string> | Ids of the vector stores to search. |
| tools[].display_height | integer | Height of the computer display in pixels. |
| tools[].display_width | integer | Width of the computer display in pixels. |
| tools[].environment | string | Kind of environment that is controlled. |
| tools[].container | string | object | Container for the code to run in: a container id or an automatic container with files. |
| tools[].allowed_tools | array<string> | object | null | Tools of the server the model may use: a list of names or a filter. |
| tools[].authorization | string | OAuth access token for the MCP server. |
| tools[].connector_id | string | Id of a built-in connector; give this or server_url. |
| tools[].headers | object | null | HTTP headers sent to the MCP server; null for none. |
| tools[].require_approval | object | string | null | Whether tool calls need approval before they run: always, never, or a filter per tool. |
| tools[].server_description | string | What the MCP server is for, which helps the model decide when to use it. |
| tools[].server_label | string | Label that names the MCP server in the conversation. |
| tools[].server_url | string | URL of the MCP server; give this or connector_id. |
| tools[].background | string | Background of the generated image. |
| tools[].input_fidelity | string | null | How closely to preserve details of input images; null uses the default. |
| tools[].input_image_mask | object | Mask that marks the region of the input image to edit. |
| tools[].model | string | Image model to use. |
| tools[].moderation | string | Moderation level applied to the generated image. |
| tools[].output_compression | integer | Compression level from 0 to 100 for jpeg and webp output. |
| tools[].output_format | string | File format of the generated image. |
| tools[].partial_images | integer | Number of partial images to stream while generating, from 0 to 3. |
| tools[].quality | string | Quality of the generated image. |
| tools[].size | string | Size of the generated image; auto lets the model choose. |
| tools[].format | object | Format of the tool input: free text or a grammar. |
| tools[].tools | array<object> | Function tools in the namespace. |
| top_logprobs | integer | Number of most likely tokens whose log probabilities were requested per position. |
| top_p | number | null | Nucleus sampling value that applied to the request, if any. |
| truncation | string | null | How to handle input that exceeds the context window. |
| usage | object | null | Token usage information for the response |
| usage.input_tokens | integer | Number of input tokens, cached tokens included. |
| usage.input_tokens_details | object | Breakdown of the input tokens. |
| usage.output_tokens | integer | Number of output tokens, reasoning tokens included. |
| usage.output_tokens_details | object | Breakdown of the output tokens. |
| usage.total_tokens | integer | Input plus output tokens. |
| usage.cost | number | null | Cost of the completion |
| usage.cost_details | object | Breakdown of the upstream inference cost. |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.server_tool_use_details | object | null | Usage for server-side tool execution (e.g., web search) |
| user | string | null | End-user identifier the request supplied; null when none was set. |
| error_type | string | Canonical OpenRouter error type, stable across all API formats |
| openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| openrouter_metadata.attempt | integer | Number of the attempt that served the request, starting at 1. |
| openrouter_metadata.attempts | array<object> | Every attempt that was made, in order. |
| openrouter_metadata.endpoints | object | Which endpoints were available and which one was chosen. |
| openrouter_metadata.generation_time | integer | Milliseconds measured for the generation, from dispatching the upstream request until its response body ended. Divide the completion token count by this for throughput. Absent when no upstream request was dispatched. |
| openrouter_metadata.is_byok | boolean | Whether the request used a key supplied by the caller. |
| openrouter_metadata.params | object | Router parameters that applied to the request. |
| openrouter_metadata.pipeline | array<object> | Stages the request went through before and after the model call. |
| openrouter_metadata.region | string | null | Region that served the request; null when unknown. |
| openrouter_metadata.requested | string | The model or alias the request asked for. |
| openrouter_metadata.strategy | string | How the router picked the model or provider for this request. |
| openrouter_metadata.summary | string | One-line summary of the routing decision. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| data | object | Union of all possible event types emitted during response streaming |
| data.response | object | Complete non-streaming response from the Responses API |
| data.sequence_number | integer | Position of this event in the stream. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream; it increases with every event, so use it to order events or detect a gap. / Position of this event in the stream. |
| data.type | string | Always `response.created`. Discriminator that marks this object as a CreatedEvent in a `type`-tagged union. / Always `response.in_progress`. Discriminator that marks this object as a InProgressEvent in a `type`-tagged union. / Always `response.completed`. Discriminator that marks this object as a CompletedEvent in a `type`-tagged union. / Always `response.incomplete`. Discriminator that marks this object as a IncompleteEvent in a `type`-tagged union. / Always `response.failed`. Discriminator that marks this object as a FailedEvent in a `type`-tagged union. / Always `error`. Discriminator that marks this object as a BaseErrorEvent in a `type`-tagged union. / Always `response.output_item.added`. Discriminator that marks this object as a OutputItemAddedEvent in a `type`-tagged union. / Always `response.output_item.done`. Discriminator that marks this object as a OutputItemDoneEvent in a `type`-tagged union. / Always `response.content_part.added`. Discriminator that marks this object as a BaseContentPartAddedEvent in a `type`-tagged union. / Always `response.content_part.done`. Discriminator that marks this object as a BaseContentPartDoneEvent in a `type`-tagged union. / Always `response.output_text.delta`. Discriminator that marks this object as a BaseTextDeltaEvent in a `type`-tagged union. / Always `response.output_text.done`. Discriminator that marks this object as a BaseTextDoneEvent in a `type`-tagged union. / Always `response.refusal.delta`. Discriminator that marks this object as a BaseRefusalDeltaEvent in a `type`-tagged union. / Always `response.refusal.done`. Discriminator that marks this object as a BaseRefusalDoneEvent in a `type`-tagged union. / Always `response.output_text.annotation.added`. Discriminator that marks this object as a BaseAnnotationAddedEvent in a `type`-tagged union. / Always `response.function_call_arguments.delta`. Discriminator that marks this object as a BaseFunctionCallArgsDeltaEvent in a `type`-tagged union. / Always `response.function_call_arguments.done`. Discriminator that marks this object as a BaseFunctionCallArgsDoneEvent in a `type`-tagged union. / Always `response.reasoning_text.delta`. Discriminator that marks this object as a BaseReasoningDeltaEvent in a `type`-tagged union. / Always `response.reasoning_text.done`. Discriminator that marks this object as a BaseReasoningDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.added`. Discriminator that marks this object as a BaseReasoningSummaryPartAddedEvent in a `type`-tagged union. / Always `response.reasoning_summary_part.done`. Discriminator that marks this object as a BaseReasoningSummaryPartDoneEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.delta`. Discriminator that marks this object as a BaseReasoningSummaryTextDeltaEvent in a `type`-tagged union. / Always `response.reasoning_summary_text.done`. Discriminator that marks this object as a BaseReasoningSummaryTextDoneEvent in a `type`-tagged union. / Always `response.image_generation_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesImageGenCallInProgress in a `type`-tagged union. / Always `response.image_generation_call.generating`. Discriminator that marks this object as a OpenAIResponsesImageGenCallGenerating in a `type`-tagged union. / Always `response.image_generation_call.partial_image`. Discriminator that marks this object as a OpenAIResponsesImageGenCallPartialImage in a `type`-tagged union. / Always `response.image_generation_call.completed`. Discriminator that marks this object as a OpenAIResponsesImageGenCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInProgress in a `type`-tagged union. / Always `response.code_interpreter_call.interpreting`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallInterpreting in a `type`-tagged union. / Always `response.code_interpreter_call.completed`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCompleted in a `type`-tagged union. / Always `response.code_interpreter_call_code.delta`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDelta in a `type`-tagged union. / Always `response.code_interpreter_call_code.done`. Discriminator that marks this object as a OpenAIResponsesCodeInterpreterCallCodeDone in a `type`-tagged union. / Always `response.web_search_call.in_progress`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallInProgress in a `type`-tagged union. / Always `response.web_search_call.searching`. Discriminator that marks this object as a OpenAIResponsesWebSearchCallSearching in a `type`-tagged union. / Always `response.web_search_call.completed`. Discriminator that marks this object as a OpenAIResponsesSearchCompleted in a `type`-tagged union. / Always `response.custom_tool_call_input.delta`. Discriminator that marks this object as a BaseCustomToolCallInputDeltaEvent in a `type`-tagged union. / Always `response.custom_tool_call_input.done`. Discriminator that marks this object as a BaseCustomToolCallInputDoneEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.delta`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDeltaEvent in a `type`-tagged union. / Always `response.apply_patch_call_operation_diff.done`. Discriminator that marks this object as a ApplyPatchCallOperationDiffDoneEvent in a `type`-tagged union. / Always `response.fusion_call.in_progress`. Discriminator that marks this object as a FusionCallInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.panel.added`. Discriminator that marks this object as a FusionCallPanelAddedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.delta`. Discriminator that marks this object as a FusionCallPanelDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.reasoning.delta`. Discriminator that marks this object as a FusionCallPanelReasoningDeltaEvent in a `type`-tagged union. / Always `response.fusion_call.panel.completed`. Discriminator that marks this object as a FusionCallPanelCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.panel.failed`. Discriminator that marks this object as a FusionCallPanelFailedEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.in_progress`. Discriminator that marks this object as a FusionCallAnalysisInProgressEvent in a `type`-tagged union. / Always `response.fusion_call.analysis.completed`. Discriminator that marks this object as a FusionCallAnalysisCompletedEvent in a `type`-tagged union. / Always `response.fusion_call.completed`. Discriminator that marks this object as a FusionCallCompletedEvent in a `type`-tagged union. / Always `response.debug`. Discriminator that marks this object as a DebugEvent in a `type`-tagged union. |
| data.code | string | null | string | Error code; null when the upstream gave none. / The complete code the interpreter runs. |
| data.message | string | Human-readable error message. |
| data.param | string | null | Name of the request parameter the error is about; null when it is not about a parameter. |
| data.item | object | An output item from the response |
| data.output_index | integer | Index of the item in the response output array that this event belongs to. |
| data.content_index | integer | Index of the content part inside the output item that this event belongs to. |
| data.item_id | string | Id of the output item this event belongs to; it equals the id of that item in the response output. |
| data.part | object | The content part as it starts: output text or refusal. / The content part in its final form: output text or refusal. / A reasoning summary part. / A reasoning summary part. |
| data.delta | string | Text fragment to append to the output text of this content part. / Refusal text fragment to append. / Fragment of the JSON-encoded function arguments to append. / Reasoning text fragment to append. / Reasoning summary text fragment to append. / Fragment of the code the interpreter will run, to append. / Fragment of the custom tool call input to append. / Fragment of the patch diff to append. / Text fragment the panel model produced. / Reasoning text fragment the panel model produced. |
| data.logprobs | array<object> | Log probabilities of the tokens in this fragment, when requested. / Log probabilities of the tokens in the complete text, when requested. |
| data.text | string | The complete output text of this content part. / The complete reasoning text of this content part. / The complete reasoning summary text of this part. |
| data.refusal | string | The complete refusal text. |
| data.annotation | object | Annotation attached to output text: a file citation, URL citation or file path. |
| data.annotation_index | integer | Index of the new annotation inside the content part's annotations array. |
| data.arguments | string | The complete JSON-encoded arguments of the function call. |
| data.name | string | Name of the function being called. |
| data.summary_index | integer | Index of the reasoning summary part inside the reasoning item that this event belongs to. |
| data.partial_image_b64 | string | Base64-encoded partial image produced while generation is still running. |
| data.partial_image_index | integer | Zero-based index of this partial image among the partial images of the call. |
| data.input | string | The complete input of the custom tool call. |
| data.diff | string | The complete patch diff. |
| data.model | string | Slug of the panel model that started. / Slug of the panel model that produced the fragment. / Slug of the panel model that produced the fragment. / Slug of the panel model that finished. / Slug of the panel model that failed. |
| data.content | string | The complete answer of the panel model. |
| data.error | string | Error message that explains why the panel model failed. |
| data.status_code | integer | HTTP status code of the failed upstream call, when one is available. |
| data.analyst_model | string | Slug of the model producing the structured analysis. |
| data.judge_model | string | Deprecated alias of `analyst_model`, kept so existing consumers keep working. Always carries the same value. Use `analyst_model`. |
| data.analysis | object | Structured analysis produced by the fusion analyst model. |
| data.debug | object | Debug information. |