ArchitectureReliability

Building Resilient AI: LLM Failover Architecture

LLM providers have outages and rate limits. Here's how to architect automatic failover so your application stays up when providers go down.

DeltaLLM Team February 10, 2026 8 min read

Every LLM provider has outages. OpenAI, Anthropic, Groq — all of them. If your app calls one provider with no fallback, every outage becomes your outage. Your users see errors, your support queue fills up, and your team scrambles to fix something they can't control.

This post covers how to build automatic failover so your app stays up even when providers go down.

Why LLM Failover Is Tricky

Failover for LLM APIs is trickier than typical service failover:

  • Models aren't interchangeable — switching from GPT-4o to Claude changes the output. You need to know if your fallback produces acceptable results for your use case.
  • Cost varies — falling back to a more expensive model has real cost impact at scale.
  • Rate limits ≠ outages — a 429 (rate limit) might resolve in seconds. A 503 (outage) might last hours. They need different responses.
  • Streaming complicates recovery — if you're mid-stream when a provider fails, recovery is harder than for simple request/response.

The Four Layers of Failover

Layer 1: Retry with backoff

The simplest resilience layer. A request fails, you wait a bit, and try again. This handles brief network issues and momentary provider hiccups. With DeltaLLM, retries are built into the gateway:

terminal
router_settings:
  num_retries: 2
  retry_after: 1    # seconds before first retry
  timeout: 600      # max request time

No application code needed. The gateway handles retries transparently.

Layer 2: Provider fallback chains

When retries on the primary provider fail, hand off to a different provider entirely:

terminal
model_list:
  - model_name: production-llm
    deltallm_params:
      model: openai/gpt-4o
      api_key: os.environ/OPENAI_API_KEY

  - model_name: production-llm-fallback
    deltallm_params:
      model: anthropic/claude-3-5-sonnet-20241022
      api_key: os.environ/ANTHROPIC_API_KEY

deltallm_settings:
  fallbacks:
    - production-llm:
        - production-llm-fallback

Your app calls production-llm. If OpenAI is down, DeltaLLM automatically routes to Anthropic. Your app never sees the switch.

DeltaLLM also supports specialized fallback chains for different failure types:

  • context_window_fallbacks — when the input is too large for the first model, fall back to one with a bigger context window.
  • content_policy_fallbacks — when a provider rejects the content for policy reasons, try a different provider.

Layer 3: Smart routing strategies

Instead of waiting for failures, route proactively based on health and load. DeltaLLM supports nine routing strategies:

StrategyWhen to use it
simple-shuffleDefault — randomly picks a healthy deployment
weightedYou want a planned traffic split like 90/10
priority-based-routingYou want a primary with a clear standby
least-busyBalance load during traffic bursts
latency-based-routingRoute to the fastest provider
cost-based-routingRoute to the cheapest option
usage-based-routingSpread demand across quota limits
rate-limit-awareAvoid providers near their rate limits
tag-based-routingRoute by region, tenant, or capability
DeltaLLM Route Groups page
Route Groups let you group multiple deployments behind one stable name with visual routing controls.

Layer 4: Circuit breaker

A circuit breaker prevents sending requests to a provider you already know is down. Instead of letting every request fail and retry, the circuit "opens" after a threshold of failures:

terminal
router_settings:
  allowed_fails: 2     # mark unhealthy after 2 failures
  cooldown_time: 60    # seconds before retrying the provider

After 2 failures, the provider is taken out of rotation for 60 seconds. After the cooldown, a test request checks if it's back. This prevents wasting time and user patience on a known-bad provider.

Managing Failover in the Admin UI

DeltaLLM's Route Groups give you a visual way to manage failover without editing config files. Create a group, add member deployments, choose a routing strategy, and the gateway handles the rest:

DeltaLLM Route Group detail page
Route Group detail — see member health, routing policy, and prompt binding at a glance.

Choosing Fallback Models

FactorWhat to consider
Output qualityWill your fallback produce acceptable results for your use case?
Context windowIf your primary has 128K context, your fallback should match.
CostFalling back to an expensive model should be temporary and monitored.
Feature parityIf you use function calling or vision, your fallback must support it.
Test your fallback models with real production prompts before relying on them. A model switch that works in a demo can produce poor results with your actual use case.

Monitoring Failover

Every provider switch is a signal worth tracking. DeltaLLM logs fallback events so you can spot patterns:

  • GET /health/deployments — current deployment health
  • GET /health/fallback-events — recent retry and failover activity
  • GET /metrics — latency, traffic, and failure metrics for Prometheus

A sustained high failover rate means you're hitting provider limits regularly — time to negotiate higher quotas or adjust your routing strategy.

Try DeltaLLM

Set up DeltaLLM on Railway for a small test, or explore a related guide before you deploy.

Railway sets up DeltaLLM, PostgreSQL, and Redis. Requires a Railway account and gateway/admin credentials; add an AI provider to make requests. Hosting may incur charges.

Prefer another deployment option? Read the setup guide.