LiteLLM

Call 100+ LLM APIs from OpenAI to Anthropic to Bedrock through one unified, OpenAI-format Python interface.

Library
PyPI
v1.106.2
61,926 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
93 /100 Excellent
Development Activity 100
Maintenance 100
Community 80
Maturity 52
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
90 /100 Excellent
Architecture 90
Code Quality 89
Innovation 92
Learning Curve 85

LiteLLM is an open-source Python library that gives you a single, consistent way to call more than 100 large-language-model providers — OpenAI, Anthropic, Google Gemini, AWS Bedrock, Azure OpenAI, Vertex AI, vLLM, and many more — all in the familiar OpenAI request/response format. Instead of juggling a different SDK, auth pattern, and error type for every model, you import one completion() function and swap providers by changing a model string.

Beyond the core SDK, the same project ships an AI Gateway (proxy server) that adds virtual keys, spend tracking, load balancing, guardrails, and logging for teams that need centralized control. The library itself stays lightweight and importable, making it a drop-in translation layer between your application code and whichever LLM you point it at.

What You Get

  • A single completion() / acompletion() interface that works across 100+ LLM providers without provider-specific SDKs
  • Drop-in OpenAI-format requests and responses, so existing OpenAI code works by changing only the model string
  • Built-in streaming, async, embeddings, image, audio, batch, and rerank endpoints
  • Consistent exception types mapped from every provider’s native error format
  • Cost tracking and token counting across models via a bundled pricing map
  • An optional AI Gateway (proxy server) for virtual keys, spend limits, load balancing, and logging

Common Use Cases

  • Building provider-agnostic applications that can switch between OpenAI, Anthropic, Gemini, and Bedrock without code rewrites
  • Adding fallback and load balancing across multiple LLMs for reliability
  • Centralizing spend tracking and rate limiting for an organization’s LLM usage through the gateway
  • Prototyping against many models quickly to compare quality, latency, and cost

Under The Hood

Architecture - LiteLLM is layered around a thin public surface in litellm/main.py that exposes completion, acompletion, embedding, and related entrypoints. Each entrypoint dispatches on a provider-prefixed model string into per-provider adapter modules under litellm/llms/, which translate the OpenAI-format request into the provider’s native wire format and map the response and errors back. Cross-cutting concerns — caching (litellm/caching), cost calculation (litellm/cost_calculator.py), logging integrations (litellm/integrations), and exception normalization (litellm/exceptions.py) — are composed via a client decorator applied at function-definition time. The optional proxy/gateway layer wraps this same core in a FastAPI server with routing, virtual keys, and spend tracking.

Tech Stack - The core SDK depends on httpx and aiohttp for transport, openai for format compatibility, pydantic v2 for typed models, tiktoken and tokenizers for token counting, and jinja2 for prompt templating. The proxy extra pulls in FastAPI, Uvicorn/Granian, Redis (rq), boto3, cryptography, and MCP. A Rust core (litellm-rust) accelerates hot paths, and the project targets Python 3.10–3.14. Reproducibility is pinned via uv.lock.

Code Quality - The repository is heavily tested, with over 2,600 Python test files under tests/, and enforces strict static analysis through ruff (strict config plus budgets), basedpyright, and flake8. CI runs via CircleCI with codecov coverage tracking, and the code uses extensive type hints and a large typing surface in the core modules. The scale of the provider matrix makes some modules large, but error handling is centralized and consistently mapped.

API Design - The developer experience is the project’s standout: getting started requires only pip install litellm, setting a provider API key, and calling completion(model=..., messages=[...]), mirroring the OpenAI SDK so existing code ports with near-zero boilerplate. Switching providers is a one-string change, async and streaming follow predictable naming (acompletion, stream=True), and errors surface as familiar OpenAI-style exceptions. Documentation is thorough, with a dedicated docs site, a cookbook/ of examples, and an examples/ directory.

Used by 27 apps in this directory

TypeScript
91%
Other

GitNexus

AI Code Assistants · Developer Tools · Mcp

48,014

Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.

View details
88
Repo Health
86
Technical
70
Dependency
Built with
TypeScript 91%
Updated 6 days ago
Python
71%
Apache 2.0

GPT Researcher

AI Assistants · Productivity

30,269

The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.

View details
90
Repo Health
91
Technical
64
Dependency
Built with
Python 71%
TypeScript 18%
Updated 2 weeks ago
Python
82%
Apache 2.0

headroom

AI Development · Developer Tools

77,676

Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.

View details
85
Repo Health
86
Technical
69
Dependency
Built with
Python 82%
Rust 12%
Updated 5 days ago
Python
71%
MIT

Langflow

AI Agents · AI Development

155,973

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
64
Dependency
Built with
Python 71%
TypeScript 21%
Updated 5 days ago
Python
84%
MIT

LiteLLM

AI Development · Developer Tools

61,933

Open source AI gateway and Python SDK that gives you one OpenAI-compatible interface to call 100+ LLM providers, with built-in routing, cost tracking, guardrails, and virtual keys.

View details
93
Repo Health
81
Technical
69
Dependency
Built with
Python 84%
TypeScript 11%
Updated 5 days ago
C++
66%
Other

Memgraph

AI Development · Databases

4,628

High-performance in-memory graph database for AI context and real-time analytics

View details
90
Repo Health
79
Technical
66
Dependency
Built with
C++ 66%
Python 18%
Updated 5 days ago
Python
66%
Other

Morphik

AI Development · Databases · Search

3,717

Morphik is an AI-native ingestion and retrieval engine that lets developers store, search, and reason over visually rich documents — scanned PDFs, manuals, slides, and video — without duct-taping together OCR, an embedding model, and a vector database.

View details
64
Repo Health
71
Technical
67
Dependency
Built with
Python 66%
TypeScript 23%
Updated 1 weeks ago
Python
64%
Other

Onyx

AI Agents · AI Assistants · Knowledge Management

32,935

Self-hostable AI platform with agentic RAG, 50+ connectors, deep research, code execution, and support for every major LLM provider.

View details
92
Repo Health
83
Technical
68
Dependency
Built with
Python 64%
TypeScript 26%
Updated 5 days ago
TypeScript
92%
Other

OpenHands

AI Code Assistants · AI Development

91,695

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 92%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers