本文档尚未翻译成简体中文,现显示英文原文。

Request parameters

What we accept, what we ignore, what we reject

The body parameters of POST /chat/completions and POST /completions fall into three groups.

  1. Consumed by the gateway — we read them and do not forward them upstream. The routing parameters live here.
  2. Overwritten by us — whatever you send, our value wins.
  3. Passed through untouched — everything else, including sampling parameters and tool definitions.

Knowing which group a parameter is in is how you answer "why did this parameter have no effect?" for yourself.

1. Parameters the gateway consumes

modelstring

The model id to call, for example google/gemma-4-26b-a4b. Omit it and the service default model is used. An unknown id is 400 model_not_found.

modelsstring[]

A candidate chain. We try them in order and stop at the candidate that starts responding. A non-empty array takes precedence over model.

Unknown ids inside the array are dropped silently — the array means "whichever of these works". Only if every id is unknown do you get 400 model_not_found. A single model behaves differently: an unknown id is 400 immediately.

The full rules are in Model fallbacks.

providerobject

Provider selection rules, applied in this order.

FieldTypeEffect
orderstring[]Reorders the chain by provider slug. Candidates not named go to the back
onlystring[]Keeps only those slugs
ignorestring[]Removes those slugs
sort"price" | "throughput" | "latency"Sell price ascending / throughput descending / latency ascending
allow_fallbacksbooleanfalse truncates the chain to its first candidate
max_price{prompt?, completion?}A ceiling in USD per token. We multiply by the current FX rate and compare against our KRW sell price
require_parametersbooleantrue keeps only candidates that support every parameter present in your body
data_collection"allow" | "deny"Applied only to candidates whose metadata we know
zdrbooleanSame
quantizationsstring[]Filters candidates whose quantization is known

If filtering leaves no candidates, the result is 404 no_endpoints_found. Candidates whose metadata we do not know pass the filter — otherwise a missing metadata field would silently delete the whole local chain. See Provider routing.

routestring

We accept "fallback". openrouter deprecated the value, and it behaves exactly like the default, but we take it without raising 400 so existing code does not need editing.

transformsstring[]

Accepted and ignored. We do not implement message transforms. It does not error, so openrouter code keeps running; the fact that nothing happens is documented here.

pluginsobject[]

Accepted and ignored. We do not implement plugins such as PDF parsing.

promptstring | string[]

/completions only. A string array is joined with \n into a single messages:[{role:"user"}]. Sent to /chat/completions it is simply discarded.

2. Parameters we overwrite

messagesobject[]必填

Required on /chat/completions. Not an array, or an empty array, is 400 invalid_request. Every entry must carry a string role, or it is 400 as well. content is not validated — it goes upstream as given.

streamboolean

Defaults to false. Only true produces an SSE response, and it must be the boolean true — the string "true" is treated as non-streaming.

stream_optionsobject

Your value is discarded; on a streaming request we always set {"include_usage": true}. Without it the upstream sends no usage, and then there is nothing to attach the cost to on the final chunk (see Streaming).

3. Parameters passed straight through

Every field not in the two groups above is forwarded to the upstream untouched. There is no allowlist, so a parameter your model understands works even if we have never heard of it.

ParameterTypeConventional default
max_tokensintegermodel default
temperaturefloat, 0.0–2.01.0
top_pfloat, 0.0–1.01.0
top_kinteger, ≥ 00 (off)
frequency_penaltyfloat, −2.0–2.00.0
presence_penaltyfloat, −2.0–2.00.0
repetition_penaltyfloat, 0.0–2.01.0
seedintegernone
stopstring or string[]none
logit_bias{[token_id]: -100…100}none
response_formatobjectnone
tools, tool_choiceobject[] / string or objectnone

Checking what a model supports

Each model's supported_parameters is in the GET /models response, and it also works as a filter.

bash
curl "https://openrouter.myip.co.kr/api/v1/models?supported_parameters=tools"

Our local GPU models report:

Modelsupported_parameters
google/gemma-4-26b-a4bmax_tokens, temperature, top_p, top_k, stop, seed, frequency_penalty, presence_penalty, repetition_penalty, logit_bias, response_format, tools, tool_choice
lgai/exaone-4.0-32bThe same list without tools and tool_choice

Sending a parameter that is not on a model's list is not blocked by us; the upstream either ignores it or errors. To have it filtered for you, use provider.require_parameters: true.

A full example

bash
curl https://openrouter.myip.co.kr/api/v1/chat/completions \
  -H "Authorization: Bearer $MYIP_API_KEY" \
  -H "Content-Type: application/json" \
  -H "HTTP-Referer: https://myapp.example" \
  -H "X-Title: My App" \
  -d '{
    "models": ["google/gemma-4-26b-a4b", "lgai/exaone-4.0-32b"],
    "provider": { "sort": "price", "allow_fallbacks": true },
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Explain the TCP three-way handshake in three sentences."}
    ],
    "max_tokens": 300,
    "temperature": 0.3,
    "top_p": 0.9,
    "seed": 42,
    "stop": ["\n\nEND"]
  }'

Errors caused by parameters

Statuserror_typeWhen
400invalid_requestBody is not a JSON object; messages missing or empty; a message without role; /completions prompt that is neither a string nor a string array
400model_not_foundmodel is an unknown id, or every id in models[] is unknown
404no_endpoints_foundThe provider filter removed every candidate

The rest are in Errors and debugging.

最后更新于 2026年9月5日