What happens when your AI provider goes down? Designing LLM failover
When your AI provider goes down, your feature goes down with it, unless someone planned a second route. LLM failover is that plan: what your application does when a call fails.
Most of the work is deciding what counts as a failure, how long to keep trying and where the request may go next.
Retry first, then fall back
Providers tell you how to retry. Anthropic's API errors page says to follow x-should-retry and retry-after and "use backoff and a retry limit". OpenAI's error codes page says to follow Retry-After when present, and otherwise to "use exponential backoff with jitter and limit the number of retries".
Some failures will not clear by waiting. OpenAI says "Retrying billing, spend, or quota errors won't restore API access." Anthropic says a spend-cap 429 "keeps failing until access resumes". Treat these as a different case from a busy service.
Fallback comes after retries. The LiteLLM gateway documents it this way: "If a call fails after num_retries, LiteLLM falls back to another model group", and "Fallbacks are done in-order". LiteLLM and Portkey are gateway products, so these pages describe their tools, not a standard.
Which errors should trigger a fallback
Portkey says "By default, fallback triggers on any non-2xx status code", and lets you list the status codes yourself. That choice matters. A request your own code got wrong will fail the same way on a second provider, so falling back only adds cost and delay. LiteLLM keeps a separate fallback list for content-policy errors, and gives context-window overflows their own error type, so they can be handled apart from an outage.
What a fallback can change
A fallback is a different model, run by a different company, often in a different place.
Output. Portkey says to "Ensure fallback LLMs are compatible with your use case". Test your prompts on the backup. A prompt tuned for one model can behave differently on another.
Speed and cost. Portkey notes "Each LLM has different latency and pricing", and that "A single request may invoke multiple LLMs". In a Portkey post, the author adds that if retries run one after another, "users may see longer latency".
Streaming. LiteLLM warns: "Do not assume a fallback can transparently restart a response after the client has consumed partial output."
Formats. The same post says "Every LLM API has slightly different error formats, rate-limit rules, and response structures."
Data location and terms. The backup provider processes your data under its own terms and in its own regions. A fallback can quietly send customer data somewhere your policy did not allow. We cover that gap in stored here, processed there.
A short plan
- List your AI features and say which can fall back and which must fail with a clear message.
- For each, name the backup and the places it may run.
- Set retry limits and the status codes that trigger a fallback.
- Test the backup with your real prompts.
- Keep a record of which provider answered each request. (See a receipt for AI work.)
- Run a drill, so the first use of the backup is not during an outage.
Related: Data center outage: what happens when one site goes down
Starfield take
Decide before the outage which requests may fall back, to what, and where. A backup you have not tested with your own prompts is a guess.
What we are building
We are building Starfield Fabric: standardized compute close to power, connectivity and demand, connected through one programmable network for AI inference. Workloads are designed to be placed by policy, on latency, data residency, model and load, and every workload can generate an auditable record of commitment, placement and delivery.
Related
Starfield Fabric · Data center outage: what happens when one site goes down · Stored here, processed there: the AI gap auditors find · A receipt for AI work