RepoPilot

berriai / litellm

Search berriai/litellm

GitHub

Code

How berriai/litellm is laid out, and where to start for common changes.

C
Architecture grade
score 66/100
8+
Import cycles
lower is better
400
Files mapped
991 imports between them
89%
Layering
of imports point one way

From the map of which files import which. It shows what depends on what, not a reading order.

Module map

Shade by
Entry points and orchestratorsShared coreFoundationStandalone__init__1 file · not checkedconstants1 file · not checked_logging1 file · not checkedlitellm_core_utils103 files · 100+ commitstypes239 files · 100+ commitscaching22 files · 100+ commitsrust_bridge49 files · 100+ commitssecret_managers11 files · 40 commitsresponses25 files · 100+ commits_internal_context1 file · not checked_uuid1 file · not checkedrepositories24 files · 90 commitsintegrations233 files · 100+ commitsvector_stores4 files · 30 commitsdecisions3 files · not checkedcost_calculator1 file · not checkedproxy999 files · 100+ commitsmodels22 files · 47 commitsinteractions14 files · 32 commitsfiles4 files · 26 commitsexperimental_mcp_client3 files · not checkedvector_store_files3 files · not checkedllms1080 files · 100+ commitsrag15 files · 39 commitscompletion_extras4 files · not checkedcontainers4 files · not checkedbatches3 files · not checkedimages3 files · not checkedsearch3 files · not checkedvideos3 files · not checkedchat_completions2 files · not checkedembeddings2 files · not checkedevals2 files · not checkedextraction2 files · not checkedmessages2 files · not checkedocr2 files · not checkedrerank_api2 files · not checkedskills2 files · not checkedsystemone2 files · not checked_redis1 file · not checkedfine_tuning1 file · not checkedrealtime_api1 file · not checkedrouter_strategy38 files · 100+ commitsrouter_utils37 files · 100+ commitsa2a_protocol29 files · 48 commitsharness18 files · 18 commitstracing15 files · 29 commitstelemetry9 files · 3 commitscompression8 files · 14 commitsgoogle_genai6 files · 32 commitsanthropic_interface5 files · 10 commitspassthrough4 files · not checkedsandbox3 files · not checked_v22 files · not checkedassistants2 files · not checkedendpoints2 files · not checkedproxy_auth2 files · not checked_lazy_imports1 file · not checked_lazy_imports_registry1 file · not checked_process_defaults1 file · not checked_redis_credential_provider1 file · not checked_service_logger1 file · not checked_version1 file · not checkedanthropic_beta_headers_manager1 file · not checkedbatch_completion1 file · not checkedbudget_manager1 file · not checked

66 modules, 195 links. A link means one module imports another; thicker lines mean more imports. Links come from 400 of 5,473 source files, so the real counts are higher. Select a module to trace it: blue lines go to what it uses, orange lines come from what uses it.

__init__13429–Shared core
constants1270–Foundation
_logging1223–Shared core
litellm_core_utils103160100+Foundation
types23990100+Foundation
caching2289100+Orchestrator
rust_bridge4975100+Shared core
secret_managers117540Shared core
responses25614100+Orchestrator
_internal_context160–Foundation
_uuid150–Foundation
repositories244190Shared core
integrations23337100+Orchestrator
vector_stores43530Orchestrator
decisions334–Orchestrator
cost_calculator130–Foundation
proxy99929100+Orchestrator
models222147Shared core
interactions142632Orchestrator
files42126Shared core
experimental_mcp_client323–Orchestrator
vector_store_files322–Shared core
llms108010100+Foundation
rag151939Orchestrator
completion_extras414–Orchestrator
containers414–Orchestrator
batches316–Orchestrator
images314–Orchestrator
search313–Orchestrator
videos312–Orchestrator
chat_completions212–Orchestrator
embeddings212–Orchestrator
evals212–Orchestrator
extraction213–Orchestrator
messages211–Shared core
ocr211–Shared core
rerank_api213–Orchestrator
skills212–Orchestrator
systemone212–Orchestrator
_redis113–Orchestrator
fine_tuning113–Orchestrator
realtime_api114–Orchestrator
router_strategy3802100+Entry or leaf
router_utils3706100+Entry or leaf
a2a_protocol290648Entry or leaf
harness180318Entry or leaf
tracing150129Entry or leaf
telemetry9003Standalone
compression80214Entry or leaf
google_genai60332Entry or leaf
anthropic_interface50010Standalone
passthrough403–Entry or leaf
sandbox300–Standalone
_v2202–Entry or leaf
assistants200–Standalone
endpoints203–Entry or leaf
proxy_auth200–Standalone
_lazy_imports100–Standalone
_lazy_imports_registry100–Standalone
_process_defaults100–Standalone
_redis_credential_provider100–Standalone
_service_logger100–Standalone
_version100–Standalone
anthropic_beta_headers_manager100–Standalone
batch_completion100–Standalone
budget_manager100–Standalone

Where to start reading

  1. Repository root
  2. Repository root
  3. Likely public API
  4. Likely public API
  5. Likely start-up file
  6. Likely start-up file
  7. Suggested starting pointAI
  8. Suggested starting pointAI

Find files for a task

AI

Add support for a new LLM provider

  • Create a new provider module under litellm/llms/ with format provider_name.py following the adapter pattern used by existing providers
  • Register the provider in the dispatcher by adding a conditional branch in dispatch.py to route requests to your provider

Add a new caching backend

  • Create a new cache class implementing the cache interface in litellm/caching/__init__.py

Add a new proxy authentication method

  • Create a new auth handler class implementing the base credentials interface
  • Wire the new auth handler into the proxy middleware stack in litellm/proxy/__init__.py

Add a new observability integration

  • Register the handler in litellm/telemetry/__init__.py to hook into request/response lifecycle events

Change the public API

Trace runtime behavior

Add or update tests

Change build or automation

RepoPilot lists up to 500 files, so a file missing here may still exist.

  • Files marked “likely” are guessed from their names.

Code quality and hotspots

Largest source files

  • Branch points93 per file on average
  • Code issues1 error, 22 warnings
  • Largest file4,988 lines
  • Hotspot load10 high-risk files

Static checks on the 15 largest source files.

Tests, CI and tooling

  • CICircleCI · GitHub Actions40 workflows
  • Tests6,805 test filesPytest · 1.2 test files per source file (file count, not coverage)
  • Dependency updatesCodeQL
  • CI pass rate84%last 50 runs

Test folders: helm/litellm-helm/tests · helm/litellm/tests · cookbook/litellm_router_load_test

Hotspots

Files that change often and branch heavily, highest first. Branch points count if, loop, case, catch, ternary, && and || in the file.