litellm/litellm/proxy
yucheng-berri c2e06890ad
fix: tighten role-based visibility of config and MCP fields (#30587)
* fix: redact config and MCP secrets in read-only admin views

GET /config/field/info and the MCP server list/detail endpoints returned
secret-bearing fields to any caller with an admin view, including
read-only admins. They now return those fields in full only to a full
PROXY_ADMIN; every other caller gets the reduced, non-admin view, while
non-sensitive fields remain readable. Regression tests cover the
role-based visibility on both endpoints, including that a full admin
still sees everything needed to populate the edit form.

* fix: redact nested secrets in config field info for non-admins

/config/field/info returned structured general_settings fields verbatim to
any admin-view caller, so a view-only admin reading database_args received
the nested aws_web_identity_token (a DynamoDB role-assumption credential) in
plaintext. Recurse into dict/list field values and redact secret leaves for
non-PROXY_ADMIN callers, leaving non-secret siblings and full-admin reads
unchanged

* fix: redact secret config values in /config/list for non-admins

/config/list shared the same _user_has_admin_view gate as /config/field/info
but returned each field value unredacted, so a view-only admin reading the
list received pass_through_endpoints upstream Authorization headers verbatim.
Route every general_settings value through a shared role-aware redactor
(extracted from /config/field/info) covering the top-level and nested field
paths, so non-PROXY_ADMIN callers get secret-bearing fields redacted while
full-admin reads stay unchanged

* chore(ci): allowlist _redact_secret_values_in_obj in recursive_detector

The config secret redactor recurses over JsonValue, which is acyclic, and
its depth is bounded by the operator-authored general_settings schema. Add
it to the recursive_detector ignore list alongside the other bounded
nested-redaction helpers (mask_dict, _redact_sensitive_litellm_params)

* proxy: cap recursive secret redaction depth at 10

Match the cap on _redact_sensitive_litellm_params (the closest analog
in the proxy, also recursive, key-name driven, returns a sentinel).

The previous justification — bounded by operator-authored schema depth,
JsonValue acyclic — is true today but is a property of the threat model,
not an enforced invariant of the function. If a code path is ever added
that pipes external input into general_settings (config import,
migration tooling, JWT-driven settings, …) the assumption silently
breaks. A local cap makes the invariant local.

The cap branch fails closed: at _REDACT_SECRET_MAX_DEPTH the whole
subtree is replaced with 'REDACTED' rather than returned verbatim. A
future refactor that flips this to fail-open would let a deeply nested
credential leak; the new regression test test_redact_secret_values_in_obj_fails_closed_at_max_depth
guards against that.

Updates the recursive_detector ignore-list rationale to point at the
numeric cap rather than the structural argument.

* test: actually exercise the depth cap in fails-closed test

The previous fixture stored the leaf under the secret-named key
'aws_web_identity_token', which the recursor's key-name short-circuit
redacts regardless of the cap — so the test passed both with and
without the cap in place. Empirically confirmed: under an uncapped
mutant the old fixture still hides the secret (key-name catches it),
the new fixture leaks it (only the cap can stop it). Swap the leaf
key to a non-secret name so the cap is the only redaction path
exercised, making the test fail on mutation as advertised.
2026-06-23 15:25:30 -07:00
..
_experimental feat(mcp): add resolve_credentials dispatch skeleton (#31056) 2026-06-23 09:11:49 -07:00
a2a feat(a2a): well-known agent-card discovery + LangGraph Platform mode (#28860) 2026-05-29 20:50:42 -07:00
agent_endpoints chore(lint): remove PLR0915 too-many-statements ruff rule (#30574) 2026-06-16 16:52:49 -07:00
analytics_endpoints fix(spend): session-TZ-independent date filtering for spend/error log queries 2026-04-10 17:04:52 -07:00
anthropic_endpoints chore: litellm oss 170626 (#30637) 2026-06-17 21:11:12 -07:00
auth chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
batches_endpoints chore(lint): remove PLR0915 too-many-statements ruff rule (#30574) 2026-06-16 16:52:49 -07:00
client feat(cli): per-agent lite claude / codex / opencode commands that wrap coding agents through the proxy (#29850) 2026-06-10 13:52:26 -07:00
common_utils feat(sandbox): code interpreter interceptor on the Responses API (#30905) 2026-06-20 21:12:13 -07:00
config_management_endpoints build(deps-dev): bump black to 26.3.1 and apply formatting (#28525) 2026-05-21 17:24:18 -07:00
container_endpoints feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
credential_endpoints feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
custom_hooks style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
db chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
discovery_endpoints ci: drop mypy entirely, standardize type checking on basedpyright (#30648) 2026-06-17 09:42:00 -07:00
example_config_yaml feat(sandbox): code interpreter interceptor on the Responses API (#30905) 2026-06-20 21:12:13 -07:00
fine_tuning_endpoints style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
google_endpoints ci: drop mypy entirely, standardize type checking on basedpyright (#30648) 2026-06-17 09:42:00 -07:00
guardrails chore: litellm oss staging (#30745) 2026-06-18 13:55:35 -07:00
health_check_utils feat(proxy): skip disable_background_health_check models on GET /health when flag set (#27716) 2026-05-13 09:49:05 -07:00
health_endpoints chore(lint): remove PLR0915 too-many-statements ruff rule (#30574) 2026-06-16 16:52:49 -07:00
hooks chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
image_endpoints fix(proxy): extend response headers hook to streaming, TTS, image gen, and pass-through (#24232) 2026-06-09 22:10:23 +02:00
management_endpoints fix: tighten role-based visibility of config and MCP fields (#30587) 2026-06-23 15:25:30 -07:00
management_helpers feat(mcp): scope a key to zero MCP servers with no-mcp-servers sentinel (#31029) 2026-06-22 17:08:28 -07:00
memory feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
middleware feat(proxy): configurable response headers and login-page hint (#30792) 2026-06-18 18:12:45 -07:00
ocr_endpoints Litellm oss staging 04 21 2026 2 (#26569) 2026-05-20 21:25:19 -07:00
openai_evals_endpoints style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
openai_files_endpoints chore: litellm oss staging (#30745) 2026-06-18 13:55:35 -07:00
pass_through_endpoints fix(passthrough,streaming): recover cost on interrupted and agentic Anthropic streams (#31035) 2026-06-22 18:51:13 -07:00
policy_engine fix(guardrails): run pre_call hook once for model-level guardrails (#30543) 2026-06-16 11:17:03 -07:00
prompts feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
public_endpoints feat(ui): add Amazon Bedrock Mantle to the Add Model provider dropdown (#31034) 2026-06-22 17:31:25 -07:00
rag_endpoints feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
realtime_endpoints chore: litellm oss 170626 (#30637) 2026-06-17 21:11:12 -07:00
rerank_endpoints
response_api_endpoints Litellm websocket improvements (#29563) 2026-06-03 11:48:35 -07:00
response_polling chore(lint): remove PLR0915 too-many-statements ruff rule (#30574) 2026-06-16 16:52:49 -07:00
search_endpoints fix(proxy): self-heal startup/reload prisma reads on engine disconnect (#28803) 2026-06-10 20:16:58 +02:00
shutdown feat(proxy): native /health/drain preStop hook for graceful shutdown (#29439) 2026-06-02 16:30:44 -07:00
spend_tracking fix(proxy): record partial spend on the failure row for interrupted streams (#30788) 2026-06-19 12:03:15 -07:00
swagger
test_prompts
types_utils fix(types_utils): drop opt-in env from remote-module runtime gate 2026-05-13 02:52:14 +00:00
ui_crud_endpoints chore: remove in-product survey and Claude Code feedback nudges (#30773) 2026-06-18 15:51:30 -07:00
vector_store_endpoints feat(litellm): add models and repository layers (#29686) 2026-06-06 20:59:33 -07:00
vector_store_files_endpoints Title: fix(proxy): resolve vector store file list credentials from team deployments (#29739) 2026-06-06 12:36:05 -07:00
vertex_ai_endpoints build(deps-dev): bump black to 26.3.1 and apply formatting (#28525) 2026-05-21 17:24:18 -07:00
video_endpoints [Staging] - Ishaan March 17th (#23903) 2026-03-18 15:09:01 -07:00
workflows feat(proxy): durable agent workflow run tracking via /v1/workflows/runs (#26793) 2026-04-29 17:12:18 -07:00
.gitignore
__init__.py
_lazy_features.py feat(a2a): well-known agent-card discovery + LangGraph Platform mode (#28860) 2026-05-29 20:50:42 -07:00
_lazy_openapi_snapshot.json Litellm oss staging 1 (#28337) 2026-05-20 17:27:03 -07:00
_lazy_openapi_snapshot.py [Fix] Proxy: Repair Stale HTTP_METHODS Reference In Lazy OpenAPI Snapshot 2026-05-01 15:11:56 -07:00
_logging.py
_new_new_secret_config.yaml
_new_secret_config.yaml Litellm krrish staging 04 20 2026 (#26138) 2026-04-20 16:22:12 -07:00
_super_secret_config.yaml
_types.py chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
cached_logo.jpg
caching_routes.py Litellm oss staging 040626 (#29671) 2026-06-04 11:07:20 -07:00
common_request_processing.py chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
compliance_checks.py
custom_auth_auto.py
custom_prompt_management.py
custom_sso.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
custom_validate.py
dd_span_tagger.py style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
dev_config.yaml feat: add dev and wildcard proxy configs for local testing (#30556) 2026-06-17 06:47:11 -07:00
enterprise
health_check.py chore: litellm oss staging (#30745) 2026-06-18 13:55:35 -07:00
lambda.py
litellm_pre_call_utils.py fix: prevent key-level metadata.tags from leaking into Bedrock passthrough body (#30985) 2026-06-22 14:28:47 -07:00
llamaguard_prompt.txt
logo.jpg
mcp_registry.json fix(mcp): default Linear MCP registry entry to streamable HTTP (#30396) 2026-06-13 14:45:47 -07:00
mcp_tools.py
model_config.yaml
openapi.json
openapi_registry.json feat(ui): OpenAPI MCP server support with popular API quick-picker (#23200) 2026-03-10 13:59:52 -07:00
plugin_routes.py feat: litellm plugin architecture v2 (#30688) 2026-06-20 20:37:22 -07:00
post_call_rules.py ci(lint): add blanket-noqa, dataclass-default, and unused-noqa Ruff rules (#30516) 2026-06-16 12:07:22 -07:00
prisma_migration.py
prometheus_cleanup.py
proxy_cli.py chore: litellm oss staging (#30968) 2026-06-23 07:31:44 -07:00
proxy_config.yaml
proxy_server.py fix: tighten role-based visibility of config and MCP fields (#30587) 2026-06-23 15:25:30 -07:00
README.md build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
route_llm_request.py chore(lint): remove PLR0915 too-many-statements ruff rule (#30574) 2026-06-16 16:52:49 -07:00
schema.prisma feat(mcp): per-server env vars with global + per-user scopes (#28917) 2026-06-05 20:15:11 -07:00
start.sh
utils.py fix(proxy): serialize team budget_limits to JSON in jsonify_team_object (#31045) 2026-06-22 19:10:34 -07:00
wildcard_config.yaml feat: add dev and wildcard proxy configs for local testing (#30556) 2026-06-17 06:47:11 -07:00

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