litellm/litellm/proxy
Krish Dholakia 7056d9984e
Custom Code Guardrails UI Playground (#20377)
* feat(guardrails/): allow custom code execution for guardrails

first step in allowing teams to submit custom code for guardrails

* feat: custom_code_guardrail.md

support passing custom code for guardrails

* feat: initial commit adding ui for custom code guardrails

allows users to write guardrails based on custom code

* feat: expose new test custom code guardrail endpoint

allows ui testing playground to sanity check if guardrail is working as expected

* fix: fix linting errors

* fix: fix max recursion check

* fix: fix linting error
2026-02-03 19:57:24 -08:00
..
_experimental Custom Code Guardrails UI Playground (#20377) 2026-02-03 19:57:24 -08:00
agent_endpoints [Feat] Use A2A registered agents with /chat/completions (#20362) 2026-02-03 15:25:38 -08:00
analytics_endpoints
anthropic_endpoints [Feat] UI - Allow Adding Claude Code Plugins (#19387) 2026-01-19 19:08:59 -08:00
auth Merge pull request #20386 from naaa760/fix/extra-head-chat-comp-brid 2026-02-04 09:11:43 +05:30
batches_endpoints fix(proxy): resolve 'multiple values for keyword argument' in batch cancel and file retrieve 2026-01-31 21:26:29 +00:00
client Fix team cli auth flow (#19666) 2026-01-28 08:52:52 -08:00
common_utils fix transform_retrieve_file_response 2026-01-31 11:16:22 -08:00
config_management_endpoints
container_endpoints
credential_endpoints
custom_hooks
db Revert "Fix/prisma schema permission (#19391)" 2026-01-21 17:19:32 +05:30
discovery_endpoints Add in-product nudge for claude code feedback survey + new learning centre (#19303) 2026-01-17 20:05:20 -08:00
example_config_yaml test_chat_completion_low_budget 2026-01-31 16:18:54 -08:00
fine_tuning_endpoints
google_endpoints fix(proxy): handle agent parameter in /interactions endpoint (#19866) 2026-01-27 09:34:58 -08:00
guardrails Custom Code Guardrails UI Playground (#20377) 2026-02-03 19:57:24 -08:00
health_check_utils
health_endpoints Fix health endpoints 2026-01-31 12:25:04 -08:00
hooks [Feat] - MCP Semantic Filtering Support (#20296) 2026-02-02 18:28:53 -08:00
image_endpoints Fix: stability image optional para 2026-01-19 09:05:52 +05:30
management_endpoints Merge pull request #20386 from naaa760/fix/extra-head-chat-comp-brid 2026-02-04 09:11:43 +05:30
management_helpers
middleware
ocr_endpoints
openai_files_endpoints fix: delete_file 2026-01-31 16:29:31 -08:00
pass_through_endpoints _prepare_vertex_auth_headers 2026-01-31 12:36:53 -08:00
policy_engine fix linting 2026-01-23 13:46:02 -08:00
prompts fix(prompts): fix prompt info lookup and delete using correct IDs (#19358) 2026-01-20 12:28:34 -08:00
public_endpoints fixing lint 2026-01-16 18:14:33 -08:00
rag_endpoints [Feat] LiteLLM Vector Stores - Add permission management for users, teams (#19972) 2026-01-28 18:55:40 -08:00
rerank_endpoints
response_api_endpoints Add native_background_mode to override polling_via_cache for specific models 2026-01-27 15:54:46 -08:00
response_polling Add native_background_mode to override polling_via_cache for specific models 2026-01-27 15:54:46 -08:00
search_endpoints [Feat] - Search API add /list endpoint to list what search tools exist in router (#19969) 2026-01-28 17:58:17 -08:00
spend_tracking Add error_message search in spend logs endpoint 2026-01-28 15:06:31 -08:00
swagger
test_prompts
types_utils
ui_crud_endpoints team mapping 2026-01-30 21:06:03 -08:00
vector_store_endpoints fix: stabilize CI tests - routes and bedrock config 2026-01-31 14:41:02 -08:00
vector_store_files_endpoints
vertex_ai_endpoints
video_endpoints Revert "Litellm staging 01 15 2026" 2026-01-17 06:31:34 +09:00
__init__.py
_logging.py
_new_new_secret_config.yaml
_new_secret_config.yaml Custom Code Guardrails UI Playground (#20377) 2026-02-03 19:57:24 -08:00
_super_secret_config.yaml
_types.py Merge pull request #20386 from naaa760/fix/extra-head-chat-comp-brid 2026-02-04 09:11:43 +05:30
.gitignore
cached_logo.jpg update image and bounded logo in navbar 2026-01-30 16:35:24 -08:00
caching_routes.py
common_request_processing.py Revert "Merge pull request #18790 from BerriAI/litellm_key_team_routing_3" 2026-01-31 17:58:46 -08:00
custom_auth_auto.py
custom_prompt_management.py
custom_sso.py
custom_validate.py
enterprise
health_check.py
lambda.py
litellm_pre_call_utils.py Revert "fix: models loadbalancing billing issue by filter (#18891) (#19220)" 2026-02-03 15:00:57 +05:30
llamaguard_prompt.txt
logo.jpg
mcp_tools.py
model_config.yaml
openapi.json
post_call_rules.py
prisma_migration.py Revert "Fix/prisma schema permission (#19391)" 2026-01-21 17:19:32 +05:30
proxy_cli.py Fix: log duplication when json_logs is enabled (#19705) 2026-01-24 11:09:04 -08:00
proxy_config.yaml [Feat] - MCP Semantic Filtering Support (#20296) 2026-02-02 18:28:53 -08:00
proxy_server.py [Feat] Use A2A registered agents with /chat/completions (#20362) 2026-02-03 15:25:38 -08:00
README.md
route_llm_request.py [Feat] Use A2A registered agents with /chat/completions (#20362) 2026-02-03 15:25:38 -08:00
schema.prisma Merge pull request #20337 from BerriAI/main 2026-02-03 17:08:01 +05:30
start.sh
utils.py fix: proxy failure cases, now log ip and user agent, key hash, name (#20145) 2026-02-02 19:26:50 -08:00

litellm-proxy

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

usage

$ pip 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