Try Bifrost Enterprise free for 14 days.
Request access
[ Failover ]

What is failover?

Quick answer

Failover is the transfer of work from a failed component to a healthy, equivalent replacement, usually automatically. For LLM applications, that means sending a request to another API key or provider when the primary errors or times out.

Updated 2026-09-05

Failover is the transfer of work from a component that has failed to one that is healthy. NIST defines it as switching over automatically, typically without human intervention. When teams start it by hand, AWS advises automating the steps anyway, so that starting it is like pushing a button. A runbook that has an engineer reconfigure providers mid-incident is manual recovery, and it is slow.

"The capability to switch over automatically (typically without human intervention or warning) to a redundant or standby system upon the failure or abnormal termination of the previously active system."

Source: NIST SP 800-53 Rev. 5, via the CSRC Glossary

For LLM systems, failover is unusually important because the dependency is external. You cannot fix a provider outage, add capacity to someone else's cluster, or roll back their deploy. The only available lever is sending the request somewhere else.

Failover, fallback, and failback

The three terms are easy to confuse, but they mean different things.

TermMeaningResult quality
FailoverSwitch to an equivalent healthy replacementSame as normal
FallbackSwitch to a degraded but acceptable alternativeReduced
FailbackReturn to the original component once it recoversSame as normal

Routing from one API key to another key for the same model is failover: the result is identical. Routing from a frontier model to a smaller, cheaper one is a fallback: the request succeeds, but quality may drop. Serving a canned "try again shortly" message is graceful degradation, which is a fallback of last resort.

Failover can be silent. A fallback should be recorded, because the user got something different from what the system normally produces.

Failover topologies

The AWS disaster recovery whitepaper describes these options for regional failover.

TopologyStandby stateRelative recovery timeCost
Active-passiveNot serving until failover; may be fully provisioned (hot), scaled down (warm), or mostly off (pilot light)Fast if the standby is runningStandby capacity sits unused
Active-activeServing traffic continuouslyNear zeroFully utilized
Pilot lightData and core infrastructure in place; app servers off until failoverSlowest: servers must start and scale firstLow

For LLM providers, consider active-active as the default. On pay-as-you-go plans it is cheaper than it sounds, because with per-token billing a second provider in rotation costs only the traffic you send it. It also fixes the biggest weakness of active-passive, since a standby that never serves traffic is a standby you cannot trust. There are two exceptions. Reserved capacity, such as Azure provisioned throughput, is billed hourly whether used or not. And because provider prompt caches are per provider and usually per key, a conversation that hops between them misses the cache it warmed a turn ago.

Diagram
[ RENDERING DIAGRAM ]

Failover triggers

Not every error deserves a retry elsewhere. Failing over on the wrong signal wastes money and can amplify an outage.

ResponseMeaningCorrect action
429 rate limitedToo many requests for this key or account in a time window; OpenAI also uses 429 for exhausted credit and spend limitsBack off on this key (honor Retry-After) and shift traffic to another key or backend
500 / 502 / 503 / 504 (Bifrost also treats 529 as transient)Backend is failingFail over
TimeoutUnknown, possibly still processingFail over, but beware duplicate work
400 bad requestUsually a malformed request, though some providers return 400 for a bad key, empty credit, or model problem (Bifrost docs cite Gemini and Anthropic examples)Don't resend the same request; fail over only if the error shows a key or account problem
401 / 403Key rejected or not permitted; OpenAI also returns 403 for an unsupported country or regionDon't resend on the same key; rotate to another key if one exists, and alert
Content filter refusalDeliberate provider policy decisionTreat as a valid answer, not an outage; don't resend to another provider

Azure OpenAI, for example, rejects a filtered prompt with HTTP 400 and code content_filter, so check the error code, not just the status.

Two mistakes to avoid are failing over on 400, which burns a second provider's quota on a request that cannot succeed, and treating a content policy refusal as an outage, which quietly routes sensitive traffic to whichever provider has the loosest filters.

Retries, backoff, and circuit breakers

Failover is one layer of a resilience stack, and the layers must cooperate.

Retries handle transient blips on the same backend. They need a bounded attempt count and exponential backoff with jitter, as detailed in the AWS Builders' Library article on timeouts, retries, and backoff with jitter. Without jitter, clients that back off to the same time collide again and recreate the overload.

Circuit breakers stop sending traffic to a backend that is consistently failing. Rather than paying the timeout cost on every request, the breaker opens and fails fast, then periodically probes for recovery. Martin Fowler's Circuit Breaker article and the Azure circuit breaker pattern both describe the closed, open, and half-open states.

Retry budgets cap retries as a share of total traffic, so retries can't turn a partial outage into a total one. Google's SRE book describes a per-client budget of about 10% in Handling Overload and a per-process cap in Addressing Cascading Failures.

Retries multiply across layers. Google's SRE book works through the math: if three layers each retry three times (four attempts each), one user action can produce 64 attempts against the backend. Retry logic belongs in exactly one layer.

Differences between LLM and standard failover

Standard failover assumes replicas are interchangeable. Model providers are not.

  • Different API shapes. Provider request and response formats differ, so failing over requires translation. That argues for doing it at a gateway that already normalizes to one schema.
  • Capability mismatch. The secondary may not support the same context length, tool-calling format, structured output mode, or modalities. A fallback that cannot honor the request's requirements will fail differently rather than succeed.
  • Cost differences. Failing over to a more expensive model during an outage can produce a surprising bill. Budgets should apply to fallback paths too.
  • Non-deterministic output. Even a successful failover yields different text than the primary would have. Anything caching or diffing responses must tolerate that.
  • Partial failure during streaming. If a provider dies mid-stream, tokens have already reached the user. Restarting on another provider means either discarding visible output or stitching a response from two models.

Testing failover

Failover logic runs rarely, and only after something has already gone wrong, so an untested path is likely to fail at the moment it is needed.

Practical verification:

  • Inject faults. Return errors from a provider on purpose and confirm traffic moves. Bifrost ships a mocker plugin that mocks provider responses for testing and simulation.
  • Exercise secondaries continuously. Route a small percentage of production traffic to them so they are never cold.
  • Measure how long failover takes end to end, including timeouts. A 60-second timeout before failover is a 60-second stall the user sees.
  • Verify capability parity. Test that fallback models handle your tool schemas and output formats, not just that they return a 200.

Failover at the gateway

Implementing failover per application means every service carries provider SDKs, health state, retry logic, and credentials, and each one learns about outages independently.

Centralizing failover at the AI gateway changes that. Health state is shared, so one service detecting a failure protects all of them immediately. The gateway already normalizes providers to a single API, so cross-provider failover needs no application changes. Retries live in one layer, which avoids the multiplication described above as long as client SDK retries are turned off. Every failover is logged in one place, so you can see how often you are silently serving a degraded model.

Bifrost implements ordered retries and fallbacks across providers and models. Enterprise scalability covers the circuit-breaker thresholds (above 2% errors marks a provider degraded, above 5% failed), and AWS Bedrock + Bifrost describes multi-region fallback chains such as Bedrock us-east-1 to us-west-2. Applications keep calling the same endpoint:

py

Key takeaways

  • For token-billed model APIs, prefer active-active, because a second provider costs only the traffic you send it and never sits untested. Reserved capacity and prompt caching are the exceptions.
  • Fail over on 5xx and timeouts, shift traffic on 429, rotate keys on 401/403, and don't resend malformed requests or content-filter refusals to another provider.
  • Keep retry logic in exactly one layer, use backoff with jitter, and add a circuit breaker so failing backends fail fast.

Sources and further reading