Overview
Configure 100+ LLM providers via LiteLLM with automatic fallback, load balancing, and cost optimization. Supports cloud providers (Anthropic, OpenAI, Google) and open-source models (Llama, Mistral, Qwen via Ollama).LiteLLM provides a unified interface to all major LLM providers with automatic retries, fallback, and intelligent routing.
Supported Providers
Anthropic
- Claude Sonnet 4.5
- Claude Opus 4.1
- Claude Haiku 4.5
OpenAI
- GPT-5
- GPT-5 Pro
- GPT-5 Mini
- GPT-5 Nano
- Gemini 2.5 Flash
- Gemini 2.0 Pro
- Gemini 1.5 Pro
Azure OpenAI
- GPT-4 (Azure)
- GPT-3.5 (Azure)
- Custom deployments
AWS Bedrock
- Claude (Bedrock)
- Llama (Bedrock)
- Titan
Ollama
- Llama 3.1
- Mistral
- Qwen 2.5
- DeepSeek
Quick Start
Anthropic Claude
1
Get API Key
- Sign up at https://console.anthropic.com
- Generate API key
- Note your organization ID
2
Configure
3
Test
OpenAI GPT
1
Get API Key
- Sign up at https://platform.openai.com
- Create API key
- Add billing information
2
Configure
3
Test
Google Gemini
1
Get API Key
- Go to https://makersuite.google.com/app/apikey
- Create API key
- Enable Gemini API
2
Configure
3
Test
Azure OpenAI
1
Setup Azure
- Create Azure OpenAI resource
- Deploy a model (e.g., gpt-4)
- Get endpoint and API key
2
Configure
3
Test
AWS Bedrock
1
Setup AWS
- Enable Bedrock in AWS Console
- Request model access
- Configure IAM credentials
2
Configure
3
Test
Ollama (Local Models)
1
Install Ollama
2
Pull Model
3
Configure
4
Test
Automatic Fallback
Configure automatic fallback when primary model fails:- API quota exceeded
- Rate limiting
- Model unavailable
- Timeout
- Invalid API key
Model Comparison
- Performance
- Use Cases
- Pricing
Advanced Configuration
Load Balancing
Distribute requests across multiple providers:Rate Limiting
Prevent quota exhaustion:Cost Tracking
Monitor LLM costs:Caching
Cache responses to reduce costs:LLM Streaming Response Flow
The following diagram shows how streaming responses flow from the LLM through the server to the client: Flow Description:- Client Request: Client sends request to API endpoint
- API Routing: API Gateway routes request to LangGraph agent
- Agent Processing: LangGraph agent processes request and invokes LLM
- LLM Generation: LLM provider generates response token by token
- Token Streaming: Tokens stream back through agent to API
- SSE Delivery: Server-Sent Events push tokens to client in real-time
- Client Reception: Client receives and displays streaming response
Streaming Benefits: Real-time responses, lower perceived latency, better user experience, and efficient token-by-token delivery.
Configuration Reference
Environment Variables
Model IDs
- Anthropic
- OpenAI
- Google
- Azure
- Bedrock
- Ollama
Troubleshooting
API key not working
API key not working
Rate limit errors
Rate limit errors
Solutions:
- Enable fallback models
- Implement request queuing
- Increase rate limits (paid plans)
- Add retry with exponential backoff
Ollama connection failed
Ollama connection failed
Slow responses
Slow responses
Optimizations:
- Use faster models (Gemini Flash, Claude Haiku)
- Reduce max_tokens
- Increase temperature for faster sampling
- Enable streaming
Next Steps
Observability
Track LLM usage and costs
Architecture
Understand LLM integration
Production Checklist
LLM production requirements
API Reference
Agent API endpoints
Flexible & Resilient: Multi-LLM support with automatic fallback ensures high availability and cost optimization!