对话
/model/v1/chat/completions● 支持请求参数
X-OpenRouter-Metadatastring可选○ 当前不生效header: OpenRouter-style request header that asks for routing metadata in the response. It is accepted for compatibility and has no effect: the routing metadata is not returned.
接受但当前不生效;不会返回请求的路由元数据。
modelstring必填Model to use for completion
主模型;提供非空 models 时可省略,使用列表首项。
messagesarray必填◐ 部分支持List of messages for the conversation
文本、角色、历史和工具往返生效;图片受模型尺寸限制;file_id 原生接受 user_data 图片、文本和 PDF,并通过默认启用的 file-parser 转换支持 DOCX、PPTX 和 XLSX。Office 文件转换为文本,XLSX 每个 sheet 一张表、每个 sheet 最多 1,000 行,单文件最多 10 MiB;模型读取能力与失败处理见文件引用指南,转换设置与限额见插件指南。
展开子字段 (12)
元素按 role 区分(assistant / developer / system / tool / user),此处展开其中一种的形状
configuration_updateobject可选OpenRouter extension. Changes reasoning effort from this point in the conversation onward without invalidating the prompt cache for the preceding turns. Place it on a content-less system message (
content: "") directly before the user message it should apply to, and keep it at that position in later requests. Equivalent to the OpenAI Responsesconfiguration_updateinput item and the Anthropic Messages per-messageoutput_config.effort. OpenRouter extension. Same as the system messageconfiguration_update: changes reasoning effort from this point in the conversation onward without invalidating the prompt cache for the preceding turns. Not used when type is the other variants.contentstring | array可选System message content User message content Developer message content Assistant message content Tool response content Required when type is one of the variants above.
namestring可选Optional name for the system message Optional name for the user Optional name for the developer message Optional name for the assistant Not used when type is the other variants.
rolestring必填Role of the message author; always system. Role of the message author; always user. Role of the message author; always developer. Role of the message author; always assistant. Role of the message author; always tool.
audioobject可选Audio output data or reference Not used when type is the other variants.
imagesarray可选Generated images from image generation models Not used when type is the other variants.
modelstring必填Model that generated this assistant message Not used when type is the other variants.
reasoningstring可选Reasoning output Not used when type is the other variants.
reasoning_detailsarray可选Reasoning details for extended thinking models Not used when type is the other variants.
refusalstring可选Refusal message if content was refused Not used when type is the other variants.
tool_callsarray可选Tool calls made by the assistant Not used when type is the other variants.
tool_call_idstring可选ID of the assistant message tool call this message responds to Required when type is one of the variants above. Not used when type is the other variants.
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 同传时本字段优先。
streamboolean可选◐ 部分支持Enable streaming response
流式正文和工具增量生效;gemini-2.5-flash 可能缺少结束标记,预算耗尽时 finish_reason 可能不准确。
temperaturenumber可选◐ 部分支持Sampling temperature (0-2)
在 /openai 的 deepseek-v4-flash 观察到效果;其余模型的采样差异无法确认。
top_pnumber可选◐ 部分支持Nucleus sampling parameter (0-1)
仅 /model 的 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. Required when type is function. Not used when type is the other variants.
typestring必填Always
function. Discriminator that marks this object as a ChatNamedToolChoice in atype-tagged union. OpenRouter server-tool type to force (e.g.openrouter:web_search,web_search,web_search_preview).
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
text. Discriminator that marks this object as a ChatFormatTextConfig in atype-tagged union. Alwaysjson_object. Discriminator that marks this object as a ChatFormatJsonObjectConfig in atype-tagged union. Alwaysjson_schema. Discriminator that marks this object as a ChatFormatJsonSchemaConfig in atype-tagged union. Alwaysgrammar. Discriminator that marks this object as a ChatFormatGrammarConfig in atype-tagged union. Alwayspython. Discriminator that marks this object as a ChatFormatPythonConfig in atype-tagged union.json_schemaobject可选JSON Schema configuration object Required when type is json_schema. Not used when type is text, json_object, grammar, python.
grammarstring可选Custom grammar for text generation Required when type is grammar. Not used when type is text, json_object, json_schema, python.
更多参数 (49)
promptstring可选○ 当前不生效接受并忽略;Chat 仍须提供 messages,本字段不替代消息。
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 atype-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-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. 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. Not used when type is the other variants.
cost_quality_tradeoffinteger可选Deprecated: Use cost_tier instead. Balances routing between cost and quality on a 0-10 scale. The auto-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. 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. Not used when type is the other variants.
cost_tierstring可选Named cost/quality setting. 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. 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. Not used when type is the other variants.
enabledboolean可选Set to false to disable the auto-router plugin for this request. Defaults to true. Set to false to disable the auto-beta-router plugin for this request. Defaults to true. Set to false to disable the web-search plugin for this request. Defaults to true. Set to false to disable the file-parser plugin for this request. Defaults to true. Set to false to disable the response-healing plugin for this request. Defaults to true. Set to false to disable the context-compression plugin for this request. Defaults to true. Set to false to disable the pareto-router plugin for this request. Defaults to true. Set to false to disable Fusion configuration for a run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver tool. Defaults to true. Not used when type is the other variants.excluded_modelsarray可选List of model patterns to exclude from auto-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. 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. Not used when type is the other variants.
idstring必填Plugin id; always auto-router. Plugin id; always auto-beta-router. Plugin id; always moderation. Plugin id; always web. Plugin id; always web-fetch. Plugin id; always file-parser. Plugin id; always response-healing. Plugin id; always context-compression. Plugin id; always pareto-router. Plugin id; always fusion.
pin_modelboolean可选When true, reuses the model from the most recent assistant message's
modelattribute for subsequent turns. Defaults to false. Not used when type is the other variants.enginestring可选The search engine to use for web search. The compression engine to use. Defaults to "middle-out". Not used when type is the other variants.
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"). Not used when type is the other variants.
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"). Not used when type is the other variants.
max_resultsinteger可选Maximum number of search results to use. Not used when type is the other variants.
max_usesinteger可选Maximum number of times the model can invoke web search in a single turn. Passed through to native providers that support it (e.g. Anthropic). Maximum number of web fetches per request. Once exceeded, the tool returns an error. Not used when type is the other variants.
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. Not used when type is the other variants.
search_promptstring可选Prompt that introduces the search results to the model. Not used when type is the other variants.
user_locationobject可选Approximate user location for location-biased search results. Not used when type is the other variants.
allowed_domainsarray可选Only fetch from these domains. Not used when type is the other variants.
blocked_domainsarray可选Never fetch from these domains. Not used when type is the other variants.
max_content_tokensinteger可选Maximum content length in approximate tokens. Content exceeding this limit is truncated. Not used when type is the other variants.
pdfobject可选Options for PDF parsing. Not used when type is the other variants.
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. Not used when type is the other variants.
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). Not used when type is the other variants.
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". Not used when type is the other variants.
analysis_modelsarray可选For a Fusion run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver 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). Not used when type is the other variants.max_tool_callsinteger可选For a Fusion run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver 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. Not used when type is the other variants.modelstring必填For a Fusion run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver 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. Not used when type is the other variants.presetstring可选Configuration for a Fusion run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver 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 providedanalysis_models/modeltake precedence. Not used when type is the other variants.toolsarray可选For a Fusion run started by the
openrouter/fusionmodel slug oropenrouter:fusionserver 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). Not used when type is the other variants.
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 atype-tagged union.
presence_penaltynumber可选◐ 部分支持Presence penalty (-2.0 to 2.0)
deepseek-v4-flash 的 /openai 面观察到效果;qwen3.8-flash 部分请求返回 400,其余不可观测。
prompt_cache_keystring可选Caller-chosen key that groups requests with a long shared prefix so that they can reuse the provider's prompt cache; null for none.
prompt_cache_optionsobject可选Request-level prompt-cache controls.
mode: "explicit"disables OpenAI-managed breakpoints so only blocks marked withprompt_cache_breakpointare cached. Only supported by OpenAI GPT-5.6 and newer.展开子字段 (2)
modestring必填Explicit request-level cache mode: use only caller-marked cache breakpoints on models supporting this option.
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.
fastis accepted as an alias forpriority.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.
stopstring | array可选◐ 部分支持Stop sequences (up to 4)
qwen3.8-flash 生效;deepseek-v4-flash、glm-5.3-flash 可能截断思考并返回空正文。
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. Required when type is step_count_is. Not used when type is has_tool_call, max_tokens_used, max_cost, finish_reason_is.
typestring必填Always
step_count_is. Discriminator that marks this object as a StopServerToolsWhenStepCountIs in atype-tagged union. Alwayshas_tool_call. Discriminator that marks this object as a StopServerToolsWhenHasToolCall in atype-tagged union. Alwaysmax_tokens_used. Discriminator that marks this object as a StopServerToolsWhenMaxTokensUsed in atype-tagged union. Alwaysmax_cost. Discriminator that marks this object as a StopServerToolsWhenMaxCost in atype-tagged union. Alwaysfinish_reason_is. Discriminator that marks this object as a StopServerToolsWhenFinishReasonIs in atype-tagged union.tool_namestring可选Name of the tool whose call stops the loop. Required when type is has_tool_call. Not used when type is step_count_is, max_tokens_used, max_cost, finish_reason_is.
max_tokensinteger可选Cumulative token count after which the loop stops. Required when type is max_tokens_used. Not used when type is step_count_is, has_tool_call, max_cost, finish_reason_is.
max_cost_in_dollarsnumber可选Cumulative cost in USD after which the loop stops. Required when type is max_cost. Not used when type is step_count_is, has_tool_call, max_tokens_used, finish_reason_is.
reasonstring可选Finish reason that stops the loop. Required when type is finish_reason_is. Not used when type is step_count_is, has_tool_call, max_tokens_used, max_cost.
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 延迟工具协议。
structured_outputsboolean可选○ 当前不生效接受并忽略此开关;结构化输出使用 response_format,支持度见该字段。
include_reasoningboolean可选○ 当前不生效接受并忽略此旧别名;思考配置使用 reasoning,支持度见该字段。
safe_promptboolean可选○ 当前不生效接受并忽略;未实现 Mistral 的 safe_prompt 开关。
raw_modeboolean可选○ 当前不生效接受并忽略;未实现 Hyperbolic 的 raw_mode 开关。
providerOptionsobject可选◐ 部分支持providerOptions.praxis.models 与顶层 models 使用同一有序回退。order/only 仅允许与已有的请求级 BYOK 凭证同时使用;非 BYOK 返回 400。
展开子字段 (1)
praxisobject必填Platform options: ordered model fallback, request-level BYOK credentials and credential-gated provider selection.
返回
200 chat.completion
stream=true 时以 SSE 增量返回(text/event-stream)。
未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
鉴权、限流、参数校验等平台错误按 problem+json 返回;OCR 的错误也为 problem+json,其它模型调用的错误按该端点所属格式(OpenAI 或 Anthropic)返回,参见 错误码
请求示例
curl
curl https://api.deepraxis.com/model/v1/chat/completions \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"你好"}]}'Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.deepraxis.com/model/v1",
api_key="$PRAXIS_API_KEY",
)
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "你好"}],
)TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.deepraxis.com/model/v1",
apiKey: "$PRAXIS_API_KEY",
});
const resp = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "你好" }],
});响应示例 200
{
"id": "chatcmpl-09f8770f-f299-4934-973c-32527413dabe",
"object": "chat.completion",
"created": 1791894254,
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!有什么可以帮你的吗?😊",
"refusal": null,
"annotations": null,
"audio": null,
"function_call": null,
"reasoning": "We need answer in Chinese probably. User says \"你好\" (hello). Need respond friendly. Could introduce. Need maybe say \"你好!有什么可以帮你的吗?\" Keep simple.",
"reasoning_details": [
{
"type": "reasoning.text",
"text": "We need answer in Chinese probably. User says \"你好\" (hello). Need respond friendly. Could introduce. Need maybe say \"你好!有什么可以帮你的吗?\" Keep simple.",
"format": "unknown",
"id": null,
"index": 0
}
]
},
"logprobs": null,
"finish_reason": "stop"
}
],
"service_tier": null,
"system_fingerprint": "vllm-0.25.1-tp2-dp4-ep-11a74607",
"usage": {
"prompt_tokens": 84,
"total_tokens": 134,
"completion_tokens": 50,
"prompt_tokens_details": null,
"cost": 0.000031
},
"providerMetadata": {
"praxis": {
"generationId": "aeaefd6c-47af-4343-8250-3bb2520ca6c6",
"cost": 0.000031,
"credential": "platform",
"model": "deepseek-v4-flash"
}
}
}响应
HTTP 200
Chat completion (application/json) or streamed chunks (text/event-stream)
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Id of the completion. |
| object | string | Object type; always chat.completion. |
| created | number | Unix time in seconds at which the completion was created. |
| model | string | Model that produced the completion; with fallback this is the model that finally answered. |
| choices | array<object> | Completion choices; one entry per generated answer. |
| choices[].index | number | Zero-based index of the choice. |
| choices[].message | object | The message the model generated. |
| choices[].finish_reason | string | null | Why generation stopped, for example stop, length or tool_calls; null while a stream is still generating. |
| choices[].logprobs | any | null | Log probabilities of the output tokens, when requested; null otherwise. |
| usage | object | Token usage of the request. |
| usage.prompt_tokens | number | Number of tokens in the prompt. |
| usage.completion_tokens | number | Number of tokens in the completion. |
| usage.total_tokens | number | Prompt plus completion tokens. |
| usage.prompt_tokens_details | object | Breakdown of the prompt tokens. |
| usage.completion_tokens_details | object | Breakdown of the completion tokens. |
| usage.prompt_cache_hit_tokens | number | Prompt tokens served from the cache, as reported by providers that use this DeepSeek-style counter. |
| usage.prompt_cache_miss_tokens | number | Prompt tokens not served from the cache, as reported by providers that use this DeepSeek-style counter. |
| system_fingerprint | string | null | Backend fingerprint; always null on this face. |
| service_tier | string | null | Service tier the provider used; null when not reported. |
| providerMetadata | object | Platform metadata of the call. |
| providerMetadata.praxis | object | Platform metadata of the call: generation id, cost, credential kind and serving model. |
text/event-stream — chunk / 事件对象
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Optional id of the server-sent event. |
| event | string | Name of the server-sent event. |
| data | object | string | Payload of the server-sent event. |
| data.id | string | Id of the completion; every chunk of one stream carries the same id. |
| data.object | string | Object type; always chat.completion.chunk. |
| data.created | number | Unix time in seconds at which the completion was created. |
| data.model | string | Model that produced the completion; with fallback this is the model that finally answered. |
| data.choices | array<object> | Completion choices of the chunk. |
| data.providerMetadata | object | Platform metadata of the call. |