A third mechanism, Routing Strategies, replaces both with a budget-driven policy: rules that change which model serves a request as spend accumulates. A scope with a strategy assigned ignores its reroute list, and its error handling moves to the strategy’s own fallback model.
When a provider request fails, Edgee automatically retries and falls back to the next available provider — transparently, without any changes to your code.
How it works
Every request goes through an ordered list of providers. Edgee tries each one in sequence, retrying transient failures before moving on. If all providers are exhausted without success, the error from the last attempt is returned to the caller.Provider ordering
Fallback order is determined automatically by each provider’s success rate, computed from recent request history. Providers with higher success rates are tried first. When multiple providers have the same score, they are shuffled randomly for load distribution. If you use BYOK keys, only your own provider keys are eligible — Edgee’s shared providers are not used as fallbacks. If no BYOK key is available for a model, shared providers are used instead.Retry behavior
Edgee distinguishes three categories of error:
The primary provider gets up to 2 attempts (1 initial + 1 retry). Fallback providers get 1 attempt each.
There is no backoff delay between attempts.
Streaming
For streaming responses, retries are only possible before any chunks have been sent to the client. Once the first chunk is delivered, the connection is committed and errors propagate directly — the request cannot be retried or rerouted mid-stream.Response headers
Every non-streaming response carries the provider that served it:Neither header is set on streaming responses: HTTP headers are sent before the provider
future executes, so the winning provider is not known yet. For streams, read the provider
from the usage record instead.
Reroute
Reroute substitutes the model before dispatch. Fallback is error-driven — it engages only when a provider fails. Reroute is unconditional: the requested model is replaced on every request, whether or not anything is wrong.Where to configure
Fallback and reroute are available only on paid AI Gateway seats. ☁️
Settings resolve org > squad > key: the highest scope that sets a value wins, and a scope left on Inherit falls through to the next level down. This is the same three-tier resolution used by Squads.
Self-hosted endpoints as targets
A reroute or fallback entry can point at your own OpenAI-compatible endpoint instead of a catalog model, using the form:<provider_key_id> is the ID of a registered custom endpoint provider key. Requests to a custom: entry are sent straight to that endpoint’s base URL as an OpenAI-compatible chat completion, bypassing the model catalog. Malformed entries are rejected when you save them rather than silently dropped at request time.
Observability
All failed attempts — retries and fallbacks — are recorded in the observability dashboard as separate events with zero token cost. This gives you full visibility into provider health and which fallback paths are being exercised. Log rows carry the routing decision that produced them:
These flags are available on the log rows in the console and in the log export.