Skip to main content
Most models are served by more than one provider. Each provider has its own price, context window, speed, and uptime. The provider object controls which providers may serve a request and how they are ordered. It works on Chat Completions, Messages, and Responses, and with model: "auto". The response header X-ElectronHub-Provider names the provider that served the request.

Default order

Without a provider object, providers are ranked per request:
  1. Providers that cannot take the request are skipped: no image support when you send images, a context window smaller than the input plus max_tokens, or temporarily unavailable after repeated errors.
  2. The cheapest provider for the request goes first.
  3. A provider that is more than twice as slow as the fastest one (time to first token or tokens per second) has its price scaled up, so a slightly cheaper but much slower provider does not win.
  4. Providers with uptime below 90% go after healthy ones.
  5. Requests with tools prefer providers with stronger tool-calling support.
If the chosen provider fails before sending any output (rate limit, server error, connection failure, or an empty answer), the request moves to the next provider in this order. See Model Fallbacks for the full list.

The provider object

Unknown fields and invalid values return 400 with param naming the field. Provider ids come from GET /v1/models/{model}/providers.

Sorting

throughput and latency use the median (p50) over the last 30 minutes, or over the last day when the last 30 minutes has fewer than 20 measured requests. Providers without 20 measured requests in either window follow in the default order. order takes precedence over sort. The :nitro and :floor model variants are shortcuts for sort: "throughput" and sort: "price". When both a suffix and provider.sort are set, provider.sort wins.

Allow and block providers

only and ignore filter before sorting. If no provider is left, the request fails with 400, code no_allowed_provider, so a typo never routes silently to a provider you excluded. An id that no model uses returns 400, code unknown_provider. With model: "auto", models without an allowed provider are left out of the choice instead. If none remain, the request fails with 404 router_no_candidates.
allow_fallbacks: false also skips the temporary-unavailability check, so the first-ranked provider is tried even after recent errors. Use it when the provider matters more than availability.

Maximum price

max_price removes providers whose price per million input (prompt) or output (completion) tokens is above the ceiling. Providers that do not price per token are removed whenever max_price is set. If none remain, the request fails with 400 and param: "provider".

Performance preferences

preferred_min_throughput and preferred_max_latency are soft. Providers that meet them go first; the rest stay available as fallbacks. A number applies to the median (p50). An object sets cutoffs per percentile; every given cutoff must hold:
Keys are p50, p75, p90, and p99. Latency is in seconds, throughput in tokens per second. A provider without enough measurements counts as not meeting the preference.

Pin one provider

Prefix the model id with a provider id to send the request to that provider only:
A pin behaves like only: ["<provider-id>"] with allow_fallbacks: false, and the body cannot loosen it. Suffixes still apply after the pin, for example <provider-id>/kimi-k2.6:high.

Account defaults

Store provider lists for every request on your account with a master API key:
GET /v1/users/settings/routing returns the stored lists (Get, Update). How they combine with a request:

Find provider ids

GET /v1/models/{model}/providers lists a model’s providers with live performance. No authentication. Responses are cached for 2 minutes. Try it.

Errors