litellm/litellm/proxy
Krish Dholakia 26fd6d5362
Guardrails API - support LLM tool call response checks on /chat/completions, /v1/responses, /v1/messages on regular + streaming calls (#17619)
* fix(unified_guardrails.py): send all chunks on completion of final stream

* feat(generic_guardrail_api.py): handle tool call response on streaming LLM responses

* fix(anthropic/chat/guardrail_translation): initial commit adding anthropic tool response streaming guardrails

enables guardrail checks on tool response from llm's to work via `/v1/messages`

* feat(anthropic/): working guardrail checks on tool response from LLMs

ensures guardrail checks on anthropic /v1/messages works as expected

* feat(responses/guardrail_translation): support tool call response guardrails on streaming for /v1/responses

ensures complete coverage of tool call responses

* refactor(openai.py): refactor to use consistent pydantic model for responses api tool response on streaming

enables non-openai model tool call response to work correctly with guardrail checks on /v1/responses

* test: update tests

* fix: fix linting error

* fix: fix failing tests

* fix: fix import errors

* fix(openai/chat/guardrail_transformation): fix final chunk returned on streaming
2025-12-15 18:19:52 +05:30
..
_experimental fix: add MCP auth header propagation 2025-12-15 07:45:35 +09:00
agent_endpoints Merge pull request #17781 from BerriAI/litellm_daily_agent_table 2025-12-11 15:01:50 -08:00
analytics_endpoints fix(sql): Optimize SpendLogs queries to use timestamp filtering for index usage (#17504) 2025-12-04 21:52:57 -08:00
anthropic_endpoints [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
auth [Feat] JWT Auth - auth allow selecting team_id from request header (#17884) 2025-12-12 10:18:20 -08:00
batches_endpoints
client add a new feature fix to expose the team alias when authenticating th… (#17725) 2025-12-10 10:10:28 -08:00
common_utils [feat]: Add opt-in evidence results for Pillar Security guardrail during monitoring (#17812) 2025-12-12 04:09:13 -08:00
config_management_endpoints
container_endpoints [Feat] Containers API - add new container API file management + UI Interface (#17745) 2025-12-09 17:33:26 -08:00
credential_endpoints Change credential encryption to only affect db credentials 2025-12-09 13:36:40 -08:00
custom_hooks
db Merge pull request #16764 from BerriAI/litellm_tag_spend_dedupe 2025-12-11 15:20:16 -08:00
discovery_endpoints
example_config_yaml
fine_tuning_endpoints
google_endpoints Support model names with slashes on Gemini endpoints (#17743) 2025-12-09 18:40:51 -08:00
guardrails Guardrails API - support LLM tool call response checks on /chat/completions, /v1/responses, /v1/messages on regular + streaming calls (#17619) 2025-12-15 18:19:52 +05:30
health_check_utils
health_endpoints Revert "Add license metadata to health/readiness endpoint. (#15997)" 2025-12-05 19:31:30 -08:00
hooks Merge pull request #17707 from raghav-stripe/raghav-fix-responsesapi-rl 2025-12-11 08:57:16 +05:30
image_endpoints
management_endpoints Merge pull request #16764 from BerriAI/litellm_tag_spend_dedupe 2025-12-11 15:20:16 -08:00
management_helpers
middleware
ocr_endpoints
openai_files_endpoints [Fix] CI/CD - mypy & check_code_and_doc_quality & mcp_testing (#17920) 2025-12-13 08:18:43 -08:00
pass_through_endpoints Guardrails API - support LLM tool call response checks on /chat/completions, /v1/responses, /v1/messages on regular + streaming calls (#17619) 2025-12-15 18:19:52 +05:30
prompts
public_endpoints [Fixes] A2a Gateway - ensure azure foundry agents work (#17943) 2025-12-13 16:08:03 -08:00
rag_endpoints
rerank_endpoints
response_api_endpoints [QA] Cursor Integration x LiteLLM (#17855) 2025-12-13 12:49:45 -08:00
response_polling Fix lint and mypy error for response api polling 2025-12-08 20:42:23 +05:30
search_endpoints
spend_tracking [Fix] CI/CD – Docs & Spend logs (#17843) 2025-12-11 14:00:33 -08:00
swagger
test_prompts
types_utils
ui_crud_endpoints Merge pull request #17668 from BerriAI/litellm_sso_config_2 2025-12-11 15:17:33 -08:00
vector_store_endpoints
vector_store_files_endpoints
vertex_ai_endpoints Move query params to create_pass_through_route call (#17660) 2025-12-08 12:57:49 -08:00
video_endpoints Fix : use litellm params for other video apis 2025-12-09 23:03:29 +05:30
__init__.py
_logging.py
_new_new_secret_config.yaml
_new_secret_config.yaml Guardrails API - support LLM tool call response checks on /chat/completions, /v1/responses, /v1/messages on regular + streaming calls (#17619) 2025-12-15 18:19:52 +05:30
_super_secret_config.yaml
_types.py Merge pull request #17940 from BerriAI/litellm_ui_mcp_headers 2025-12-13 15:20:55 -08:00
.gitignore
cached_logo.jpg
caching_routes.py
common_request_processing.py Fix x-litellm-key-spend update 2025-12-12 11:44:51 +05:30
custom_auth_auto.py
custom_prompt_management.py [Fix] CI/CD - mypy & check_code_and_doc_quality & mcp_testing (#17920) 2025-12-13 08:18:43 -08:00
custom_sso.py
custom_validate.py
enterprise
health_check.py
lambda.py
litellm_pre_call_utils.py
llamaguard_prompt.txt
logo.jpg
mcp_tools.py
model_config.yaml
openapi.json
post_call_rules.py
prisma_migration.py
proxy_cli.py
proxy_config.yaml [Feat] Agent Gateway - allow adding langgraph, bedrock agent core agents (#17802) 2025-12-10 19:13:50 -08:00
proxy_server.py Update proxy_server.py (#17468) 2025-12-12 04:34:43 -08:00
README.md
route_llm_request.py Merge pull request #17732 from BerriAI/litellm_videos_bugs_2 2025-12-10 07:49:55 +05:30
schema.prisma fix: add storage_backend and storage_url columns to schema.prisma files (#17936) 2025-12-13 13:28:34 -08:00
start.sh
utils.py Prompt Management - new API for integrating providers (#17829) 2025-12-11 15:43:40 -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