Provider preferences
Constrain where a request may run and how the gateway ranks the candidates.
Every model is served by one or more providers. The gateway picks one for each request. The
provider object narrows the candidates, changes how they are ranked, and can name the providers
you want or refuse. To see who serves a model and what each charges, call
GET /v1/models/{id}/endpoints (see Models and pricing).
curl https://api.opinference.com/v1/chat/completions \
-H "Authorization: Bearer $OP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-120b",
"messages": [{"role": "user", "content": "Say hi."}],
"routing": "cheap"
}'The same provider object is accepted on every media route. routing is chat only.
Fields
| Field | Values | Effect |
|---|---|---|
zdr | true | Only endpoints verified to retain no prompts or outputs. false asks for nothing. See the note below |
data_collection | allow, deny | deny excludes endpoints that may train on your inputs. allow asks for nothing. See the note below |
region | us, global | Only endpoints labelled with that region. global means endpoints labelled global, not "any region" |
sort | price, latency, throughput, stability | How candidates are ranked. The OpenRouter spelling of routing. See below |
order | provider ids | Try these providers first, in this order |
only | provider ids | Use only these providers |
ignore | provider ids | Never use these providers |
allow_fallbacks | false | Without order: the best-ranked endpoint only. With order: only the providers in order, tried in that order. true is the default and asks for nothing |
Any other value of data_collection, region or sort is refused with 400 invalid_request, so a typo
such as "EU" fails loudly instead of matching no endpoint.
No endpoint is verified as retaining nothing today, so "zdr": true fails with
404 no_endpoint_available for every model. "data_collection": "deny" leaves some text models
with no endpoint either. When a filter removes every endpoint, the error message names it, for
example excluded by: data_policy. Check a model with one request before you depend on either
filter.
Ranking
Set routing at the top level of a chat request to choose how candidates are ranked. It overrides
your key's default ranking for that one request.
routing | Same as provider.sort | Ranks first |
|---|---|---|
cheap | price | The cheapest healthy endpoint |
latency | latency | The fastest to first token. Degraded endpoints drop out |
stable | stability | The endpoint with the best recent success rate |
balanced | (none) | A blend of health, speed and price, weighted towards price |
Not set: your key's default ranking, or balanced if the key has none. provider.sort also
accepts throughput, the highest sustained output rate first.
You may send routing and provider.sort together only if they mean the same thing. An unknown
value of either, or two that disagree, is refused with 400 invalid_request.
Turning failover off
With "allow_fallbacks": false, the request goes to the best-ranked endpoint only. If that
endpoint fails, you get its error instead of an answer from another endpoint. If no endpoint
passes your filters, the request fails with 404 no_endpoint_available.
Preferences only tighten
Your account, workspace and key can each carry a policy, and the request's preferences apply on
top of them. The most restrictive setting wins. A request can add a constraint but never remove
one: asking for a region outside the ones your key allows, or a looser op.retention than your
key's, is refused with 400 policy_conflict.
Choosing the provider
A provider id is the provider field of a row on GET /v1/models/{id}/endpoints, such as
nebius or openrouter. The same id is on every streamed chunk and on each attempt in
op_metadata.attempts, so you can see who answered.
"provider": {"order": ["nebius", "novita"], "ignore": ["openrouter"]}orderputs its providers first, in the order given. The rest follow in the normal ranking, unlessallow_fallbacksisfalse, which keeps only the providers inorder.onlyandignorefilter, like the other preferences, and tighten your key's policy.- An id that is not a provider is refused with
400 invalid_requestnaming the field, so a typo fails loudly. An empty list is the same as leaving the field out. - If no provider is left, the request fails with
404 no_endpoint_available, and the message namesallow/deny.
Accepted but ignored
These fields are accepted and have no effect today:
max_pricequantizationsrequire_parameters, on chat completions. On a media job it turns a left-out setting into a400preferred_min_throughputpreferred_max_latencyenforce_distillable_textop.tags
max_price does not cap what a request costs. To limit spend, set a monthly cap on the key. See
Key restrictions and spend caps.
On a media job, each ignored field you sent is listed in op_metadata.policy as
option_ignored:<name>:
"op_metadata": {
"policy": ["option_ignored:max_price", "option_ignored:tags"]
}Chat completions do not report them.