litellm-mirror/litellm/proxy
Krish Dholakia 6dda1ba6dd
LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725)
* Add date picker to usage tab + Add reasoning_content token tracking across all providers on streaming (#9722)

* feat(new_usage.tsx): add date picker for new usage tab

allow user to look back on their usage data

* feat(anthropic/chat/transformation.py): report reasoning tokens in completion token details

allows usage tracking on how many reasoning tokens are actually being used

* feat(streaming_chunk_builder.py): return reasoning_tokens in anthropic/openai streaming response

allows tracking reasoning_token usage across providers

* Fix update team metadata + fix bulk adding models on Ui  (#9721)

* fix(handle_add_model_submit.tsx): fix bulk adding models

* fix(team_info.tsx): fix team metadata update

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

* (v0) Unified file id - allow calling multiple providers with same file id (#9718)

* feat(files_endpoints.py): initial commit adding 'target_model_names' support

allow developer to specify all the models they want to call with the file

* feat(files_endpoints.py): return unified files endpoint

* test(test_files_endpoints.py): add validation test - if invalid purpose submitted

* feat: more updates

* feat: initial working commit of unified file id translation

* fix: additional fixes

* fix(router.py): remove model replace logic in jsonl on acreate_file

enables file upload to work for chat completion requests as well

* fix(files_endpoints.py): remove whitespace around model name

* fix(azure/handler.py): return acreate_file with correct response type

* fix: fix linting errors

* test: fix mock test to run on github actions

* fix: fix ruff errors

* fix: fix file too large error

* fix(utils.py): remove redundant var

* test: modify test to work on github actions

* test: update tests

* test: more debug logs to understand ci/cd issue

* test: fix test for respx

* test: skip mock respx test

fails on ci/cd - not clear why

* fix: fix ruff check

* fix: fix test

* fix(model_connection_test.tsx): fix linting error

* test: update unit tests
2025-04-03 11:48:52 -07:00
..
_experimental fix(model_management_endpoints.py): fix allowing team admins to update team models (#9697) 2025-04-01 22:28:15 -07:00
analytics_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
anthropic_endpoints get_custom_headers 2025-03-12 18:57:41 -07:00
auth Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
batches_endpoints use correct get custom headers 2025-03-12 17:16:51 -07:00
common_utils fix(proxy_server.py): Fix "Circular reference detected" error when max_parallel_requests = 0 (#9671) 2025-03-31 22:06:02 -07:00
config_management_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
credential_endpoints fix: fix linting error 2025-03-14 14:17:28 -07:00
db test pod lock manager 2025-04-02 14:39:40 -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 Virtual key based policies in Aim Guardrails (#9499) 2025-04-01 21:57:23 -07:00
health_endpoints allow proxy to startup on DB unavailable 2025-03-26 19:50:57 -07:00
hooks LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725) 2025-04-03 11:48:52 -07:00
management_endpoints Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
management_helpers build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
openai_files_endpoints LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725) 2025-04-03 11:48:52 -07:00
pass_through_endpoints Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
rerank_endpoints use correct get custom headers 2025-03-12 17:16:51 -07:00
response_api_endpoints Add stubbed routes to pass initial auth tests 2025-03-13 16:43:25 -07:00
spend_tracking Merge pull request #9642 from BerriAI/litellm_mcp_improvements_expose_sse_urls 2025-03-29 19:37:57 -07:00
types_utils build: merge commit 1b15568af7 2025-02-17 21:56:00 -08:00
ui_crud_endpoints fix settings endpoints code qa 2025-03-17 21:32:05 -07:00
vertex_ai_endpoints build(pyproject.toml): add new dev dependencies - for type checking (#9631) 2025-03-29 11:02:13 -07:00
.gitignore fix(gitmodules): remapping to new proxy 2023-10-12 21:23:53 -07:00
__init__.py refactor: add black formatting 2023-12-25 14:11:20 +05:30
_logging.py fix(_logging.py): fix timestamp format for json logs 2024-06-20 15:20:21 -07:00
_new_new_secret_config.yaml Ollama ssl verify = False + Spend Logs reliability fixes (#7931) 2025-01-23 23:05:41 -08:00
_new_secret_config.yaml LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725) 2025-04-03 11:48:52 -07:00
_super_secret_config.yaml docs(enterprise.md): cleanup docs 2024-07-15 14:52:08 -07:00
_types.py LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725) 2025-04-03 11:48:52 -07:00
cached_logo.jpg Litellm dev 01 23 2025 p2 (#7962) 2025-01-23 21:02:15 -08:00
caching_routes.py (Bug fix) - Cache Health not working when configured with prometheus service logger (#8687) 2025-02-20 13:41:56 -08:00
common_request_processing.py fix(proxy_server.py): Fix "Circular reference detected" error when max_parallel_requests = 0 (#9671) 2025-03-31 22:06:02 -07:00
custom_prompt_management.py example X42PromptManagement 2025-03-19 16:24:41 -07:00
custom_sso.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
custom_validate.py build: merge commit 1b15568af7 2025-02-17 21:56:00 -08:00
enterprise feat(llama_guard.py): add llama guard support for content moderation + new async_moderation_hook endpoint 2024-02-17 19:13:04 -08:00
health_check.py fix endpoint_data 2025-03-14 17:21:01 -07:00
lambda.py Add mangum. 2023-11-23 00:04:47 -05:00
litellm_pre_call_utils.py fix check_if_token_is_service_account 2025-04-01 07:36:35 -07:00
llamaguard_prompt.txt feat(llama_guard.py): allow user to define custom unsafe content categories 2024-02-17 17:42:47 -08:00
logo.jpg (feat) admin ui custom branding 2024-02-21 17:34:42 -08:00
mcp_tools.py example mcp tools 2025-03-20 17:53:20 -07:00
model_config.yaml Revert "Revert "(feat) Allow using include to include external YAML files in a config.yaml (#6922)"" 2024-11-27 16:08:59 -08:00
openapi.json (feat) add swagger.json for litellm proxy 2023-10-13 20:41:04 -07:00
post_call_rules.py (docs) add example post call rules to proxy 2024-01-15 20:58:50 -08:00
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 fix pod lock manager 2025-04-02 14:52:55 -07:00
proxy_server.py Squashed commit of the following: (#9709) 2025-04-02 21:24:54 -07:00
README.md [Feat-Proxy] Allow using custom sso handler (#5809) 2024-09-20 19:14:33 -07:00
route_llm_request.py undo changes to route llm request 2025-03-14 21:05:51 -07:00
schema.prisma UI (new_usage.tsx): Report 'total_tokens' + report success/failure calls (#9675) 2025-03-31 22:48:43 -07:00
start.sh fix(factory.py): fixing llama-2 non-chat models prompt templating 2023-11-07 21:33:54 -08:00
utils.py LiteLLM Minor Fixes & Improvements (04/02/2025) (#9725) 2025-04-03 11:48:52 -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