litellm/litellm/proxy
tin-berri 1af7a403c6
feat(mcp): start the named server's OAuth directly for a resource-scoped gateway flow (#39933)
An aggregate gateway DCR authorize whose RFC 8707 resource resolves to exactly one
gateway-managed oauth2 server sealed that server into the flow and then sent the browser to
the generic connect grid anyway, so the user had to find the server the client had already
named and click Connect.

The connect URL now carries only the flow handle. GET /authorize/flow classifies the sealed
flow as unscoped, interactive, M2M, or stale, and returns the matching state to the page.
Interactive flows require a live per-user vendor credential before minting and do not burn the
flow on an early submit. M2M flows use the gateway's configured service credential and finish
without an interactive OAuth trip. Stale flows fail closed instead of becoming unscoped.
The existing explicit Finish action and a new Cancel path preserve deliberate user intent.
2026-09-07 23:40:02 -07:00
..
_experimental feat(mcp): start the named server's OAuth directly for a resource-scoped gateway flow (#39933) 2026-09-07 23:40:02 -07:00
a2a refactor(typing): replace Any with proven types in 65 backend files 2026-09-02 09:11:36 +00:00
agent_endpoints feat(skills): semantic search over the LiteLLM-hosted skill registry (#39401) 2026-09-07 12:28:38 -07:00
analytics_endpoints feat(ui): add error-code drilldown for failed requests on caching page 2026-08-24 15:45:45 -07:00
anthropic_endpoints feat(skills): semantic search over the LiteLLM-hosted skill registry (#39401) 2026-09-07 12:28:38 -07:00
auth fix(proxy): log budget reservation notice once at config load (#40167) 2026-09-07 18:18:28 -07:00
batches_endpoints fix(batches): register ownership for every batch create path (#39810) 2026-09-04 23:59:51 -07:00
client Merge pull request #36841 from BerriAI/litellm_lite_pi 2026-09-05 17:14:11 -07:00
common_utils fix(mcp): encrypt stored static headers and stdio environment (#40164) 2026-09-07 16:03:06 -07:00
config_management_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
config_resolvers feat(alerting): add native Microsoft Teams alerting destination (#38367) 2026-08-27 16:19:22 -07:00
container_endpoints chore: merge origin/litellm_internal_staging into litellm_decrease_anys_opus5_r4 2026-09-04 18:59:35 -07:00
credential_endpoints Merge branch 'litellm_internal_staging' into fix-credential-endpoints-raise-not-return 2026-09-03 05:36:50 -07:00
custom_hooks feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
db feat(ui): itemize auto-router classification spend (#40168) 2026-09-07 16:29:19 -07:00
discovery_endpoints feat(auth): enforce configurable password policy and SSO-only login (#39381) 2026-09-02 14:28:13 -07:00
enterprise_billing chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
example_config_yaml fix(search): harden bing_grounding auth, result cap, status, and cost 2026-08-24 12:26:07 -07:00
fine_tuning_endpoints fix(proxy): authenticate managed ids before routing 2026-08-08 02:42:34 -07:00
google_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
guardrails fix(guardrails): accept on_violation block and alert for mcp_security (#40155) 2026-09-07 14:33:02 -07:00
health_check_utils refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
health_endpoints fix(health): probe test_connection with the credential the request names (#39801) 2026-09-04 14:18:41 -07:00
hooks merge: bring litellm_internal_staging into litellm_fix_agent_mcp_grants 2026-09-07 16:35:40 -07:00
image_endpoints fix(proxy): parse numeric multipart fields on /v1/images/edits back into numbers 2026-09-03 00:22:54 -07:00
list_api feat: page the public model hub table off /public/v1/model_hub, keeping every filter (#39691) 2026-09-03 22:36:16 -07:00
logging_endpoints fix(usage): recover aliases for v1.99 double-hashed spend keys 2026-09-03 14:21:25 +00:00
management_endpoints feat(ui): itemize auto-router classification spend (#40168) 2026-09-07 16:29:19 -07:00
management_helpers fix(proxy): reject ambiguous name or alias keys in mcp_tool_permissions on write (#39947) 2026-09-05 14:22:26 -07:00
memory feat(proxy): add a search param to key, memory, audit, and spend log listings 2026-09-03 15:20:13 -07:00
middleware feat(proxy): resolve root_path per request from a configured prefix list (SERVER_ROOT_PATHS) (#35935) 2026-09-07 11:54:59 -07:00
ocr_endpoints fix(ocr): reject invalid req_format values as 400 on the SDK path 2026-08-17 15:49:18 -07:00
openai_evals_endpoints refactor(typing): replace Any with proven types in 65 backend files 2026-09-02 09:11:36 +00:00
openai_files_endpoints fix(batches): account a batch's cost once, from the first retrieve that sees it final 2026-09-05 16:35:32 -07:00
pass_through_endpoints fix(bedrock): keep x-amzn-RequestId on chat error responses (#40089) 2026-09-07 17:16:47 -07:00
policy_engine refactor(typing): replace Any with proven types in 65 backend files 2026-09-02 09:11:36 +00:00
prompts Merge pull request #38440 from BerriAI/litellm_prompt_registry_env 2026-09-03 14:09:26 -07:00
public_endpoints feat(ui): list the ChatGPT subscription provider in the Add Model form 2026-09-07 14:55:43 -07:00
rag_endpoints fix(proxy): emit SSE keepalives on queue, rag, azure passthrough, usage chat and policy enrich streams (#39273) 2026-09-03 18:23:37 -07:00
realtime_endpoints refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
rerank_endpoints fix(rerank): emit latency and cost headers on /rerank (#35419) 2026-08-25 15:54:25 -07:00
response_api_endpoints refactor(types): replace Any with precise types across 73 modules 2026-09-01 11:05:02 +00:00
response_polling refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
search_endpoints Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_decrease_anys_opus5 2026-08-29 06:03:33 -07:00
shutdown feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
spend_tracking fix(spend): compare auto-router targets by deployment identity (#40206) 2026-09-07 23:29:42 -07:00
swagger
test_prompts
types_utils chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
ui_crud_endpoints feat(mcp): semantic tool search for the native MCP Gateway (#39404) 2026-09-02 15:09:44 -07:00
vector_store_endpoints fix(proxy): let authorized internal users open vector store details (#40150) 2026-09-07 13:10:09 -07:00
vector_store_files_endpoints feat(proxy): enforce vector-store upload security controls on /v1/rag/ingest 2026-08-24 12:41:15 -07:00
vertex_ai_endpoints chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
video_endpoints refactor(types): replace Any with precise types across 73 modules 2026-09-01 11:05:02 +00:00
workflows
.gitignore
__init__.py Revert "perf: lazy-load SDK symbols so import litellm stays under 60 MB RSS (…" 2026-09-05 16:07:09 -07:00
_lazy_features.py feat(proxy): resolve root_path per request from a configured prefix list (SERVER_ROOT_PATHS) (#35935) 2026-09-07 11:54:59 -07:00
_lazy_openapi_snapshot.json feat(mcp): start the named server's OAuth directly for a resource-scoped gateway flow (#39933) 2026-09-07 23:40:02 -07:00
_lazy_openapi_snapshot.py chore(techdebt): type new signatures and drop slop comments from the last 24h 2026-08-28 07:59:32 +00:00
_logging.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
_new_new_secret_config.yaml
_new_secret_config.yaml
_super_secret_config.yaml
_types.py fix(proxy): log budget reservation notice once at config load (#40167) 2026-09-07 18:18:28 -07:00
cached_logo.jpg
caching_routes.py refactor(typing): replace Any with proven types in 89 more backend files 2026-09-02 23:08:42 +00:00
common_request_processing.py fix(bedrock): keep x-amzn-RequestId on chat error responses (#40089) 2026-09-07 17:16:47 -07:00
compliance_checks.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_auth_auto.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
custom_prompt_management.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_sso.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_validate.py
dd_span_tagger.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
dev_config.yaml
enterprise
health_check.py feat(health): opt-in model-group allowlist for background health checks and health-check routing (#38539) 2026-08-27 12:25:56 -07:00
lambda.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
litellm_pre_call_utils.py fix: skip one-shot Claude Code cache injection (#40175) 2026-09-07 18:03:43 -07:00
llamaguard_prompt.txt
logo.jpg
logo_dark.png feat(ui): serve a dark-mode variant of the LiteLLM logo (#37656) 2026-08-20 11:26:10 -07:00
mcp_registry.json
mcp_tools.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
model_config.yaml
openapi.json
openapi_registry.json
plugin_routes.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
post_call_rules.py
prisma_migration.py fix(proxy): keep a failed prisma generate from failing the migration entrypoint (#37947) 2026-08-22 11:45:19 -07:00
prometheus_cleanup.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
prometheus_metrics_server.py feat(proxy): serve Prometheus /metrics from a separate process via --prometheus_metrics_port (#39889) 2026-09-05 13:26:09 -07:00
proxy_cli.py feat(proxy): serve Prometheus /metrics from a separate process via --prometheus_metrics_port (#39889) 2026-09-05 13:26:09 -07:00
proxy_config.yaml
proxy_server.py fix(proxy): log budget reservation notice once at config load (#40167) 2026-09-07 18:18:28 -07:00
read_model_list.py fix(proxy): initialize the secret manager before resolving os.environ config references (#37544) 2026-08-19 17:00:26 -07:00
README.md
route_llm_request.py refactor(types): replace Any with precise types across 73 modules 2026-09-01 11:05:02 +00:00
schema.prisma feat(ui): itemize auto-router classification spend (#40168) 2026-09-07 16:29:19 -07:00
start.sh
utils.py feat(proxy): resolve root_path per request from a configured prefix list (SERVER_ROOT_PATHS) (#35935) 2026-09-07 11:54:59 -07:00
wildcard_config.yaml

litellm-proxy

A local, fast, and lightweight OpenAI-compatible server to call 100+ LLM APIs.

usage

$ uv tool install litellm
$ litellm --model ollama/codellama 

#INFO: Ollama running on http://0.0.0.0:8000

replace openai base

import openai # openai v1.0.0+
client = openai.OpenAI(api_key="anything",base_url="http://0.0.0.0:8000") # set proxy to base_url
# request sent to model set on litellm proxy, `litellm --model`
response = client.chat.completions.create(model="gpt-3.5-turbo", messages = [
    {
        "role": "user",
        "content": "this is a test request, write a short poem"
    }
])

print(response)

See how to call Huggingface,Bedrock,TogetherAI,Anthropic, etc.


Folder Structure

Routes

  • proxy_server.py - all openai-compatible routes - /v1/chat/completion, /v1/embedding + model info routes - /v1/models, /v1/model/info, /v1/model_group_info routes.
  • health_endpoints/ - /health, /health/liveliness, /health/readiness
  • management_endpoints/key_management_endpoints.py - all /key/* routes
  • management_endpoints/team_endpoints.py - all /team/* routes
  • management_endpoints/internal_user_endpoints.py - all /user/* routes
  • management_endpoints/ui_sso.py - all /sso/* routes