What is LiteLLM? A Lightweight LLM Gateway With Real Examples
Most teams building with LLMs start with one provider. Then they add a second for cost reasons. A third for a specific capability. Before long, they are maintaining three different API clients, three different error-handling patterns, and three different billing dashboards, all doing the same job.
LiteLLM was built to eliminate that problem. It is an open-source Python SDK and self-hosted proxy that gives you a single, OpenAI-compatible interface for 100+ LLM providers. One API call format. One place to track costs. One layer to set budgets, guardrails, and fallback logic.
This guide covers what LiteLLM is, how the proxy works, how to set it up, and the real-world use cases where it saves teams the most time and money in 2026.
What is LiteLLM?
LiteLLM is an open-source library and AI gateway that lets you call 100+ large language model (LLM) APIs through a single, unified interface. Instead of writing separate integration code for OpenAI, Anthropic, AWS Bedrock, Google Vertex AI, Cohere, Mistral, and others, you write one standard call and LiteLLM routes it to whichever provider you specify.
It comes in two forms:
- LiteLLM Python SDK: A drop-in replacement for the OpenAI Python client. Use
litellm.completion()the same way you would useopenai.chat.completions.create(), but with any provider. - LiteLLM Proxy Server (AI Gateway): A self-hosted FastAPI-based gateway you run in your infrastructure. Any client that works with the OpenAI API works with the LiteLLM proxy with no code changes.
As of mid-2026, LiteLLM supports over 100 providers including OpenAI (GPT-5.5, GPT-5.4), Anthropic (Claude Opus 4.7, Claude Opus 4.8), AWS Bedrock, Google Vertex AI, Gemini, Mistral, Groq, Together AI, Fireworks, NVIDIA NIM, Replicate, Ollama, Hugging Face, Cohere, Azure OpenAI, and more.
As of mid-2026, LiteLLM has crossed 40,000 GitHub stars, 1,300+ contributors, and 240 million Docker pulls, making it the most widely adopted open-source LLM gateway available.
Key Features of LiteLLM in 2026
1. Unified API for 100+ Providers
A single completion() call works across every supported provider. Switching from GPT-5.4 to Claude Opus 4.7 to Mistral Large is a one-line change, with no refactoring of API clients, authentication logic, or response parsers.
2. LiteLLM Proxy Server
The proxy is the production-grade component of LiteLLM. Run it as a Docker container in your own infrastructure and it acts as an OpenAI-compatible gateway for your entire organisation. Features include:
- Virtual keys per team, project, or user, each with its own monthly budget, rate limits (RPM and TPM), and model access restrictions
- Built-in admin dashboard at
/uishowing per-team and per-model spend - Cost tracking automatically logged to a connected PostgreSQL database
- Support for Redis for syncing spend across multi-instance deployments
3. Load Balancing and Fallbacks
LiteLLM distributes requests across multiple providers or model deployments. If one provider returns a rate limit error or goes down, LiteLLM automatically retries on a configured fallback provider. This removes a major source of production outages in LLM-dependent applications.
4. Cost Tracking and Budget Controls
Every request through the proxy is logged with token count, model, provider, and cost. Teams can set provider-level budgets, and the proxy returns an error before a budget is exceeded rather than after. For teams spending more than $100/month on LLM APIs, cost tracking alone justifies running the proxy.
5. Guardrails
LiteLLM integrates with guardrail providers to enforce content filters, PII redaction, and prompt injection detection at the gateway level. This means guardrails apply to every model and every team without changes to application code. In 2026, LiteLLM added OpenTelemetry span emission on guardrail violations for full observability.
6. Streaming Support
LiteLLM normalises streaming responses across all providers into a consistent format. Whether the underlying provider uses server-sent events, chunked transfer encoding, or a custom streaming protocol, your application receives a uniform stream.
7. Prompt Caching Support
LiteLLM passes through prompt caching instructions to providers that support it (Anthropic Claude, AWS Bedrock) and tracks cached token costs separately in the dashboard. For applications with long, repeated system prompts, this can reduce token spend by 60-90% on cached portions.
8. Day-Zero Model Support
LiteLLM maintains a live model_prices_and_context_window.json that can be auto-synced without a proxy restart. When OpenAI released GPT-5.5 in April 2026, LiteLLM had day-zero support. The same applied to Claude Opus 4.8 in May 2026. Set model_cost_map_sync: true in your config and the proxy always knows current pricing and context window sizes.
9. OpenAI-Compatible Interface
Any tool built for the OpenAI API works with the LiteLLM proxy without modification. This includes AI coding tools (Claude Code, Cursor, Copilot), agent SDKs (LangChain, LlamaIndex, CrewAI), and observability platforms (Langfuse, Helicone).
10. Enterprise Features
The enterprise edition adds SAML/SSO, audit logs, RBAC, per-project budget isolation, max request/response size limits, and team-managed model keys. Available via Docker with a license key; procurement available through AWS and Azure Marketplace.
11. Semantic Caching
Semantic caching reduces token spend on workloads with repeated or similar queries. Unlike exact-match caching, LiteLLM uses vector similarity to identify prompts that mean the same thing and return cached responses. In customer support, RAG pipelines, and code generation workflows, semantic caching cuts token costs by 30-60%. Configure it with a Redis backend and tune the similarity threshold to avoid stale responses.
12. MCP and Agent-to-Agent (A2A) Protocol Support
LiteLLM now supports the Model Context Protocol (MCP) and Agent-to-Agent (A2A) protocol natively. AI agents built on LangGraph, Vertex AI Agent Engine, CrewAI, or custom frameworks can route their LLM calls through LiteLLM and inherit cost tracking, fallbacks, and guardrails automatically. For teams building multi-agent systems, LiteLLM becomes the natural gateway layer between your agents and the models they call.
How LiteLLM Works
At its core, LiteLLM translates your request into the correct format for the target provider, sends it, receives the response, and translates it back into a standard OpenAI-compatible format before returning it to your application.
When you use the proxy, your application never changes its API calls regardless of which provider is serving the request underneath. The proxy handles authentication, routing, retries, and cost logging invisibly.
Setting Up LiteLLM
Python SDK (5 minutes)
Install the package:
pip install litellmMake your first unified call:
from litellm import completion
import os
# Set your provider API keys
os.environ["OPENAI_API_KEY"] = "your-openai-key"
os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-key"
os.environ["AWS_ACCESS_KEY_ID"] = "your-aws-key"
os.environ["AWS_SECRET_ACCESS_KEY"] = "your-aws-secret"
os.environ["AWS_REGION_NAME"] = "us-east-1"
messages = [{"role": "user", "content": "Summarise this contract in 3 bullet points."}]
# Call OpenAI
response = completion(model="gpt-4o", messages=messages)
print(response.choices[0].message.content)
# Switch to Claude with one line change
response = completion(model="claude-opus-4-7-20251101", messages=messages)
print(response.choices[0].message.content)
# Switch to AWS Bedrock
response = completion(model="bedrock/anthropic.claude-opus-4-7", messages=messages)
print(response.choices[0].message.content)LiteLLM Proxy Server (15 minutes)
Create a config.yaml:
model_list:
- model_name: gpt-4o
litellm_params:
model: openai/gpt-4o
api_key: os.environ/OPENAI_API_KEY
- model_name: claude-opus
litellm_params:
model: anthropic/claude-opus-4-7-20251101
api_key: os.environ/ANTHROPIC_API_KEY
- model_name: bedrock-nova-pro
litellm_params:
model: bedrock/amazon.nova-pro-v1:0
general_settings:
master_key: sk-your-master-key
model_cost_map_sync: trueRun with Docker:
docker run -d \
-p 4000:4000 \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
-v $(pwd)/config.yaml:/app/config.yaml \
ghcr.io/berriai/litellm:main-stable \
--config /app/config.yamlYour proxy is now running at http://localhost:4000. Any OpenAI-compatible client points to this URL instead of api.openai.com, with no other changes needed.
LiteLLM vs Calling Providers Directly
LiteLLM vs Azure APIM vs Bifrost
LiteLLM makes the most sense when your team uses two or more providers, when you need per-team cost visibility, or when you want guardrails applied consistently without touching application code.
LiteLLM with AWS Bedrock
LiteLLM has first-class support for AWS Bedrock, which makes it a natural fit for enterprises already running workloads on AWS. You can route requests to any Bedrock model using standard IAM credentials, with no separate API key management.
from litellm import completion
# Amazon Nova Pro via Bedrock
response = completion(
model="bedrock/amazon.nova-pro-v1:0",
messages=[{"role": "user", "content": "Analyse this freight invoice."}]
)
# Claude Opus 4.7 via Bedrock
response = completion(
model="bedrock/anthropic.claude-opus-4-7-20251101",
messages=[{"role": "user", "content": "Summarise this patient record."}]
)Using LiteLLM with Bedrock lets you A/B test Nova Pro against Claude or GPT-5.4 with no code changes, track costs across all three in one dashboard, and fall back automatically if one model hits a rate limit.
LiteLLM Use Cases by Industry
Logistics & Supply Chain
- Route freight document extraction tasks (bills of lading, customs forms) to cost-efficient models like Nova Micro, and complex multi-document reasoning to Claude Opus, all from one codebase
- Use budget routing to cap per-team LLM spend across operations, finance, and engineering
- Fall back automatically between Bedrock and direct Anthropic API if one endpoint hits rate limits during peak processing windows
Fintech & Financial Services
- Apply guardrails at the proxy level to enforce PII redaction and output length limits across all generative AI in fintech workflows
- Set per-project budgets so compliance, risk, and product teams each have isolated LLM spend visibility
- A/B test GPT-5.4 against Claude Opus for regulatory summarisation quality without changing application code
Healthcare
- Enforce HIPAA-aligned guardrails at the gateway so PHI redaction applies to every model call across the organisation
- Route real-time clinical note generation to low-latency models and batch document summarisation to the 50%-off batch tier
- Use virtual keys to isolate spend per department (radiology, oncology, admin) without separate infrastructure
Real Estate & PropTech
- Switch between embedding models (OpenAI, Cohere, Bedrock) for property search without rewriting RAG pipelines
- Track which models perform best for lease agreement analysis using LiteLLM's built-in logging and observability integrations
- Set monthly provider budgets so experimental model testing does not affect production billing
LiteLLM Supported Providers (2026)
For the full list, see the LiteLLM official documentation.
How Seaflux Builds with LiteLLM
At Seaflux, LiteLLM is a standard part of our AI infrastructure stack for production systems. We use it to deliver:
- Multi-provider routing layers that automatically fall back between AWS Bedrock and direct API endpoints based on latency and cost
- Per-client virtual key setups so each customer's LLM spend is isolated, visible, and budget-capped
- Guardrail enforcement at the proxy level for healthcare and fintech clients with PHI and PII requirements
- RAG-powered pipelines that swap embedding models without rewriting retrieval logic
- Routing developer IDE tools including Claude Code and Cursor through the proxy so every team member's AI coding usage is tracked per person, rate-limited to prevent accidental overspend, and billed centrally alongside production LLM costs
Whether you are evaluating LiteLLM for the first time or looking to move an existing multi-provider setup to a managed proxy architecture, we can help you scope the right approach for your stack.
LiteLLM Pricing
LiteLLM uses a two-tier pricing model:
Open Source (Free): The core SDK and proxy are free under the MIT licence. You self-host on your own infrastructure and pay only for the servers and databases you run, typically $200 to $500 per month depending on traffic volume.
Enterprise: Enterprise Basic starts at $250/month and adds SSO, RBAC, audit logs, and SLA-backed support. Enterprise Premium is approximately $30,000/year for large-scale deployments with full governance and compliance documentation. Both are available via Docker licence key and through AWS and Azure Marketplace.
For most teams spending under $10,000/month on LLM APIs, the open-source version is sufficient. The enterprise tier makes sense when you need vendor-provided security certifications for SOC 2, HIPAA, or ISO 27001 audits.
Frequently Asked Questions (FAQ): Get the Answers You Need
What is LiteLLM?
LiteLLM is an open-source Python SDK and self-hosted proxy (AI gateway) that provides a single, OpenAI-compatible interface for 100+ large language model providers including OpenAI, Anthropic, AWS Bedrock, Google Vertex AI, Mistral, Groq, and many more. It handles routing, cost tracking, load balancing, fallbacks, and guardrails in one layer.
What is the LiteLLM proxy?
The LiteLLM proxy is a self-hosted FastAPI server that acts as an AI gateway for your organisation. You run it in your infrastructure via Docker, and all LLM traffic from your applications routes through it. It provides a built-in admin dashboard, virtual key management, per-team budget controls, cost tracking via PostgreSQL, and an OpenAI-compatible API that works with any existing client.
Is LiteLLM free?
The core LiteLLM SDK and proxy are free and open-source under the MIT licence. The enterprise edition adds SSO, RBAC, audit logs, and per-project budget isolation, with pricing based on deployment size. The open-source version is sufficient for most teams.
How does LiteLLM save money?
LiteLLM saves money in three main ways: it makes it easy to route cheaper models to simpler tasks (e.g. Nova Micro instead of GPT-4o for classification), it surfaces per-team and per-model spend so you can see where budget is going, and it enforces provider budgets so you never exceed a spend cap without knowing.
Does LiteLLM work with AWS Bedrock?
Yes. LiteLLM has first-class AWS Bedrock support. You authenticate with standard AWS IAM credentials and call any Bedrock model using the bedrock/ prefix in the model string. This includes all Amazon Nova models, Claude on Bedrock, Llama 4, DeepSeek-R1, and others.
What is the difference between LiteLLM SDK and LiteLLM proxy?
The SDK is a Python library you import directly into your application code. It is the right choice for individual developers or simple single-service setups. The proxy is a self-hosted server that sits in front of your applications. It is the right choice for platform teams managing LLM access across multiple services, teams, or customers, especially when you need centralised cost tracking, budget controls, and guardrails.
Is LiteLLM safe to use in production?
Yes, with some care around versioning. LiteLLM releases stable builds weekly. Avoid versions 1.82.7 and 1.82.8, which were affected by a supply chain incident in March 2026. Pin to the latest stable release (1.84.0+) and scan dependencies as part of your CI pipeline.
Can LiteLLM handle agentic workflows?
Yes. LiteLLM works with LangChain, LlamaIndex, CrewAI, and other agentic AI frameworks because it exposes an OpenAI-compatible interface. Agent frameworks that are built to call the OpenAI API route through LiteLLM with no modification, gaining cost tracking and fallback logic automatically.
How do I get started with LiteLLM?
Install with pip install litellm, set your provider API keys as environment variables, and replace your existing openai.chat.completions.create() calls with litellm.completion(). For the proxy, use the Docker setup described in the setup section above. The official docs at docs.litellm.ai cover every provider and feature in detail.

Krunal Bhimani
Business Development Executive