对话
发送一组对话消息,返回模型的回复;可流式。
/openai/v1/chat/completions● 支持请求参数
X-OpenRouter-Metadatastring可选○ 当前不生效header: Opt-in to surface routing metadata on the response under `openrouter_metadata`. Defaults to `disabled`. The legacy header `X-OpenRouter-Experimental-Metadata` is also accepted for backward compatibility.
接受但当前不生效;不会返回请求的路由元数据。
messagesarray必填◐ 部分支持List of messages for the conversation
文本、角色、历史和工具往返生效;图片受模型尺寸限制;file_id 可引用 user_data 图片、文本和 PDF;模型读取能力与失败处理见[文件引用指南](/docs/cloud/services/model/guides/files)。
▸ 展开子字段(12)
元素按 role 区分(assistant / developer / system / tool / user),此处展开其中一种的形状
configuration_updateobject可选OpenRouter extension. Same as the system message `configuration_update`: changes reasoning effort from this point in the conversation onward without invalidating the prompt cache for the preceding turns.
contentstring | array可选Tool response content
namestring可选Optional name for the assistant
rolestring可选Role of the message author; always tool.
audioobject可选Audio output data or reference
imagesarray可选Generated images from image generation models
modelstring可选Model that generated this assistant message
reasoningstring可选Reasoning output
reasoning_detailsarray可选Reasoning details for extended thinking models
refusalstring可选Refusal message if content was refused
tool_callsarray可选Tool calls made by the assistant
tool_call_idstring可选ID of the assistant message tool call this message responds to
modelstring可选Model to use for completion
主模型;提供非空 models 时可省略,使用列表首项。
streamboolean可选◐ 部分支持Enable streaming response
流式正文和工具增量生效;gemini-2.5-flash 可能缺少结束标记,预算耗尽时 finish_reason 可能不准确。
temperaturenumber可选◐ 部分支持Sampling temperature (0-2)
在 /openai 的 deepseek-v4-flash 观察到效果;其余模型的采样差异无法确认。
max_tokensinteger可选◐ 部分支持Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效。与 max_completion_tokens 同传时本字段优先。
top_pnumber可选◐ 部分支持Nucleus sampling parameter (0-1)
仅 /model 的 glm-5.3-flash 观察到效果;其余已测模型或协议面接受但未见效果。
stopstring | array可选◐ 部分支持Stop sequences (up to 4)
qwen3.8-flash 生效;deepseek-v4-flash、glm-5.3-flash 可能截断思考并返回空正文。
toolsarray可选Available tools for function calling
已验证生效。
tool_choicestring | object可选◐ 部分支持Tool choice configuration
auto 生效;deepseek-v4-flash 忽略 none/required/具名函数;qwen3.8-flash 的 required/具名函数在思考模式报错;glm-5.3-flash 的具名函数结果不稳定。
▸ 展开子字段(2)
functionobject必填The function the model must call.
typestring必填OpenRouter server-tool type to force (e.g. `openrouter:web_search`, `web_search`, `web_search_preview`).
▸ 更多参数(48)
response_formatobject可选◐ 部分支持Response format configuration
json_object 生效;json_schema 在 deepseek-v4-flash、qwen3.8-flash 生效,glm-5.3-flash 接受但未遵守。
▸ 展开子字段(3)
按 type 区分(grammar / json_object / json_schema / python / text),此处展开其中一种的形状
typestring必填Always `python`. Discriminator that marks this object as a ChatFormatPythonConfig in a `type`-tagged union.
json_schemaobject必填JSON Schema configuration object
grammarstring必填Custom grammar for text generation
cache_controlobject可选Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
▸ 展开子字段(2)
ttlstring可选Lifetime of an Anthropic-style cache breakpoint.
typestring必填Always `ephemeral`. Discriminator that marks this object as a AnthropicCacheControlDirective in a `type`-tagged union.
debugobject可选Debug options for inspecting request transformations (streaming only)
▸ 展开子字段(1)
echo_upstream_bodyboolean可选○ 当前不生效If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.
接受但当前不生效。流式请求不会回显上游请求体。
frequency_penaltynumber可选◐ 部分支持Frequency penalty (-2.0 to 2.0)
deepseek-v4-flash、glm-5.3-flash 部分请求生效;qwen3.8-flash 在部分取值或协议面返回 400。
image_configobject可选Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.
logit_biasobject可选Token logit bias adjustments
logprobsboolean可选◐ 部分支持Return log probabilities
qwen3.8-flash 生效;deepseek-v4-flash 仅 /openai 生效,glm-5.3-flash 的两面结果不一致;gemini-2.5-flash 返回 400。
max_completion_tokensinteger可选◐ 部分支持Maximum tokens in completion
deepseek-v4-flash、glm-5.3-flash 生效;qwen3.8-flash 的小预算可能不生效或报超限。
metadataobject可选Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
min_pnumber可选○ 当前不生效Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
接受但当前不生效。
modalitiesarray可选Output modalities for the response. Supported values are "text", "image", and "audio".
modelsarray可选Models to use for completion
按顺序回退:主模型不存在、无同协议线路或上游失败均尝试下一项。可只给 models;响应 model 和费用归属最终完成请求的模型。
parallel_tool_callsboolean可选◐ 部分支持Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response.
false 在 qwen3.8-flash 生效;deepseek-v4-flash 接受但不生效;glm-5.3-flash 的两面结果不一致。
pluginsarray可选◐ 部分支持Plugins you want to enable for this request, including their settings.
支持 file-parser(pdf.engine 为 native、mistral-ocr→ocr、ocr、auto)和平台 guardrails。请求覆盖账户默认,锁定设置保留。web 等未实现插件、未知引擎或非法形状返回 400 并点名字段。
▸ 展开子字段(27)
元素按 id 区分(auto-beta-router / auto-router / context-compression / file-parser / fusion / moderation / pareto-router / response-healing / web / web-fetch),此处展开其中一种的形状
allowed_modelsarray可选List of model patterns to filter which models the auto-beta-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. When not specified, every model ranked for the classified task type is a candidate, falling back to a default model set when rankings are unavailable.
cost_quality_tradeoffinteger可选Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-beta-router ranks models for the classified task type by community spend share, then filters candidates by their average cost per generation for that task. Higher values favor cheaper models: 10 keeps only models around the cheapest 10th percentile, while 0 permits models up to the 90th percentile for cost. Defaults to 9 when no cost setting is provided. It remains supported and retains ceiling behavior, but cost_tier takes precedence when both are provided.
cost_tierstring可选Named cost/quality setting. For auto-beta-router, tiers select cost-percentile bands: low = [0, 20), medium = [20, 40), high = [40, 60), xhigh = [60, 80), and max = [80, 100]. Takes precedence over the deprecated numeric cost_quality_tradeoff when both are provided.
enabledboolean可选Set to false to disable Fusion configuration for a run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. Defaults to true.
excluded_modelsarray可选List of model patterns to exclude from auto-beta-router selection. Supports wildcards (e.g., "meta-llama/*" excludes all Llama models). Up to 1024 patterns, each at most 1024 characters, with 65536 total characters across all patterns. Applied after allowed_models, so an excluded pattern always wins over an allowed one.
idstring可选Plugin id; always fusion.
pin_modelboolean可选When true, reuses the model from the most recent assistant message's `model` attribute for subsequent turns. Defaults to false.
enginestring可选The compression engine to use. Defaults to "middle-out".
exclude_domainsarray可选A list of domains to exclude from web search results. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
include_domainsarray可选A list of domains to restrict web search results to. Supports wildcards (e.g. "*.substack.com") and path filtering (e.g. "openai.com/blog").
max_resultsinteger可选Maximum number of search results to use.
max_usesinteger可选Maximum number of web fetches per request. Once exceeded, the tool returns an error.
modestring可选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.
search_promptstring可选Prompt that introduces the search results to the model.
user_locationobject可选Approximate user location for location-biased search results.
allowed_domainsarray可选Only fetch from these domains.
blocked_domainsarray可选Never fetch from these domains.
max_content_tokensinteger可选Maximum content length in approximate tokens. Content exceeding this limit is truncated.
pdfobject可选Options for PDF parsing.
max_pricenumber可选Maximum input price in USD per million tokens. When set, quality-tier selection (min_coding_score) is bypassed: the router computes the Pareto frontier over the top coding models and routes to the best-scoring frontier model priced at or below this cap, falling back through cheaper frontier models, then non-frontier models. Enforced against the price source given by price_source. Returns 404 when no candidate satisfies the cap.
min_coding_scorenumber可选Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). Not used when max_price is set (price-based selection takes over).
price_sourcestring可选Price source for the Pareto frontier cost axis and for enforcing max_price. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
analysis_modelsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, slugs of models to run in parallel as the "expert panel" the analyst analyzes. Each model receives the same user prompt with web_search + web_fetch enabled. Capped at 8 models to bound cost amplification. When omitted, defaults to the Quality preset from the /labs/fusion UI (~anthropic/claude-opus-latest, ~openai/gpt-sol-latest, ~google/gemini-pro-latest).
max_tool_callsinteger可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the maximum number of tool-calling steps each panelist (analysis model) and the analyst model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 4. Capped at 16.
modelstring可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, the slug of the model that performs both the analyst step (with web_search + web_fetch) and the final synthesis. When omitted, defaults to the first model in the Quality preset.
presetstring可选Configuration for a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool. A curated OpenRouter preset (slugs follow `<task>-<tier>`, e.g. `general-high`). Expands server-side into the preset's analysis_models panel and analyst model, so callers never name individual models. Explicitly provided `analysis_models` / `model` take precedence.
toolsarray可选For a Fusion run started by the `openrouter/fusion` model slug or `openrouter:fusion` server tool, server tools available to panelist and analyst inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only).
predictionobject可选Static predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
▸ 展开子字段(2)
contentstring | array必填Predicted output: a string or an array of text parts.
typestring必填Always `content`. Discriminator that marks this object as a Prediction in a `type`-tagged union.
presence_penaltynumber可选◐ 部分支持Presence penalty (-2.0 to 2.0)
deepseek-v4-flash 的 /openai 面观察到效果;qwen3.8-flash 部分请求返回 400,其余不可观测。
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.
providerobject可选◐ 部分支持When multiple model providers are available, optionally indicate your routing preference.
只有选择具体供应商(order / only / ignore)仅限 BYOK、返回 400;require_parameters 生效,其余选项接受但不生效。
▸ 展开子字段(13)
allow_fallbacksboolean可选○ 当前不生效Whether to allow backup providers to serve requests - true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider. - false: use only the primary/custom provider, and return the upstream error if it's unavailable.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
data_collectionstring可选○ 当前不生效Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
enforce_distillable_textboolean可选Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearray可选○ 未支持List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
max_priceobject可选○ 当前不生效The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
onlyarray可选○ 未支持List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
orderarray可选○ 未支持An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.
选择具体供应商(order / only / ignore)仅限 BYOK,平台凭证下返回 400 PROVIDER_SELECTION_NOT_ALLOWED。
preferred_max_latencynumber | object可选Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
preferred_min_throughputnumber | object可选Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
quantizationsarray可选○ 当前不生效A list of quantization levels to filter the provider by.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
require_parametersboolean可选Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.
只走能表达全部参数的线路;平台凭证下可用。
sortstring | object可选○ 当前不生效The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
zdrboolean可选○ 当前不生效Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
接受但当前不生效(不属于供应商选择,平台凭证下可用)。
reasoningobject可选Configuration options for reasoning models
▸ 展开子字段(2)
effortstring可选◐ 部分支持Constrains effort on reasoning for reasoning models
none 仅在 qwen3.8-flash 可靠关闭思考;deepseek-v4-flash 和 glm-5.3-flash 未遵守。
summarystring可选○ 当前不生效How detailed the reasoning summary should be.
接受但当前不生效。deepseek-v4-flash 未返回请求的摘要。
reasoning_effortstring可选◐ 部分支持Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
none 在 qwen3.8-flash 关闭思考;deepseek-v4-flash 仍思考,glm-5.3-flash 的档位效果不符合预期。
repetition_penaltynumber可选Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
routestring可选**DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
seedinteger可选○ 当前不生效Random seed for deterministic outputs
接受但当前不生效。deepseek-v4-flash、glm-5.3-flash、qwen3.8-flash 同 seed 不能复现输出。
service_tierstring可选The service tier to use for processing this request. `fast` is accepted as an alias for `priority`.
session_idstring可选A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
stop_server_tools_whenarray可选Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides `max_tool_calls`. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.
▸ 展开子字段(6)
元素按 type 区分(finish_reason_is / has_tool_call / max_cost / max_tokens_used / step_count_is),此处展开其中一种的形状
step_countinteger可选Number of steps after which the loop stops.
typestring可选Always `finish_reason_is`. Discriminator that marks this object as a StopServerToolsWhenFinishReasonIs in a `type`-tagged union.
tool_namestring可选Name of the tool whose call stops the loop.
max_tokensinteger可选Cumulative token count after which the loop stops.
max_cost_in_dollarsnumber可选Cumulative cost in USD after which the loop stops.
reasonstring可选Finish reason that stops the loop.
stream_optionsobject可选Streaming configuration options
▸ 展开子字段(1)
include_usageboolean可选○ 当前不生效Deprecated: This field has no effect. Full usage details are always included.
接受但当前不生效。无论 true、false 或省略,流末尾都会返回 usage。
top_anumber可选○ 当前不生效Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter.
接受但当前不生效。
top_kinteger可选◐ 部分支持Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
已测模型接受但未见采样效果;/model 的 deepseek-v4-flash 返回错误。
top_logprobsinteger可选◐ 部分支持Number of top log probabilities to return (0-20)
需与 logprobs=true 同传;支持度随 logprobs 和所选模型而异。
traceobject可选Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
▸ 展开子字段(5)
generation_namestring可选Name of this generation in the trace.
parent_span_idstring可选Id of the parent span in the trace.
span_namestring可选Name of this request's span in the trace.
trace_idstring可选Id that groups several requests into one trace.
trace_namestring可选Name of the trace.
userstring可选Per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.
storeboolean可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
max_output_tokensinteger可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
thinkingobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
web_search_optionsobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
functionsarray可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
audioobject可选○ 当前不生效接受但当前不生效。此结论仅适用于 Chat Completions。
ninteger可选◐ 部分支持glm-5.3-flash 生效;deepseek-v4-flash 接受但当前不生效;qwen3.8-flash 返回错误。
usageobject可选○ 当前不生效接受并忽略;用量默认始终返回,include 不改变行为。
transformsarray可选○ 当前不生效接受并忽略;不执行 middle-out 或其他消息变换,保留原消息。
deferred_toolsobject可选○ 当前不生效接受并忽略;尚未实现 OpenRouter 延迟工具协议。
promptstring可选○ 当前不生效接受并忽略;Chat 仍须提供 messages,本字段不替代消息。
structured_outputsboolean可选○ 当前不生效接受并忽略此开关;结构化输出使用 response_format,支持度见该字段。
include_reasoningboolean可选○ 当前不生效接受并忽略此旧别名;思考配置使用 reasoning,支持度见该字段。
safe_promptboolean可选○ 当前不生效接受并忽略;未实现 Mistral 的 safe_prompt 开关。
raw_modeboolean可选○ 当前不生效接受并忽略;未实现 Hyperbolic 的 raw_mode 开关。
返回
200 chat.completion
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
错误按 OpenAI 格式返回,参见 错误码
响应
HTTP 200
Successful chat completion response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| choices | array<object> | List of completion choices |
| choices[].finish_reason | string | null | |
| choices[].index | integer | Choice index |
| choices[].logprobs | object | null | Log probabilities for the completion |
| choices[].message | object | Assistant message for requests and responses |
| created | integer | Unix timestamp of creation |
| id | string | Unique completion identifier |
| model | string | Model used for completion |
| object | string | |
| 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. |
| service_tier | string | null | The service tier used by the upstream provider for this request |
| system_fingerprint | string | null | System fingerprint |
| usage | object | Token usage statistics |
| usage.completion_tokens | integer | Number of tokens in the completion |
| usage.completion_tokens_details | object | null | Detailed completion token usage |
| usage.cost | number | null | Cost of the completion |
| usage.cost_details | object | null | Breakdown of upstream inference costs |
| usage.is_byok | boolean | Whether a request was made using a Bring Your Own Key configuration |
| usage.prompt_tokens | integer | Number of tokens in the prompt |
| usage.prompt_tokens_details | object | null | Detailed prompt token usage |
| usage.server_tool_use_details | object | null | Usage for server-side tool execution (e.g., web search) |
| usage.total_tokens | integer | Total number of tokens |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| data | object | Streaming chat completion chunk |
| data.choices | array<object> | List of streaming chunk choices |
| data.created | integer | Unix timestamp of creation |
| data.error | object | Error information |
| data.id | string | Unique chunk identifier |
| data.model | string | Model used for completion |
| data.object | string | |
| data.openrouter_metadata | object | Routing report: what was requested, how the router chose, and what was attempted. |
| data.service_tier | string | null | The service tier used by the upstream provider for this request |
| data.system_fingerprint | string | System fingerprint |
| data.usage | object | Token usage statistics |