429 and 5xx responses with exponential backoff.
Choose how providers are ranked
Set the workspace default in Dashboard -> Settings -> Routing, with
phaseo settings update --routing-mode <mode>, or with routing_mode on PATCH /v1/settings. For one request, send provider.sort or routing.mode, or add a suffix to the model ID:
A suffix overrides
routing.mode, provider.sort, and preset and workspace modes. Allow lists, regions, guardrails and price ceilings still apply.
The Routing settings page also has beta and alpha channel toggles, so preview providers only get traffic when you opt in.
How balanced mode ranks providers
For text requests (Chat Completions, Responses and Messages),balanced estimates each provider’s cost per successful answer:
- Tokens: what a typical request for this model costs on the provider, using the model’s measured prompt and output sizes and the provider’s measured cache-hit rate.
- Waiting: the time to first token and to the full response, converted to dollars at the model’s typical price per second.
- Failures: the total divided by the provider’s recent success rate, plus a penalty for provider errors and a smaller one for rate limits.
Request-level model fallbacks
List fallback models inmodels. Phaseo tries model first, then each entry in order:
429, 500, 502, 503 or 504. A 429 from a Phaseo budget or free-model quota also moves on, since another model may fit the remaining limit. So does a model that no provider serves any more, for example a retired one.
What doesn’t. Client errors such as 400, 401, 402, 403, 404, 408, 413 and 422 return immediately. So do failures before the first model runs, such as authentication or API key rate limits.
Rules for the list:
modelis required; sendingmodelsalone returns400.modelstakes 1 to 25 entries. Duplicates and copies ofmodelare ignored.- Entries can be model IDs, provider-qualified IDs or presets such as
@support. - Each attempt is validated as its own request (endpoint, parameters, workspace models, guardrails, presets, pricing, BYOK). A fallback that can’t serve the request is skipped and logged; it never replaces the error you’d otherwise get. An attempt identical to one already made is skipped too.
model field names the model that answered, and its routing trace lists the primary request ID, the fallback order and each earlier attempt.
Streaming, video and music. A stream falls back only before its first byte; after that, errors arrive in the stream. Video and music fall back only while the job is being submitted.
With other routing controls. Fallbacks on an attached dynamic route take precedence over models, and a fixed model chosen by the route still applies to each attempt. A preset applies its own constraints to each attempt it’s used in. phaseo/auto manages its own fallbacks and can’t be combined with models.
Multipart endpoints accept repeated
models fields, models[] fields, or one JSON array string. See also Rate limits and Errors.
Pin one provider
Put the provider in front of the model ID to use exactly that provider:baseten:google/gemma-4-26b-a4b:free. Provider-qualified model IDs covers the full syntax and errors.
Limit which providers are used
Attach routing rules to API keys
A dynamic route is a flow of rules attached to one or more inference API keys. It can:- branch on request-body fields, headers, custom
metadata, endpoint, model or session ID - split traffic by percentage for A/B tests and rollouts
- cap daily, weekly or monthly requests or cost per key
- switch model, routing mode, provider preference and fallback models (up to eight)
- turn on cache-aware and session-aware provider affinity
/v1/routing/dynamic-routes API with a management key.
Custom metadata goes in the request body on the OpenAI-compatible text endpoints:
Keep a conversation on one provider
Cache-aware routing is on by default for text generation. A request that sendsprompt_cache_key or session_id, or opts into caching with cache_control (top-level, in provider_options.anthropic, or as a cache_control or prompt_cache_breakpoint mark on a message block or tool), is pinned to the provider and route that served its first successful request. Other requests are pinned for 15 minutes once a provider reports a cache read or write for the same opening context, if that provider’s cached input is cheaper than its standard input.
Turn it off for one request with
provider.cache_aware_routing: false, or keep cache affinity but ignore the session with routing.session_affinity: false:
Explain a routing decision
Open Dashboard -> Settings -> Usage -> Request logs, select a request, and expand Routing observability under Provider Responses. It shows:- every ranked provider with its final score, and which were selected and attempted
- providers excluded before ranking, with the reason
- providers deranked by their rollout or routing status
- each score’s inputs, weights, contributions and multipliers
What counts against a provider’s uptime
Geographic restrictions and rate limits are tracked separately, because they don’t mean the provider is down. For production, log request IDs, status codes and model IDs so you can match failures to these traces.
Retired models
A retired model keeps working while any provider still serves it. After that, requests fail with410 model_retired, unless the workspace sends them to a replacement with retired model routing. Your own models list is always tried first. See Model Deprecation and Retirement.
BYOK considerations
With , Phaseo routes and logs the request while your provider bills the model usage.
Scope each key to the models and API keys that need it. To stop a failed BYOK request from retrying on Phaseo credits, turn off fallback in Dashboard -> Settings -> BYOK, or set
byok_fallback_enabled on PATCH /v1/settings with a management key. Add keys in the same place, or with POST /v1/byok and a management key.