Create chat completion
/openai/v1/chat/completions● SupportedRequest parameters
X-OpenRouter-Metadatastringoptional○ Currently ignoredheader: Opt-in to surface routing metadata on the response under
openrouter_metadata. Defaults todisabled. The legacy headerX-OpenRouter-Experimental-Metadatais also accepted for backward compatibility.Accepted but currently has no effect; the requested routing metadata is not returned.
messagesarrayrequired◐ Partially supportedList of messages for the conversation
Text, roles, history and tool round trips work. Images have model-specific size limits. file_id accepts user_data images, text and PDF; see the file reference guide for model support and failure handling.
Expand sub-fields (12)
元素按 role 区分(assistant / developer / system / tool / user),此处展开其中一种的形状
configuration_updateobjectoptionalOpenRouter 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 | arrayoptionalSystem message content User message content Developer message content Assistant message content Tool response content Required when type is one of the variants above.
namestringoptionalOptional 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.
rolestringrequiredRole 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.
audioobjectoptionalAudio output data or reference Not used when type is the other variants.
imagesarrayoptionalGenerated images from image generation models Not used when type is the other variants.
modelstringoptionalModel that generated this assistant message Not used when type is the other variants.
reasoningstringoptionalReasoning output Not used when type is the other variants.
reasoning_detailsarrayoptionalReasoning details for extended thinking models Not used when type is the other variants.
refusalstringoptionalRefusal message if content was refused Not used when type is the other variants.
tool_callsarrayoptionalTool calls made by the assistant Not used when type is the other variants.
tool_call_idstringoptionalID 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.
modelstringoptionalModel to use for completion
Primary model; optional when a nonempty models list supplies the first candidate.
streambooleanoptional◐ Partially supportedEnable streaming response
Content and tool deltas stream; gemini-2.5-flash may omit the end sentinel and budget exhaustion may report an incorrect finish_reason.
temperaturenumberoptional◐ Partially supportedSampling temperature (0-2)
An effect was observed on deepseek-v4-flash via /openai; sampling effects on other models remain unobservable.
max_tokensintegeroptional◐ Partially supportedMaximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
Works on deepseek-v4-flash and glm-5.3-flash; small budgets may not take effect on qwen3.8-flash. Takes precedence over max_completion_tokens.
top_pnumberoptional◐ Partially supportedNucleus sampling parameter (0-1)
An effect was observed only on glm-5.3-flash via /model; other tested models or faces accepted it without an observed effect.
stopstring | arrayoptional◐ Partially supportedStop sequences (up to 4)
Works on qwen3.8-flash; deepseek-v4-flash and glm-5.3-flash may stop during reasoning and return empty content.
toolsarrayoptionalAvailable tools for function calling
Verified to take effect.
tool_choicestring | objectoptional◐ Partially supportedTool choice configuration
auto works. deepseek-v4-flash ignores none/required/named functions; qwen3.8-flash rejects required/named functions in thinking mode; named selection on glm-5.3-flash is inconsistent.
Expand sub-fields (2)
functionobjectoptionalThe function the model must call. Required when type is function. Not used when type is the other variants.
typestringrequiredAlways
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).
More parameters (48)
response_formatobjectoptional◐ Partially supportedResponse format configuration
json_object works. json_schema works on deepseek-v4-flash and qwen3.8-flash but was not honored by glm-5.3-flash.
Expand sub-fields (3)
按 type 区分(grammar / json_object / json_schema / python / text),此处展开其中一种的形状
typestringrequiredAlways
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_schemaobjectoptionalJSON Schema configuration object Required when type is json_schema. Not used when type is text, json_object, grammar, python.
grammarstringoptionalCustom grammar for text generation Required when type is grammar. Not used when type is text, json_object, json_schema, python.
cache_controlobjectoptionalEnable 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.
Expand sub-fields (2)
ttlstringoptionalLifetime of an Anthropic-style cache breakpoint.
typestringrequiredAlways
ephemeral. Discriminator that marks this object as a AnthropicCacheControlDirective in atype-tagged union.
debugobjectoptionalDebug options for inspecting request transformations (streaming only)
Expand sub-fields (1)
echo_upstream_bodybooleanoptional○ Currently ignoredIf true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.
Accepted but currently has no effect. Streaming requests do not echo the upstream request body.
frequency_penaltynumberoptional◐ Partially supportedFrequency penalty (-2.0 to 2.0)
Some requests take effect on deepseek-v4-flash and glm-5.3-flash; qwen3.8-flash rejects some values or faces with 400.
image_configobjectoptionalProvider-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_biasobjectoptionalToken logit bias adjustments
logprobsbooleanoptional◐ Partially supportedReturn log probabilities
Works on qwen3.8-flash; deepseek-v4-flash works only via /openai and glm-5.3-flash differs between faces. gemini-2.5-flash returns 400.
max_completion_tokensintegeroptional◐ Partially supportedMaximum tokens in completion
Works on deepseek-v4-flash and glm-5.3-flash; small budgets on qwen3.8-flash may be ineffective or exceed limits.
metadataobjectoptionalKey-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
min_pnumberoptional○ Currently ignoredMinimum 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.
Accepted but currently has no effect.
modalitiesarrayoptionalOutput modalities for the response. Supported values are "text", "image", and "audio".
modelsarrayoptionalModels to use for completion
Ordered fallback on an unknown primary, unavailable same-protocol line or upstream failure. models alone is accepted; response model and cost belong to the model that completes the request.
parallel_tool_callsbooleanoptional◐ Partially supportedWhether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response.
false works on qwen3.8-flash, is ignored by deepseek-v4-flash, and differs between faces on glm-5.3-flash.
pluginsarrayoptional◐ Partially supportedPlugins you want to enable for this request, including their settings.
Supports file-parser (pdf.engine native, mistral-ocr mapped to ocr, ocr, auto) and platform guardrails. Requests override account defaults but preserve locked settings. Unsupported plugins such as web, unknown engines and malformed configurations return 400 naming the field.
Expand sub-fields (27)
元素按 id 区分(auto-beta-router / auto-router / context-compression / file-parser / fusion / moderation / pareto-router / response-healing / web / web-fetch),此处展开其中一种的形状
allowed_modelsarrayoptionalList 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_tradeoffintegeroptionalDeprecated: 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_tierstringoptionalNamed 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.
enabledbooleanoptionalSet 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_modelsarrayoptionalList 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.
idstringrequiredPlugin 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_modelbooleanoptionalWhen 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.enginestringoptionalThe 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_domainsarrayoptionalA 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_domainsarrayoptionalA 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_resultsintegeroptionalMaximum number of search results to use. Not used when type is the other variants.
max_usesintegeroptionalMaximum 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.
modestringoptionalEngine-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_promptstringoptionalPrompt that introduces the search results to the model. Not used when type is the other variants.
user_locationobjectoptionalApproximate user location for location-biased search results. Not used when type is the other variants.
allowed_domainsarrayoptionalOnly fetch from these domains. Not used when type is the other variants.
blocked_domainsarrayoptionalNever fetch from these domains. Not used when type is the other variants.
max_content_tokensintegeroptionalMaximum content length in approximate tokens. Content exceeding this limit is truncated. Not used when type is the other variants.
pdfobjectoptionalOptions for PDF parsing. Not used when type is the other variants.
max_pricenumberoptionalMaximum 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_scorenumberoptionalMinimum 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_sourcestringoptionalPrice 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_modelsarrayoptionalFor 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_callsintegeroptionalFor 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.modelstringoptionalFor 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.presetstringoptionalConfiguration 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.toolsarrayoptionalFor 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.
predictionobjectoptionalStatic predicted output content. Supported models can use this to reduce latency when much of the response is known in advance.
Expand sub-fields (2)
contentstring | arrayrequiredPredicted output: a string or an array of text parts.
typestringrequiredAlways
content. Discriminator that marks this object as a Prediction in atype-tagged union.
presence_penaltynumberoptional◐ Partially supportedPresence penalty (-2.0 to 2.0)
An effect was observed on deepseek-v4-flash via /openai; some qwen3.8-flash requests return 400 and other effects are unobservable.
prompt_cache_keystringoptionalprompt_cache_optionsobjectoptionalRequest-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.Expand sub-fields (2)
modestringrequiredExplicit request-level cache mode: use only caller-marked cache breakpoints on models supporting this option.
ttlstringoptionalLifetime of cache entries, for example 30m; null leaves the provider default.
providerobjectoptional◐ Partially supportedWhen multiple model providers are available, optionally indicate your routing preference.
Only supplier choice (order / only / ignore) is BYOK-only and returns 400; require_parameters is honoured and other options are accepted no-ops.
Expand sub-fields (13)
allow_fallbacksbooleanoptional○ Currently ignoredWhether 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.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
data_collectionstringoptional○ Currently ignoredData 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.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
-
enforce_distillable_textbooleanoptionalWhether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.
ignorearrayoptional○ UnsupportedList of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.
Choosing suppliers (order / only / ignore) is BYOK-only; with platform credentials it returns 400 PROVIDER_SELECTION_NOT_ALLOWED.
max_priceobjectoptional○ Currently ignoredThe object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
onlyarrayoptional○ UnsupportedList of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.
Choosing suppliers (order / only / ignore) is BYOK-only; with platform credentials it returns 400 PROVIDER_SELECTION_NOT_ALLOWED.
orderarrayoptional○ UnsupportedAn 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.
Choosing suppliers (order / only / ignore) is BYOK-only; with platform credentials it returns 400 PROVIDER_SELECTION_NOT_ALLOWED.
preferred_max_latencynumber | objectoptionalPreferred 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 | objectoptionalPreferred 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.
quantizationsarrayoptional○ Currently ignoredA list of quantization levels to filter the provider by.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
require_parametersbooleanoptionalWhether 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.
Routes only to lines that can express every parameter; available with platform credentials.
sortstring | objectoptional○ Currently ignoredThe sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
zdrbooleanoptional○ Currently ignoredWhether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.
Accepted but currently has no effect (not supplier choice; available with platform credentials).
reasoningobjectoptionalConfiguration options for reasoning models
Expand sub-fields (2)
effortstringoptional◐ Partially supportedConstrains effort on reasoning for reasoning models
none reliably disables thinking only on qwen3.8-flash; deepseek-v4-flash and glm-5.3-flash do not honor it.
summarystringoptional○ Currently ignoredHow detailed the reasoning summary should be.
Accepted but currently has no effect. deepseek-v4-flash did not return the requested summary.
reasoning_effortstringoptional◐ Partially supportedShorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
none disables thinking on qwen3.8-flash; deepseek-v4-flash still thinks and glm-5.3-flash effort levels do not behave as expected.
repetition_penaltynumberoptionalPenalizes 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.
routestringoptionalDEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
seedintegeroptional○ Currently ignoredRandom seed for deterministic outputs
Accepted but currently has no effect. The same seed did not reproduce outputs on deepseek-v4-flash, glm-5.3-flash or qwen3.8-flash.
service_tierstringoptionalThe service tier to use for processing this request.
fastis accepted as an alias forpriority.session_idstringoptionalA 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_whenarrayoptionalStop 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.Expand sub-fields (6)
元素按 type 区分(finish_reason_is / has_tool_call / max_cost / max_tokens_used / step_count_is),此处展开其中一种的形状
step_countintegeroptionalNumber 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.
typestringrequiredAlways
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_namestringoptionalName 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_tokensintegeroptionalCumulative 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_dollarsnumberoptionalCumulative 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.
reasonstringoptionalFinish 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_optionsobjectoptionalStreaming configuration options
Expand sub-fields (1)
include_usagebooleanoptional○ Currently ignoredDeprecated: This field has no effect. Full usage details are always included.
Accepted but currently has no effect. Usage is returned at the end whether true, false or omitted.
top_anumberoptional○ Currently ignoredConsider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter.
Accepted but currently has no effect.
top_kintegeroptional◐ Partially supportedLimits 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.
No sampling effect was observed on tested models; deepseek-v4-flash via /model returns an error.
top_logprobsintegeroptional◐ Partially supportedNumber of top log probabilities to return (0-20)
Requires logprobs=true; support follows logprobs and the selected model.
traceobjectoptionalMetadata 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.
Expand sub-fields (5)
generation_namestringoptionalName of this generation in the trace.
parent_span_idstringoptionalId of the parent span in the trace.
span_namestringoptionalName of this request's span in the trace.
trace_idstringoptionalId that groups several requests into one trace.
trace_namestringoptionalName of the trace.
userstringoptionalPer-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.
storebooleanoptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
max_output_tokensintegeroptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
thinkingobjectoptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
web_search_optionsobjectoptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
functionsarrayoptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
audioobjectoptional○ Currently ignoredAccepted but currently has no effect. This applies to Chat Completions only.
nintegeroptional◐ Partially supportedWorks on glm-5.3-flash; accepted but ignored on deepseek-v4-flash; qwen3.8-flash errors.
usageobjectoptional○ Currently ignoredAccepted and ignored; usage is always returned, regardless of include.
transformsarrayoptional○ Currently ignoredAccepted and ignored; no middle-out or other message transformation is performed.
deferred_toolsobjectoptional○ Currently ignoredAccepted and ignored; the OpenRouter deferred-tool protocol is not implemented.
promptstringoptional○ Currently ignoredAccepted and ignored; Chat still requires messages and this field does not replace them.
structured_outputsbooleanoptional○ Currently ignoredAccepted and ignored; configure structured output with response_format, subject to its documented support.
include_reasoningbooleanoptional○ Currently ignoredAccepted and ignored legacy alias; use reasoning subject to its documented support.
safe_promptbooleanoptional○ Currently ignoredAccepted and ignored; the Mistral safe_prompt switch is not implemented.
raw_modebooleanoptional○ Currently ignoredAccepted and ignored; the Hyperbolic raw_mode switch is not implemented.
Returns
200 chat.completion
With stream=true the reply streams as server-sent events (text/event-stream).
Unknown top-level fields are forwarded unchanged to same-protocol upstream providers, which decide whether to accept them. Declared fields still undergo type and range validation; invalid values return 400 naming the field.
Errors follow the OpenAI format — see error codes
Request
curl
curl https://api.deepraxis.com/openai/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/openai/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/openai/v1",
apiKey: "$PRAXIS_API_KEY",
});
const resp = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "你好" }],
});Response 200
{
"id": "4c613152-d60c-4e8f-9404-5633c6da9189",
"object": "chat.completion",
"created": 1790319252,
"model": "deepseek-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "你好!😊 很高兴见到你。\n\n有什么我可以帮你的吗?无论是问题、想法,还是只是想聊聊天,我都很乐意陪你一起。",
"reasoning": "The user just said \"你好\" (Hello in Chinese). I should respond in Chinese with a friendly greeting and offer to help.",
"reasoning_details": [
{
"type": "reasoning.text",
"text": "The user just said \"你好\" (Hello in Chinese). I should respond in Chinese with a friendly greeting and offer to help.",
"format": "unknown",
"id": null,
"index": 0
}
]
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 58,
"total_tokens": 89,
"prompt_tokens_details": {
"cached_tokens": 0
},
"completion_tokens_details": {
"reasoning_tokens": 26
},
"prompt_cache_hit_tokens": 0,
"prompt_cache_miss_tokens": 31
},
"system_fingerprint": "aeb56401ca74e127821c4f9126dcb669",
"service_tier": null
}Response
HTTP 200
Successful chat completion response
application/json
| Name | Type | Description |
|---|---|---|
| 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 / event object
| Name | Type | Description |
|---|---|---|
| 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 |