litellm-mirror/litellm_proxy
2025-04-23 14:48:13 -07:00
..
_experimental refactor location of proxy 2025-04-23 14:38:44 -07:00
analytics_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
anthropic_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
auth refactor location of proxy 2025-04-23 14:38:44 -07:00
batches_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
common_utils refactor location of proxy 2025-04-23 14:38:44 -07:00
config_management_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
credential_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
db refactor location of proxy 2025-04-23 14:38:44 -07:00
example_config_yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
fine_tuning_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
guardrails refactor location of proxy 2025-04-23 14:38:44 -07:00
health_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
hooks refactor location of proxy 2025-04-23 14:38:44 -07:00
management_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
management_helpers refactor location of proxy 2025-04-23 14:38:44 -07:00
middleware refactor location of proxy 2025-04-23 14:38:44 -07:00
openai_files_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
pass_through_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
rerank_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
response_api_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
spend_tracking refactor location of proxy 2025-04-23 14:38:44 -07:00
swagger refactor location of proxy 2025-04-23 14:38:44 -07:00
types_utils refactor location of proxy 2025-04-23 14:38:44 -07:00
ui_crud_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
vertex_ai_endpoints refactor location of proxy 2025-04-23 14:38:44 -07:00
__init__.py refactor location of proxy 2025-04-23 14:38:44 -07:00
_logging.py refactor location of proxy 2025-04-23 14:38:44 -07:00
_new_new_secret_config.yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
_new_secret_config.yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
_super_secret_config.yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
_types.py refactor location of proxy 2025-04-23 14:38:44 -07:00
cached_logo.jpg refactor location of proxy 2025-04-23 14:38:44 -07:00
caching_routes.py refactor location of proxy 2025-04-23 14:38:44 -07:00
common_request_processing.py refactor location of proxy 2025-04-23 14:38:44 -07:00
custom_prompt_management.py refactor location of proxy 2025-04-23 14:38:44 -07:00
custom_sso.py refactor location of proxy 2025-04-23 14:38:44 -07:00
custom_validate.py refactor location of proxy 2025-04-23 14:38:44 -07:00
enterprise refactor location of proxy 2025-04-23 14:38:44 -07:00
health_check.py refactor location of proxy 2025-04-23 14:38:44 -07:00
lambda.py refactor location of proxy 2025-04-23 14:38:44 -07:00
litellm_pre_call_utils.py refactor location of proxy 2025-04-23 14:38:44 -07:00
llamaguard_prompt.txt refactor location of proxy 2025-04-23 14:38:44 -07:00
logo.jpg refactor location of proxy 2025-04-23 14:38:44 -07:00
mcp_tools.py refactor location of proxy 2025-04-23 14:38:44 -07:00
model_config.yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
openapi.json refactor location of proxy 2025-04-23 14:38:44 -07:00
post_call_rules.py refactor location of proxy 2025-04-23 14:38:44 -07:00
prisma_migration.py refactor location of proxy 2025-04-23 14:38:44 -07:00
proxy_cli.py refactor location of proxy 2025-04-23 14:38:44 -07:00
proxy_config.yaml refactor location of proxy 2025-04-23 14:38:44 -07:00
proxy_server.py fix import path 2025-04-23 14:48:13 -07:00
README.md refactor location of proxy 2025-04-23 14:38:44 -07:00
route_llm_request.py refactor location of proxy 2025-04-23 14:38:44 -07:00
schema.prisma refactor location of proxy 2025-04-23 14:38:44 -07:00
start.sh refactor location of proxy 2025-04-23 14:38:44 -07:00
utils.py refactor location of proxy 2025-04-23 14:38:44 -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