OpenAI

生成响应

发送一条输入,返回模型生成的一条响应;可流式。

POST /openai/v1/responses● 支持

OpenAI 官方文档 ↗

请求体

  • modelstring必填◐ 部分支持

    已验证支持 glm-5.3-flash、deepseek-flash;没有 Responses 协议的模型返回 404。

  • streamboolean可选◐ 部分支持
    默认 false

    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.

      取值 shell
    • 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.

        取值 explicit
      • 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.

        取值 autoall_turnscurrent_turnnull
      • effortstring可选◐ 部分支持

        How much reasoning the model should spend.

        deepseek-flash 的 none 可关闭思考,其余档位不保证单调;glm-5.3-flash 接受但当前不生效,none 仍思考。

        取值 maxxhighhighmediumlowminimalnonenull
      • 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.

        取值 standardpronull
      • summarystring可选◐ 部分支持

        How detailed the reasoning summary should be.

        glm-5.3-flash 的 concise 偶发有摘要,auto/detailed 未见;deepseek-flash 接受但当前不生效。

        取值 autoconcisedetailednull
      • enabledboolean可选
      • max_tokensinteger可选
    • safety_identifierstring可选

      建议为终端用户设置的稳定标识符,用于滥用隔离。使用稳定的 ID、哈希值或化名。若上游 provider 需要用户身份,我们会把它折算进转发的哈希身份、不会原样转发;省略时请求使用账号级身份,滥用处置可能影响整个账号。

    • service_tierstring可选
      默认 "auto"

      请求使用的服务档位;当前效果不可观测。

      取值 autodefaultfastflexpriorityscalenull
    • storeboolean可选
      默认 true

      是否在服务端保存这条响应,以便之后通过 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 均未观察到长度变化。

        取值 lowmediumhighxhighmaxnull
    • top_logprobsinteger可选◐ 部分支持

      deepseek-flash 生效,允许 0–20;glm-5.3-flash 返回空 logprobs。

    • truncationstring可选

      How to handle input that exceeds the context window.

      取值 autodisablednull
    • 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

