This commit is contained in:
Ishaan Jaffer 2026-01-13 18:42:09 -08:00
parent ad040d4981
commit aedf648bc2

View file

@ -3,70 +3,6 @@
This document explains the internal architecture of LiteLLM for contributors. It describes the
major components, how they interact, and the key design decisions that shape the library.
## 1. Repo Composition
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ LiteLLM Repository │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ LiteLLM Proxy (litellm/proxy/) │ │
│ │ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Budgets │ │ Rate │ │ Cost │ │ Guardrails │ │ │
│ │ │ │ │ Limiting │ │ Tracking │ │ │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ Model │ │ Prompt │ │ Batches │ │ Pass-through│ │ │
│ │ │ Access │ │ Mgmt │ │ API │ │ Endpoints │ │ │
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │ LLM │ │ S3 │ │ │
│ │ │Observability│ │ Logging │ │ │
│ │ └─────────────┘ └─────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐ │ │
│ │ │ OpenAI Compatible REST API │ │ │
│ │ └─────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ LiteLLM Python SDK (litellm/) │ │
│ │ │ │
│ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │
│ │ │ main.py │ │ anthropic_ │ │ google_genai/ │ │ │
│ │ │ (OpenAI API) │ │ interface/ │ │ (GenAI API) │ │ │
│ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │
│ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ │
│ │ │ responses/ │ │ router.py │ │ llms/ │ │ │
│ │ │ (Responses API) │ │ (Load Balancing)│ │ (Providers) │ │ │
│ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Integrations (litellm/integrations/) │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Langfuse │ │ Datadog │ │Prometheus│ │ Arize │ │ Slack │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
**LiteLLM Proxy** (`litellm/proxy/`) - Production LLM Gateway with authentication, rate limiting,
budgets, guardrails, and management APIs. Exposes OpenAI-compatible REST endpoints.
**LiteLLM Python SDK** (`litellm/`) - Core library with multiple interface styles:
- `main.py` - OpenAI-compatible: `completion()`, `embedding()`, `image_generation()`
- `anthropic_interface/` - Native Anthropic SDK interface
- `google_genai/` - Native Google GenAI SDK interface
- `responses/` - OpenAI Responses API interface
- `llms/` - Provider implementations with transformation classes
**Integrations** (`litellm/integrations/`) - Logging and observability callbacks for 30+ platforms
## Request Flow
The data flow for a proxy completion request is as follows: