Automatic Provider Failover
Fallbacks provide automatic failover when your primary AI provider experiences issues. Whether it’s rate limiting, outages, or model unavailability, Bifrost automatically tries backup providers in the order you specify until one succeeds. When a fallback is triggered, Bifrost treats it as a completely new request - all configured plugins (caching, governance, logging, etc.) run again for the fallback provider, ensuring consistent behavior across all providers.How Fallbacks Work
When you configure fallbacks, Bifrost follows this process:- Primary Attempt: Tries your main provider/model first
- Automatic Detection: If the primary fails (network error, rate limit, model unavailable), Bifrost detects the failure
- Sequential Fallbacks: Tries each fallback provider in order until one succeeds
- Success Response: Returns the response from the first successful provider
- Complete Failure: If all providers fail, returns the original error from the primary provider
Implementation Examples
- Gateway
- Go SDK
Real-World Scenarios
Scenario 1: Rate Limiting- Primary: OpenAI hits rate limit → Fallback: Anthropic succeeds
- Your application continues without interruption
- Primary: Specific model unavailable → Fallback: Different provider with similar model
- Seamless transition to equivalent capability
- Primary: Provider experiencing downtime → Fallback: Alternative provider
- Business continuity maintained
- Primary: Premium model for quality → Fallback: Cost-effective alternative if budget exceeded
- Governance rules can trigger fallbacks based on usage
Fallback Behavior Details
What Triggers Fallbacks:- Network connectivity issues
- Provider API errors (500, 502, 503, 504)
- Rate limiting (429 errors)
- Model unavailability
- Request timeouts
- Authentication failures
- Request validation errors (malformed requests)
- Plugin-enforced blocks (governance violations)
- Certain provider-specific errors marked as non-retryable
- Semantic cache checks run again (different provider might have cached responses)
- Governance rules apply to the new provider
- Logging captures the fallback attempt
- All configured plugins execute fresh for the fallback provider
- A custom plugin might prevent fallbacks for certain types of errors
- Security plugins might disable fallbacks for compliance reasons
extra_fields.
