Skip to main content

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

Google

  • 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

  1. Sign up at https://console.anthropic.com
  2. Generate API key
  3. Note your organization ID
2

Configure

3

Test


OpenAI GPT

1

Get API Key

  1. Sign up at https://platform.openai.com
  2. Create API key
  3. Add billing information
2

Configure

3

Test


Google Gemini

1

Get API Key

  1. Go to https://makersuite.google.com/app/apikey
  2. Create API key
  3. Enable Gemini API
2

Configure

3

Test


Azure OpenAI

1

Setup Azure

  1. Create Azure OpenAI resource
  2. Deploy a model (e.g., gpt-4)
  3. Get endpoint and API key
2

Configure

3

Test


AWS Bedrock

1

Setup AWS

  1. Enable Bedrock in AWS Console
  2. Request model access
  3. 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:
Fallback Flow: Configuration:
Common Failure Scenarios:
  • API quota exceeded
  • Rate limiting
  • Model unavailable
  • Timeout
  • Invalid API key

Model Comparison


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:
  1. Client Request: Client sends request to API endpoint
  2. API Routing: API Gateway routes request to LangGraph agent
  3. Agent Processing: LangGraph agent processes request and invokes LLM
  4. LLM Generation: LLM provider generates response token by token
  5. Token Streaming: Tokens stream back through agent to API
  6. SSE Delivery: Server-Sent Events push tokens to client in real-time
  7. 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


Troubleshooting

Solutions:
  • Enable fallback models
  • Implement request queuing
  • Increase rate limits (paid plans)
  • Add retry with exponential backoff
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!