← Back to docs

Multi-provider failover

Meridian routes requests across multiple upstream model providers so a single outage, quota exhaustion, or latency spike never breaks your application. This recipe walks through configuring automatic failover between Azure, Anthropic, and OpenAI-compatible endpoints behind a single Meridian API key.

1. Declare provider tiers

Each model alias accepts an ordered list of providers. Meridian tries them top-to-bottom and only falls through on retryable failures (5xx, 429, network reset).

{
  "alias": "smart",
  "providers": [
    { "id": "azure/gpt-5", "weight": 1 },
    { "id": "anthropic/claude-opus-4", "weight": 1 },
    { "id": "openai/gpt-4o", "weight": 1 }
  ],
  "strategy": "failover",
  "retry_budget_ms": 8000
}

2. Set retry and timeout budgets

A global retry_budget_ms caps total wall-clock time across attempts so a slow primary cannot starve the fallback. Per-provider connect_timeout_ms and read_timeout_ms let you fail fast on a stalled upstream while still allowing long generations on the healthy one.

3. Observe failover events

Every fallback decision is logged with the trigger reason, attempt index, and the provider that ultimately served the response. Stream them to your SIEM via the Meridian webhook, or query the dashboard at meridian.getnimbus.net/analytics.

← Back to docs