Skip to content
Numes

API reference · Parameters

API guides

Parameters

Every field of a chat completion request, with its type, range, default and effect on routing.

On this page

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.

GroupDefault behavior
Generation hints: sampling, client functions, structured output and reasoningForward to the upstream; provider.require_parameters: true opts into declared capability matching
Media, hosted tools, access, privacy, explicit cache controls and resource limitsEnforce the admitted capability and authorization boundaries
Routing and metadataHandled 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

modelstring

The canonical model ID, such as openai/gpt-6-luna. Required unless you send models. There are no variant suffixes such as :free or :nitro, and no ~ aliases.

modelsstring[]

An array with exactly one model ID, for OpenRouter clients. More than one entry, or sending both model and models, returns 400.

messagesMessage[]Required

The conversation, within the aggregate request limit.

Show child attributes
rolestringRequired

Common values are system, developer, user, assistant and tool. Unfamiliar roles are forwarded by matching compatible adapters.

contentstring | ContentPart[] | null

Text 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_idstring

The provider call identifier for a tool result.

namestring

Provider message name; preserved on compatible requests.

reasoningstring

Reasoning from an earlier turn. reasoning_content is 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_controlobject

Cache directive for the whole message. See Caching and sessions.

streambooleanDefault false

Return Server-Sent Events instead of one JSON object. See Streaming.

storebooleanDefault false

Only false is accepted, equivalent to omission. Stored completions aren't supported; true, null and other types return 400. This field isn't forwarded or matched against provider capabilities. It doesn't change metadata retention or provider data policies; use provider.zdr and provider.data_collection for provider privacy requirements.

Content parts

Content part types

textobject

{type: "text", text}. Empty text is accepted. Optional cache_control or prompt_cache_breakpoint, not both.

image_urlobject

{type: "image_url", image_url: {url, detail?}}. url is an HTTPS URL or a data: URL. Common detail values are auto, low and high; the upstream validates the hint. PNG, JPEG, GIF and WebP are accepted.

fileobject

{type: "file", file: {file_data, filename?}}. file_data is an HTTPS URL or a PDF data: URL; filename is forwarded as provider metadata. file_id isn't supported.

input_audioobject

{type: "input_audio", input_audio: {data, format}}. data is base64, not a URL. format is wav, mp3, flac, m4a, ogg, webm, aac, aiff, pcm16 or pcm24 (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_a number | null — Numeric sampling hints. Support and value ranges depend on the endpoint.

temperaturenumber | null

Sampling temperature; the upstream validates its range.

top_pnumber | null

Nucleus sampling hint.

top_kinteger | null

Candidate sampling hint.

seedinteger | null

Deterministic sampling hint.

stopstring | string[] | null

Stop 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 | null

Maximum output tokens, 1 to 131072. If you send both spellings, this one wins.

max_tokensinteger | null

Legacy spelling of the same limit.

ninteger | null

One response choice is supported. Omit it, send null or send 1. Other values return 400 before 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 attributes
type: "function"object

A tool your code runs: {type: "function", cache_control?, function: {name, description?, parameters, strict?}}. Names and schemas are validated by the upstream provider. strict asks the endpoint to follow the schema exactly. cache_control is 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>object

A tool the provider runs: {type, configuration?, resource_aliases?} where type is web_search, web_fetch, datetime, image_generation, code_execution, file_search, shell, mcp, tool_search, skills, maps, url_context, advisor, apply_patch, fusion or subagent.

type: "hosted"object

A versioned hosted tool by ID: {type: "hosted", id, configuration?, resource_aliases?}, for example openrouter.web_search@1. See Hosted tools for the accepted IDs.

configurationobject

Hosted 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. none removes the tools from the request. A named choice sends only that tool and fails a response without the call. required is passed to the endpoint but not guaranteed, and needs at least one tool.

parallel_tool_callsboolean

When false, a response with a second tool call fails. When omitted, multiple calls are allowed.

max_tool_callsintegerDefault 128

Maximum 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_formatobject

The output format.

Show child attributes
type: "text"object

Plain text. Same as omitting the field.

type: "json_object"object

Any JSON object. The upstream decides whether it supports the format; strict matching requires declared response_format support.

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: true requires declared structured_outputs support.

Schema adherence depends on the model and endpoint, so validate the parsed result. See Structured outputs.

Reasoning

reasoningobject

Reasoning hints, forwarded by default.

Show child attributes
effortstring

Common values include none, minimal, low, medium, high, xhigh and max. New values are forwarded.

max_tokensinteger

Provider reasoning token budget.

excludeboolean

Omit reasoning from the response, both reasoning and reasoning_details.

enabledboolean

Turn reasoning on or off; the upstream resolves contradictory hints.

reasoning_effortstring | null

Shorthand for reasoning.effort; this alias takes precedence when supplied.

include_reasoningboolean

Inverse shorthand for reasoning.exclude; this alias takes precedence when supplied.

With provider.require_parameters: true, the following declared capabilities are required:

You sendEndpoint must support
effort other than noneReasoning at that effort level, or reasoning with unpublished effort levels (the effort is sent as a hint)
effort: "none" or enabled: falseTurning reasoning off
max_tokensA reasoning token budget
Any other reasoning control, including exclude aloneReasoning

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, image and audio. Non-text values are features.

audioobject

{voice, format}, with format wav or mp3. Required when modalities contains audio, and not allowed otherwise. Audio output also requires stream: true and text in modalities.

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_idstring

Sticky-routing key, at most 256 characters. Requests with the same session and model prefer the endpoint that served the previous one. The X-Session-Id header does the same; the body value wins.

prompt_cache_keystring

Cache-affinity key, at most 256 characters. Takes precedence over session_id for 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?} with mode implicit or explicit and ttl 30m. At least one key. Feature.

cache_controlobject

{type: "ephemeral", ttl?} with ttl 5m or 1h. Allowed at the top level, on a message, or on a text part. Feature at the top level. On a message or text part it's a hint, and a feature only with provider.require_parameters: true.

prompt_cache_breakpointobject

On a text part only: {mode: "explicit"} marks an explicit cache breakpoint. Feature.

These placements return 400:

  • Top-level cache_control combined with message- or part-level directives.

  • cache_control on both a message and one of its parts.

  • cache_control and prompt_cache_breakpoint on 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.

providerobject

Routing preferences for this request.

Show child attributes
orderstring[]

Endpoints to try first, in order. Unlisted endpoints follow, unless allow_fallbacks is false. 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_fallbacksbooleanDefault true

When true, a failed request can move to another endpoint, within a limited number of tries, before any output reaches you. When false, only one endpoint is tried.

require_parametersbooleanDefault false

Make every sampler you send, a "required" or named tool_choice, and message- or part-level cache_control a requirement. See How parameters are applied.

data_collectionstring

allow or deny. deny excludes endpoints that declare they collect request data.

zdrboolean

true allows 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, bf16 or fp32; 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 -.

sortstring

price (lowest estimated price first), throughput (fastest observed output first), latency (fastest observed time to first token first) or quality (highest measured quality first; see Quality sort).

max_priceobject

{prompt?, completion?} price ceilings as non-negative numbers, per token, in the key's currency. completion also caps a separate reasoning rate, and prompt a 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 return 400.

usageobject

{include} is accepted and ignored. Other keys return 400.

userstring

End-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:

FieldNotes
n other than 1 or nullOne choice per request. Send parallel requests for more.
pluginsPlugins, including response caching, aren't available.
web_search_optionsUse a hosted web_search tool instead of web_search_options.

Remove these fields in your client before sending. OpenRouter compatibility lists every difference.

Next steps