名称类型说明
backgroundboolean | nullWhether the response was started in background mode.
completed_atinteger | nullUnix time in seconds at which the response finished; null while it has not finished.
created_atintegerUnix time in seconds at which the response was created.
errorobject | nullError information returned from the API
error.codestringMachine-readable error code.
error.messagestringHuman-readable error message.
frequency_penaltynumber | nullThe frequency penalty that applied to the request, if any.
idstringUnique 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_detailsobject | nullWhy the response stopped before finishing; null for complete responses.
incomplete_details.reasonstringWhy the response is incomplete.
instructionsstring | array<object> | nullInput of the request: a string or an array of input items.
max_output_tokensinteger | nullUpper bound on generated tokens that applied to the request; null when none was set.
max_tool_callsinteger | nullUpper bound on built-in tool calls that applied to the request; null when none was set.
metadataobject | nullMetadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.
modelstringModel that produced the response.
objectstringObject type; always `response`.
outputarray<object>Items the model produced, in order: messages, reasoning, tool calls and tool results.
output[].contentarray<object> | array | null | stringContent parts of the message: output text or refusal. / Reasoning text parts, when the provider returns them. / Text content of the fetched page.
output[].idstringId 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[].phasestring | nullThe 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[].rolestringRole of the author; always assistant.
output[].statusstringStatus 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[].typestringAlways `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_contentstring | nullOpaque encrypted reasoning; send it back unchanged to let the model continue its reasoning on the next turn.
output[].summaryarray<object>Summary parts of the reasoning.
output[].formatstring | nullWire format of the reasoning details, which names the provider family that produced them.
output[].signaturestring | nullA signature for the reasoning content, used for verification
output[].argumentsstring | string | null | string | null | string | null | string | string | nullJSON-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[].asyncbooleanTrue 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_idstring | string | null | string | string | string | string | string | null | string | string | null | stringId 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[].namestringName 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[].namespacestringNamespace qualifier for tools registered as part of a namespace tool group (e.g. an MCP server)
output[].subagent_idstringEXPERIMENTAL — 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_itemsarray<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[].actionobject | any | object | string | object | object | stringThe 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[].queriesarray<string>Queries the model ran against the vector stores. / Queries that ran against the vector stores.
output[].resultstring | null | stringBase64-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[].promptstringThe prompt (possibly rewritten) that the image was generated from. / The prompt the executor sent to the advisor.
output[].codestring | null | stringThe code the interpreter ran; null while it is still being written. / The code that ran.
output[].container_idstringId 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[].outputsarray | nullOutputs of the run: logs and images; null while the run has not finished.
output[].pending_safety_checksarray<object>Safety checks that must be acknowledged before the action is performed.
output[].datetimestringISO 8601 datetime string
output[].timezonestringIANA timezone name
output[].exitCodeintegerExit code of the run; 0 means success. / Exit code of the command; 0 means success.
output[].languagestringLanguage of the code that ran.
output[].stderrstringStandard error output of the code. / Standard error output of the command.
output[].stdoutstringStandard output of the code. / Standard output of the command.
output[].imageB64stringBase64-encoded generated image.
output[].imageUrlstringURL of the generated image.
output[].revisedPromptstringPrompt after the image model rewrote it.
output[].screenshotB64stringBase64-encoded screenshot taken after the action.
output[].commandstringThe bash command that ran. / Editor command that ran.
output[].errorstringThe 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[].filesarray<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[].filePathstringPath of the file the command worked on.
output[].operationobject | stringThe 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_lengthinteger | nullMaximum number of characters of output that was kept; null for no limit.
output[].outputarray<object>Output of each command, in the order the commands ran.
output[].httpStatusintegerThe HTTP status code returned by the upstream URL fetch.
output[].titlestringTitle of the fetched page.
output[].urlstringURL that was fetched.
output[].querystringThe tool search query. / The model search query.
output[].keystringKey of the memory entry.
output[].valueanyValue of the memory entry; absent for reads that found nothing and for deletes.
output[].serverLabelstringLabel of the MCP server.
output[].toolNamestringName of the MCP tool that was called.
output[].analysisobjectStructured analysis produced by the fusion analyst model.
output[].failed_modelsarray<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_reasonstringTyped 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[].responsesarray<object>Analysis models that produced a response in this fusion run, with each model's full panel content.
output[].sourcesarray<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[].advicestringThe advisor model's response (the advice text returned to the executor).
output[].instance_namestringProvider-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[].modelstringSlug of the advisor model that was consulted. / Slug of the worker model that executed the task.
output[].outcomestringThe worker model's result (the outcome text returned to the delegating model).
output[].task_descriptionstringThe task description the delegating model sent to the worker.
output[].task_namestringThe short task identifier the delegating model supplied.
output[].file_idstringThe target file id supplied in the tool-call arguments.
output[].filenamestringThe target filename supplied in the tool-call arguments.
output[].inputstringFree-form input the model produced for the custom tool.
output_textstringConvenience concatenation of all output text of the response.
parallel_tool_callsbooleanWhether the model was allowed to call several tools in one turn.
presence_penaltynumber | nullThe presence penalty that applied to the request, if any.
previous_response_idstring | nullId of the response this one continued; null when it started a new conversation.
promptobject | nullReference to a stored prompt template with its variables.
prompt.idstringId of the stored prompt template.
prompt.variablesobject | nullValues for the template variables, keyed by variable name; a value is a string or an input text, image or file part.
prompt_cache_keystring | nullCache key the request supplied to improve prompt cache hits; null when none was set.
prompt_cache_optionsobject | nullRequest-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.modestringPrompt cache mode; explicit caches only the blocks marked with prompt_cache_breakpoint.
prompt_cache_options.ttlstring | nullLifetime of cache entries, for example 30m; null leaves the provider default.
reasoningobject | nullReasoning settings that applied: effort, summary verbosity, mode and context.
reasoning.contextstring | nullControls 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.effortstring | nullHow much reasoning the model should spend.
reasoning.modestring | nullSelects 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.summarystring | nullHow detailed the reasoning summary should be.
safety_identifierstring | nullEnd-user identifier the request supplied for abuse monitoring; null when none was set.
service_tierstring | nullService tier the provider used for the response; null when not reported.
statusstringLifecycle status of the response.
storebooleanWhether the response is stored so it can be retrieved later.
temperaturenumber | nullSampling temperature that applied to the request, if any.
textobjectText output configuration including format and verbosity
text.formatobjectText response format configuration
text.verbositystring | nullHow long the answer should be.
tool_choicestring | objectHow the model picks tools: a mode string or a specific tool.
tool_choice.namestringName of the function or tool the model must call.
tool_choice.typestringKind 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.modestringauto lets the model pick among the allowed tools or none; required forces a call to one of them.
tool_choice.toolsarray<object>The allowed tools, each as a tool reference such as {type: function, name}.
toolsarray<object>Tools that were available to the model for this response.
tools[].descriptionstring | null | string | stringWhat 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[].namestringName 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[].parametersobject | nullJSON Schema of the function arguments; null when the function takes none.
tools[].strictboolean | nullWhether to enforce strict argument validation against the schema; null leaves the provider default.
tools[].typestringAlways `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[].asyncbooleanLets 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_loadingbooleanWithhold 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[].enginestringWhich 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[].filtersobject | nullRestricts web search by domain. / Attribute filter applied to the search: a comparison or a compound filter.
tools[].max_resultsintegerMaximum 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_usesintegerMaximum 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[].modestringEngine-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_sizestringSize of the search context for web search tools
tools[].user_locationobject | nullApproximate 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_resultsintegerMaximum number of results to return, between 1 and 50.
tools[].ranking_optionsobjectRanking options for the search.
tools[].vector_store_idsarray<string>Ids of the vector stores to search.
tools[].display_heightintegerHeight of the computer display in pixels.
tools[].display_widthintegerWidth of the computer display in pixels.
tools[].environmentstringKind of environment that is controlled.
tools[].containerstring | objectContainer for the code to run in: a container id or an automatic container with files.
tools[].allowed_toolsarray<string> | object | nullTools of the server the model may use: a list of names or a filter.
tools[].authorizationstringOAuth access token for the MCP server.
tools[].connector_idstringId of a built-in connector; give this or server_url.
tools[].headersobject | nullHTTP headers sent to the MCP server; null for none.
tools[].require_approvalobject | string | nullWhether tool calls need approval before they run: always, never, or a filter per tool.
tools[].server_descriptionstringWhat the MCP server is for, which helps the model decide when to use it.
tools[].server_labelstringLabel that names the MCP server in the conversation.
tools[].server_urlstringURL of the MCP server; give this or connector_id.
tools[].backgroundstringBackground of the generated image.
tools[].input_fidelitystring | nullHow closely to preserve details of input images; null uses the default.
tools[].input_image_maskobjectMask that marks the region of the input image to edit.
tools[].modelstringImage model to use.
tools[].moderationstringModeration level applied to the generated image.
tools[].output_compressionintegerCompression level from 0 to 100 for jpeg and webp output.
tools[].output_formatstringFile format of the generated image.
tools[].partial_imagesintegerNumber of partial images to stream while generating, from 0 to 3.
tools[].qualitystringQuality of the generated image.
tools[].sizestringSize of the generated image; auto lets the model choose.
tools[].formatobjectFormat of the tool input: free text or a grammar.
tools[].toolsarray<object>Function tools in the namespace.
top_logprobsintegerNumber of most likely tokens whose log probabilities were requested per position.
top_pnumber | nullNucleus sampling value that applied to the request, if any.
truncationstring | nullHow to handle input that exceeds the context window.
usageobject | nullToken usage information for the response
usage.input_tokensintegerNumber of input tokens, cached tokens included.
usage.input_tokens_detailsobjectBreakdown of the input tokens.
usage.output_tokensintegerNumber of output tokens, reasoning tokens included.
usage.output_tokens_detailsobjectBreakdown of the output tokens.
usage.total_tokensintegerInput plus output tokens.
usage.costnumber | nullCost of the completion
usage.cost_detailsobjectBreakdown of the upstream inference cost.
usage.is_byokbooleanWhether a request was made using a Bring Your Own Key configuration
usage.server_tool_use_detailsobject | nullUsage for server-side tool execution (e.g., web search)
userstring | nullEnd-user identifier the request supplied; null when none was set.
error_typestringCanonical OpenRouter error type, stable across all API formats
openrouter_metadataobjectRouting report: what was requested, how the router chose, and what was attempted.
openrouter_metadata.attemptintegerNumber of the attempt that served the request, starting at 1.
openrouter_metadata.attemptsarray<object>Every attempt that was made, in order.
openrouter_metadata.endpointsobjectWhich endpoints were available and which one was chosen.
openrouter_metadata.generation_timeintegerMilliseconds 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_byokbooleanWhether the request used a key supplied by the caller.
openrouter_metadata.paramsobjectRouter parameters that applied to the request.
openrouter_metadata.pipelinearray<object>Stages the request went through before and after the model call.
openrouter_metadata.regionstring | nullRegion that served the request; null when unknown.
openrouter_metadata.requestedstringThe model or alias the request asked for.
openrouter_metadata.strategystringHow the router picked the model or provider for this request.
openrouter_metadata.summarystringOne-line summary of the routing decision.

