Problem
LLM providers experience outages, rate limits, and high latency. Depending on a single provider creates single points of failure in production.
Solution
Define a prioritised provider chain and automatically route to the next provider on failure.
Implementation
- Define chain: Primary (GPT-5.6 Sol via Azure OpenAI) → Fallback 1 (GPT-6.1 Sol via OpenAI direct) → Fallback 2 (Claude via Anthropic)
- Trigger conditions: HTTP 429 (rate limited), HTTP 5xx (provider error), timeout > SLO (e.g., 30s)
- Circuit state: Track failure rate per provider; skip degraded providers proactively (circuit breaker)
- Prompt adaptation: If switching model families (OpenAI → Claude), apply per-model prompt templates
LiteLLM pattern
from litellm import completion
response = completion(
model="gpt-6.1-sol",
fallbacks=["claude-sonnet-5-5", "gemini/gemini-3.8-flash"],
messages=[{"role": "user", "content": prompt}]
)
Trade-offs
- Pro: High availability: one provider's outage no longer takes the feature down
- Pro: Cost optimisation — route to cheaper models during low-priority periods
- Con: Different model families produce inconsistent outputs — test each fallback path
- Con: Cost unpredictability if fallbacks are more expensive
When to use
Any production system with SLA requirements and more than 1000 RPD.
When to avoid
Internal tools where brief downtime is acceptable.