mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-26 22:30:11 +00:00
48 lines
3.4 KiB
Markdown
48 lines
3.4 KiB
Markdown
# litellm internal architecture
|
|
|
|
A documentation series on how the litellm codebase is put together, what it seems to be aiming for, and where it falls short of that today. Written for people changing the code, not for users of the product. Checked against `BerriAI/litellm` `main` at `13118948` on 2026-10-15
|
|
|
|
Diagrams are hand-laid-out SVG files in [diagrams/](diagrams/), generated by the scripts in [tools/diagrams/](tools/diagrams/). Edit a script and rerun it to change a picture
|
|
|
|
## Start here
|
|
|
|
[explanation/01-system-overview.md](explanation/01-system-overview.md) gives the big picture and the seven design principles the code implies, with a one-line verdict on each. Then pick by what you need
|
|
|
|
## Explanation (why it's shaped this way, and where the shape breaks)
|
|
|
|
| Page | Covers |
|
|
|---|---|
|
|
| [01 System overview](explanation/01-system-overview.md) | The pieces, the intended principles, how they hold up |
|
|
| [02 Layers and dependency direction](explanation/02-layers-and-dependency-direction.md) | The implied layer stack, measured import edges, global state as hidden coupling |
|
|
| [03 Data-plane request pipeline](explanation/03-data-plane-request-pipeline.md) | The seven stages every LLM call passes through, and how each API surface deviates |
|
|
| [04 Control plane, config and state](explanation/04-control-plane-config-and-state.md) | Config sources, startup order, where state lives, how changes reach other pods |
|
|
| [05 Extension points](explanation/05-extension-points.md) | Callbacks, guardrails and hooks, and where they fire |
|
|
| [06 Python and Rust](explanation/06-python-and-rust.md) | The Rust migration's intended end state, the rollout switch, what actually runs in Rust |
|
|
| [07 Deployment shapes](explanation/07-deployment-shapes.md) | Monolith, componentized gateway/backend/UI, Rust gateway, and the lazy-route hole in the split |
|
|
|
|
## Reference (look things up)
|
|
|
|
| Page | Covers |
|
|
|---|---|
|
|
| [Surface map](reference/surface-map.md) | Every product surface mapped to its entry code, with route families and counts |
|
|
| [User flows, data plane](reference/user-flows-data-plane.md) | Sequence diagrams for chat, Messages, Responses, pass-through, MCP and direct SDK calls |
|
|
| [User flows, control plane](reference/user-flows-control-plane.md) | Startup, key creation and use, model add, spend and budgets, guardrails, callbacks |
|
|
| [Flow and subsystem matrix](reference/flow-subsystem-matrix.md) | Which flows touch which subsystems, and the blast radius of changing each |
|
|
| [Gap register](reference/gap-register.md) | Every intent-vs-reality gap in one table with evidence and impact |
|
|
|
|
## How-to
|
|
|
|
| Page | Covers |
|
|
|---|---|
|
|
| [Trace a surface to code](how-to/trace-a-surface-to-code.md) | From a URL, UI page or SDK call to every piece of code that shapes it |
|
|
| [Refresh these docs](how-to/refresh-these-docs.md) | Commands that regenerate every number in the series |
|
|
|
|
## Tutorial
|
|
|
|
| Page | Covers |
|
|
|---|---|
|
|
| [Follow one request](tutorials/follow-one-request.md) | Run a local proxy with a mock model and match each pipeline stage to a debug log line |
|
|
|
|
## Related notes in this project
|
|
|
|
The series builds on earlier work in [/mnt/project-files/invariants/](/mnt/project-files/invariants/): the candidate invariants survey, the layer inversion plan (Linear LIT-9423), the permission-check map, the extension-point docs audit, the test-suite map and the config coverage notes. The scan scripts it relies on are in `invariants/tools/` and [tools/](tools/)
|