API guides
Parameters
Every field of a chat completion request, with its type, range, default and effect on routing.
This page lists the common fields for POST /chat/completions. Unknown ordinary generation settings are forwarded to the upstream provider. Reserved routing, cache, privacy, connection, execution and billing controls remain validated.
Put all prompt text in messages. Native alternate input fields such as systemInstruction and cache-retention overrides such as prompt_cache_retention return 400. service_tier accepts only default; any other tier returns 400, because endpoints are priced at their standard tier.
How parameters are applied
Ordinary generation settings are forwarded by default. The upstream decides whether it supports their values. If an endpoint refuses a setting it doesn't declare, the request falls back to the next endpoint and the refusal isn't counted against the provider's health; if every endpoint refuses, the request returns 400.
| Group | Default behavior |
|---|---|
| Generation hints: sampling, client functions, structured output and reasoning | Forward to the upstream; provider.require_parameters: true opts into declared capability matching |
| Media, hosted tools, access, privacy, explicit cache controls and resource limits | Enforce the admitted capability and authorization boundaries |
| Routing and metadata | Handled by Numes |
A null sampling setting is treated as omitted. Message and text-part cache_control remains a hint unless strict matching is requested; endpoints without the capability receive the request without those markers. See Prompt caching.
Each endpoint's declared parameters are in supported_parameters from GET /models and GET /models/{author}/{slug}/endpoints. Both output-length spellings map to max_tokens there.
Model and messages
modelstringThe canonical model ID, such as
openai/gpt-6-luna. Required unless you sendmodels. There are no variant suffixes such as:freeor:nitro, and no~aliases.modelsstring[]An array with exactly one model ID, for OpenRouter clients. More than one entry, or sending both
modelandmodels, returns400.messagesMessage[]RequiredThe conversation, within the aggregate request limit.
Show child attributesHide child attributes
rolestringRequiredCommon values are
system,developer,user,assistantandtool. Unfamiliar roles are forwarded by matching compatible adapters.contentstring | ContentPart[] | nullText or structured provider content. Empty and unfamiliar shapes are accepted within aggregate request limits; native adapters may reject shapes they cannot translate.
tool_callsToolCall[]Historical calls, usually
{id, type: "function", function: {name, arguments}}. Identifiers and argument strings are replayed without local semantic validation.tool_call_idstringThe provider call identifier for a tool result.
namestringProvider message name; preserved on compatible requests.
reasoningstringReasoning from an earlier turn.
reasoning_contentis accepted as an alias. Preserve all continuation metadata.reasoning_detailsReasoningDetail[]Structured reasoning blocks from an earlier response, including signatures and encrypted state. Send them back unchanged in tool loops.
cache_controlobjectCache directive for the whole message. See Caching and sessions.
streambooleanDefaultfalseReturn Server-Sent Events instead of one JSON object. See Streaming.
storebooleanDefaultfalseOnly
falseis accepted, equivalent to omission. Stored completions aren't supported;true,nulland other types return400. This field isn't forwarded or matched against provider capabilities. It doesn't change metadata retention or provider data policies; useprovider.zdrandprovider.data_collectionfor provider privacy requirements.
Content parts
Content part types
textobject{type: "text", text}. Empty text is accepted. Optionalcache_controlorprompt_cache_breakpoint, not both.image_urlobject{type: "image_url", image_url: {url, detail?}}.urlis an HTTPS URL or adata:URL. Commondetailvalues areauto,lowandhigh; the upstream validates the hint. PNG, JPEG, GIF and WebP are accepted.fileobject{type: "file", file: {file_data, filename?}}.file_datais an HTTPS URL or a PDFdata:URL;filenameis forwarded as provider metadata.file_idisn't supported.input_audioobject{type: "input_audio", input_audio: {data, format}}.datais base64, not a URL.formatiswav,mp3,flac,m4a,ogg,webm,aac,aiff,pcm16orpcm24(PCM is read as 24 kHz).
Remote media must be a publicly reachable HTTPS URL. A URL that can't be fetched promptly, points to a non-public destination, is too large, or holds an unsupported type returns 400. Size and duration limits are in Limits; Multimodal inputs covers usage.
Sampling
frequency_penalty,
presence_penalty,repetition_penalty,min_p,top_anumber | null— Numeric sampling hints. Support and value ranges depend on the endpoint.temperaturenumber | nullSampling temperature; the upstream validates its range.
top_pnumber | nullNucleus sampling hint.
top_kinteger | nullCandidate sampling hint.
seedinteger | nullDeterministic sampling hint.
stopstring | string[] | nullStop sequences, subject to upstream limits.
All are samplers. When one is omitted, the endpoint's own default applies. Values are forwarded without local range checks.
Output length
max_completion_tokensinteger | nullMaximum output tokens, 1 to 131072. If you send both spellings, this one wins.
max_tokensinteger | nullLegacy spelling of the same limit.
ninteger | nullOne response choice is supported. Omit it, send
nullor send1. Other values return400before dispatch. This doesn't narrow routing or require a declared model feature.
Native output-limit spellings such as n_predict, num_predict, max_new_tokens, max_tokens_to_sample, maxOutputTokens and maxTokens return 400. Use max_completion_tokens or max_tokens so the limit Numes authorizes is the one the endpoint applies.
Omitted: no limit is sent, and the endpoint applies its own default within the model's maximum output.
Set: endpoints whose maximum output is smaller than your limit are excluded. The endpoint stops at the limit and reports
finish_reason: "length". The authorized limit is forwarded, subject to source dialect translation, and enforced by Numes.Funds: a smaller limit doesn't reduce the amount held before the request runs; see Credits and reservations.
A model's maximum output is in top_provider.max_completion_tokens from GET /models, and per endpoint in max_completion_tokens from the endpoints list.
Tools
toolsTool[]Function declarations are provider-owned data within the aggregate body limit. Hosted tools retain capability and execution checks.
Show child attributesHide child attributes
type: "function"objectA tool your code runs:
{type: "function", cache_control?, function: {name, description?, parameters, strict?}}. Names and schemas are validated by the upstream provider.strictasks the endpoint to follow the schema exactly.cache_controlis accepted for compatibility with clients that mark tools, but it isn't sent to the endpoint and never affects routing; see Prompt caching.type: <hosted tool>objectA tool the provider runs:
{type, configuration?, resource_aliases?}wheretypeisweb_search,web_fetch,datetime,image_generation,code_execution,file_search,shell,mcp,tool_search,skills,maps,url_context,advisor,apply_patch,fusionorsubagent.type: "hosted"objectA versioned hosted tool by ID:
{type: "hosted", id, configuration?, resource_aliases?}, for exampleopenrouter.web_search@1. See Hosted tools for the accepted IDs.configurationobjectHosted tools only. Up to 16 settings from the tool's allowed set, at most 32 KiB. Unknown settings return
400.resource_aliasesstring[]Hosted tools only. Up to 32 unique aliases, each at most 128 characters.
tool_choicestring | objectDefault"auto"none,auto,required, or{type: "function", function: {name}}naming a declared function.noneremoves the tools from the request. A named choice sends only that tool and fails a response without the call.requiredis passed to the endpoint but not guaranteed, and needs at least one tool.parallel_tool_callsbooleanWhen
false, a response with a second tool call fails. When omitted, multiple calls are allowed.max_tool_callsintegerDefault128Maximum tool calls in one response, 1 to 128.
With tool_choice: "none", tools aren't a routing requirement. See Tool calling and Hosted tools.
Structured output
response_formatobjectThe output format.
Show child attributesHide child attributes
type: "text"objectPlain text. Same as omitting the field.
type: "json_object"objectAny JSON object. The upstream decides whether it supports the format; strict matching requires declared
response_formatsupport.type: "json_schema"object{type: "json_schema", json_schema: {name, description?, schema, strict?}}. The upstream validates names, schemas and additional format attributes.provider.require_parameters: truerequires declaredstructured_outputssupport.
Schema adherence depends on the model and endpoint, so validate the parsed result. See Structured outputs.
Reasoning
reasoningobjectReasoning hints, forwarded by default.
Show child attributesHide child attributes
effortstringCommon values include
none,minimal,low,medium,high,xhighandmax. New values are forwarded.max_tokensintegerProvider reasoning token budget.
excludebooleanOmit reasoning from the response, both
reasoningandreasoning_details.enabledbooleanTurn reasoning on or off; the upstream resolves contradictory hints.
reasoning_effortstring | nullShorthand for
reasoning.effort; this alias takes precedence when supplied.include_reasoningbooleanInverse shorthand for
reasoning.exclude; this alias takes precedence when supplied.
With provider.require_parameters: true, the following declared capabilities are required:
| You send | Endpoint must support |
|---|---|
effort other than none | Reasoning at that effort level, or reasoning with unpublished effort levels (the effort is sent as a hint) |
effort: "none" or enabled: false | Turning reasoning off |
max_tokens | A reasoning token budget |
Any other reasoning control, including exclude alone | Reasoning |
A model's reasoning object in /models lists its supported_efforts, whether it supports_max_tokens, and whether reasoning is mandatory. See Reasoning.
Output modalities
modalitiesstring[]Default["text"]Unique values from
text,imageandaudio. Non-text values are features.audioobject{voice, format}, withformatwavormp3. Required whenmodalitiescontainsaudio, and not allowed otherwise. Audio output also requiresstream: trueandtextinmodalities.
Few chat endpoints offer image or audio output, so these requests often return 503. Use POST /images and POST /audio/speech for generated media.
Caching and sessions
session_idstringSticky-routing key, at most 256 characters. Requests with the same session and model prefer the endpoint that served the previous one. The
X-Session-Idheader does the same; the body value wins.prompt_cache_keystringCache-affinity key, at most 256 characters. Takes precedence over
session_idfor stickiness. The provider receives only an opaque hint with no content or account identifiers. Never limits routing: endpoints that don't accept it still serve the request without the hint.prompt_cache_optionsobject{mode?, ttl?}withmodeimplicitorexplicitandttl30m. At least one key. Feature.cache_controlobject{type: "ephemeral", ttl?}withttl5mor1h. Allowed at the top level, on a message, or on atextpart. Feature at the top level. On a message or text part it's a hint, and a feature only withprovider.require_parameters: true.prompt_cache_breakpointobjectOn a
textpart only:{mode: "explicit"}marks an explicit cache breakpoint. Feature.
These placements return 400:
Top-level
cache_controlcombined with message- or part-level directives.cache_controlon both a message and one of its parts.cache_controlandprompt_cache_breakpointon the same text part.
Stickiness applies only when you set neither provider.order nor provider.sort. A supported cache directive doesn't guarantee a cache hit. See Prompt caching and Sessions.
Routing
The provider object is closed like the rest of the request. Provider routing explains the default strategy with complete examples.
providerobjectRouting preferences for this request.
Show child attributesHide child attributes
orderstring[]Endpoints to try first, in order. Unlisted endpoints follow, unless
allow_fallbacksisfalse. Up to 100 entries.onlystring[]Allow only these providers or endpoints. Up to 100 entries.
ignorestring[]Never use these providers or endpoints. Up to 100 entries.
allow_fallbacksbooleanDefaulttrueWhen
true, a failed request can move to another endpoint, within a limited number of tries, before any output reaches you. Whenfalse, only one endpoint is tried.require_parametersbooleanDefaultfalseMake every sampler you send, a
"required"or namedtool_choice, and message- or part-levelcache_controla requirement. See How parameters are applied.data_collectionstringallowordeny.denyexcludes endpoints that declare they collect request data.zdrbooleantrueallows only endpoints that declare zero data retention.quantizationsstring[]Allow only endpoints that declare one of these weight formats, matched exactly. Endpoints declare
int4,int8,fp4,mxfp4,nvfp4,fp6,fp8,mxfp8,fp16,bf16orfp32; endpoints that declare none are excluded. Up to 100 entries.regionsstring[]Allow only endpoints that declare one of these country codes or region names, matched case-insensitively. Up to 64 unique values of 1 to 64 letters, digits,
.,_,:or-.sortstringprice(lowest estimated price first),throughput(fastest observed output first),latency(fastest observed time to first token first) orquality(highest measured quality first; see Quality sort).max_priceobject{prompt?, completion?}price ceilings as non-negative numbers, per token, in the key's currency.completionalso caps a separate reasoning rate, andprompta separate cache-write rate.
Selectors in order, only and ignore are a provider slug or a <provider>/<endpoint> tag from the tag field of the endpoints list, matched case-insensitively, each at most 256 characters. Setting order or sort replaces the default routing strategy and turns off sticky routing.
Accepted but ignored
These fields are accepted so existing clients keep working. They have no effect.
stream_optionsobject | null{include_usage}is accepted and ignored; usage is always returned. Other keys return400.usageobject{include}is accepted and ignored. Other keys return400.userstringEnd-user identifier, at most 256 characters with no control characters. Validated, then discarded.
Ordinary hints such as logit_bias, logprobs, top_logprobs, prediction and verbosity can be forwarded to compatible endpoints. The public response does not include token log probabilities.
Not supported
These OpenAI and OpenRouter fields return 400 invalid_request:
| Field | Notes |
|---|---|
n other than 1 or null | One choice per request. Send parallel requests for more. |
plugins | Plugins, including response caching, aren't available. |
web_search_options | Use a hosted web_search tool instead of web_search_options. |
Remove these fields in your client before sending. OpenRouter compatibility lists every difference.