text/event-stream — chunk / 事件对象

名称类型说明
dataobjectUnion of all possible event types emitted during response streaming
data.responseobjectComplete non-streaming response from the Responses API
data.sequence_numberintegerPosition 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.typestringAlways `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.codestring | null | stringError code; null when the upstream gave none. / The complete code the interpreter runs.
data.messagestringHuman-readable error message.
data.paramstring | nullName of the request parameter the error is about; null when it is not about a parameter.
data.itemobjectAn output item from the response
data.output_indexintegerIndex of the item in the response output array that this event belongs to.
data.content_indexintegerIndex of the content part inside the output item that this event belongs to.
data.item_idstringId of the output item this event belongs to; it equals the id of that item in the response output.
data.partobjectThe 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.deltastringText 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.logprobsarray<object>Log probabilities of the tokens in this fragment, when requested. / Log probabilities of the tokens in the complete text, when requested.
data.textstringThe complete output text of this content part. / The complete reasoning text of this content part. / The complete reasoning summary text of this part.
data.refusalstringThe complete refusal text.
data.annotationobjectAnnotation attached to output text: a file citation, URL citation or file path.
data.annotation_indexintegerIndex of the new annotation inside the content part's annotations array.
data.argumentsstringThe complete JSON-encoded arguments of the function call.
data.namestringName of the function being called.
data.summary_indexintegerIndex of the reasoning summary part inside the reasoning item that this event belongs to.
data.partial_image_b64stringBase64-encoded partial image produced while generation is still running.
data.partial_image_indexintegerZero-based index of this partial image among the partial images of the call.
data.inputstringThe complete input of the custom tool call.
data.diffstringThe complete patch diff.
data.modelstringSlug 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.contentstringThe complete answer of the panel model.
data.errorstringError message that explains why the panel model failed.
data.status_codeintegerHTTP status code of the failed upstream call, when one is available.
data.analyst_modelstringSlug of the model producing the structured analysis.
data.judge_modelstringDeprecated alias of `analyst_model`, kept so existing consumers keep working. Always carries the same value. Use `analyst_model`.
data.analysisobjectStructured analysis produced by the fusion analyst model.
data.debugobjectDebug information.