9 minutes

Control provider routing in requests

Configure the provider object on an API request to sort by price, throughput, or latency, restrict allowed providers, or require zero data retention.

By default, OpenRouter compares what a good response costs at each provider (effective price, speed, failures, and rate limits) and spreads traffic across the providers closest to the best (see How OpenRouter routes a request). When a specific request in your application needs custom routing, pass a provider object in the JSON body.

sort, order, :nitro, :floor, or your own provider key replace that default with your rule. only and ignore narrow the list it picks from.

To favor a specific metric, set provider.sort:

  • price: cheapest first.
  • throughput: highest tokens per second first.
  • latency: lowest time to first token first.
JSON
{
  "model": "google/gemini-3.8-flash",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ],
  "provider": {
    "sort": "throughput"
  }
}

There are shortcuts you can add to a model slug: :nitro sorts by throughput and :floor sorts by price.

To control which providers can serve a request, use provider.order to try specific providers first, provider.only to allow only some, and provider.ignore to skip some. allow_fallbacks: false stops OpenRouter from going outside your list, and zdr: true limits routing to zero data retention endpoints.

Check your understanding

You set provider.order to a single provider and allow_fallbacks to false. That provider has an outage, and your account has no private endpoint for the model. What happens?

You can also save these provider rules inside a workspace preset (or as a workspace-wide default on the Routing page) so callers don’t have to repeat the provider object on every request.

Apply it

A finance endpoint in your app handles sensitive account records and must only run on providers with zero data retention, and only on two approved vendors. What provider object do you send?

Takeaway

Use provider.sort (or :nitro and :floor) to prioritize throughput, latency, or price, and use order, only, ignore, allow_fallbacks, and zdr in the request body when an endpoint needs strict provider controls.