litellm/litellm/proxy
Krish Dholakia ff68cbda8e
Fix azure dall e 3 call with custom model name + Handle Bearer $LITELLM_API_KEY in x-litellm-api-key custom header (#10776)
* fix(main.py): use base model instead of user model if given

Fixes https://github.com/BerriAI/litellm/issues/10760

* feat(azure/image_generation/__init__.py): make azure image gen check more robust

Fixes https://github.com/BerriAI/litellm/issues/10760

* fix(user_api_key_auth.py): support bearer token auth for `x-litellm-api-key` header

Fixes earlier regression on vertex ai passthrough auth

* fix(user_api_key_auth.py): refactor get api key into separate function

enables easier testing

* fix: cleanup

* fix: fix linting error

* fix: cleanup

* test: update tests
2025-05-12 22:49:35 -07:00
..
_experimental Fix azure dall e 3 call with custom model name + Handle Bearer $LITELLM_API_KEY in x-litellm-api-key custom header (#10776) 2025-05-12 22:49:35 -07:00
analytics_endpoints
anthropic_endpoints get_custom_headers 2025-03-12 18:57:41 -07:00
auth Fix azure dall e 3 call with custom model name + Handle Bearer $LITELLM_API_KEY in x-litellm-api-key custom header (#10776) 2025-05-12 22:49:35 -07:00
batches_endpoints Litellm Unified File ID output file id support (#10713) 2025-05-10 11:02:09 -07:00
client Add --version flag to litellm-proxy CLI (#10704) 2025-05-09 18:58:37 -07:00
common_utils Schedule budget resets at expectable times (#10331) (#10333) 2025-04-29 20:59:44 -07:00
config_management_endpoints
credential_endpoints fix: fix linting error 2025-03-14 14:17:28 -07:00
db [Reliability fix] Redis transaction buffer - ensure all redis queues are periodically flushed (#10393) 2025-04-28 21:36:54 -07:00
example_config_yaml add spend tracking config.yaml 2025-03-31 19:42:00 -07:00
fine_tuning_endpoints use correct get custom headers 2025-03-12 17:16:51 -07:00
guardrails [Feat] Bedrock Guardrails - Add support for PII Masking with bedrock guardrails (#10642) 2025-05-07 18:30:57 -07:00
health_endpoints [Feat] v2 Custom Logger API Endpoints (#10575) 2025-05-05 16:57:55 -07:00
hooks fix(router.py): write file to all deployments (#10708) 2025-05-10 00:08:30 -07:00
management_endpoints fix: fix update_db_model (#10726) 2025-05-10 14:28:37 -07:00
management_helpers [Team Member permissions] - Fixes (#9945) 2025-04-12 11:17:51 -07:00
middleware PrometheusAuthMiddleware 2025-04-04 20:37:53 -07:00
openai_files_endpoints Litellm Unified File ID output file id support (#10713) 2025-05-10 11:02:09 -07:00
pass_through_endpoints [Feat] Pass through endpoints - ensure PassthroughStandardLoggingPayload is logged and contains method, url, request/response body (#10194) 2025-04-21 19:46:22 -07:00
rerank_endpoints use correct get custom headers 2025-03-12 17:16:51 -07:00
response_api_endpoints [Feat] Add GET, DELETE Responses endpoints on LiteLLM Proxy (#10297) 2025-04-24 17:34:26 -07:00
spend_tracking Revert "Filter logs on status and model (#10670)" 2025-05-10 09:07:49 -07:00
swagger feat: add offline swagger docs (#7653) 2025-04-06 13:55:06 -07:00
types_utils test fix post call rules (#9826) 2025-04-08 13:55:37 -07:00
ui_crud_endpoints [Feat - UI] - Allow setting Default Team setting when LiteLLM SSO auto creates teams (#9918) 2025-04-11 14:07:10 -07:00
vertex_ai_endpoints build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
__init__.py
_logging.py
_new_new_secret_config.yaml
_new_secret_config.yaml complete unified batch id support - replace model in jsonl to be deployment model name (#10719) 2025-05-10 12:04:01 -07:00
_super_secret_config.yaml
_types.py [Refactor - Filtering Spend Logs] Add status to root of SpendLogs table (#10661) 2025-05-08 11:29:25 -07:00
.gitignore
cached_logo.jpg
caching_routes.py fix(cost_calculator.py): handle custom pricing at deployment level fo… (#9855) 2025-04-09 22:13:10 -07:00
common_request_processing.py Litellm Unified File ID output file id support (#10713) 2025-05-10 11:02:09 -07:00
custom_prompt_management.py [UI] Allow setting prompt cache_control_injection_points (#10000) 2025-04-14 21:17:42 -07:00
custom_sso.py
custom_validate.py build: merge commit 1b15568af7f8923a014e6e49f5ec09e5abf5f981 2025-02-17 21:56:00 -08:00
enterprise
health_check.py fix endpoint_data 2025-03-14 17:21:01 -07:00
lambda.py
litellm_pre_call_utils.py fix(router.py): write file to all deployments (#10708) 2025-05-10 00:08:30 -07:00
llamaguard_prompt.txt
logo.jpg
mcp_tools.py example mcp tools 2025-03-20 17:53:20 -07:00
model_config.yaml
openapi.json
post_call_rules.py
prisma_migration.py build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
proxy_cli.py install prisma migration files - connects litellm proxy to litellm's prisma migration files (#9637) 2025-03-29 15:27:09 -07:00
proxy_config.yaml [Docs] Email notifs (#10733) 2025-05-10 17:24:18 -07:00
proxy_server.py [Docs] Using LiteLLM with vector stores / knowledge bases (#10534) 2025-05-03 11:28:33 -07:00
README.md
route_llm_request.py [Feat] Add GET, DELETE Responses endpoints on LiteLLM Proxy (#10297) 2025-04-24 17:34:26 -07:00
schema.prisma [DB] Add index for session_id on LiteLLM_SpendLogs (#10727) 2025-05-10 14:28:20 -07:00
start.sh
utils.py Litellm emails smtp fixes (#10730) 2025-05-10 17:23:59 -07: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