Overview
LiteLLM Router provides sophisticated load balancing to distribute requests across multiple model deployments. This improves reliability, reduces rate limiting, and optimizes resource utilization.Quick Start
Routing Strategies
LiteLLM supports multiple routing strategies to optimize different use cases:1. Simple Shuffle (Default)
Randomly distributes requests across deployments:Best for: General use, even distribution, no state tracking needed
2. Least Busy
Routes to the deployment with the fewest ongoing requests:Best for: Minimizing queue times, handling variable request durations
3. Latency-Based Routing
Routes to the deployment with the lowest average latency:Best for: Optimizing response time, geographic distribution
4. Usage-Based Routing (TPM/RPM)
Routes based on tokens-per-minute and requests-per-minute limits:Best for: Respecting rate limits, preventing quota exhaustion
5. Usage-Based Routing V2
Improved version with better tracking:6. Cost-Based Routing
Routes to the cheapest available deployment:Best for: Minimizing costs while maintaining availability
Advanced Configuration
Rate Limits and Quotas
Configure deployment limits:Deployment Priorities
Prefer certain deployments over others:Region-Based Routing
Health Checks and Cooldowns
Deployment Cooldowns
Automatically remove unhealthy deployments:Checking Deployment Status
Pre-Call Checks
Filter deployments before routing:Tag-Based Routing
Route based on deployment tags:Deployment Affinity
Stick to the same deployment for a user/session:Useful for maintaining conversation context or debugging specific deployments
Monitoring and Observability
Deployment Metrics
Request Distribution
Best Practices
Load Balancing Tips
- Use multiple deployments - At least 2-3 per model for redundancy
- Set appropriate limits - Configure TPM/RPM based on actual quotas
- Monitor cooldowns - Alert when deployments enter cooldown
- Choose right strategy - Match strategy to your use case
- Test failover - Verify behavior when deployments fail
- Distribute geographically - Use multiple regions for global apps
Common Patterns
High-Throughput Pattern
Multi-Region Pattern
Cost-Optimized Pattern
Async Support
Load balancing works with async operations:Troubleshooting
All Deployments in Cooldown
Uneven Distribution
Rate Limit Issues
Related Features
- Fallbacks - Automatic failover between models
- Retries - Retry logic for failed requests
- Cost Tracking - Monitor costs across deployments
- Caching - Reduce load with caching