litellm-mirror/litellm/proxy
Ishaan Jaff d3c2f4331a
(UI - View SpendLogs Table) (#7842)
* litellm log messages / responses

* add messages/response to schema.prisma

* add support for logging messages / responses in DB

* test_spend_logs_payload_with_prompts_enabled

* _get_messages_for_spend_logs_payload

* ui_view_spend_logs endpoint

* add tanstack and moment

* add uiSpendLogsCall

* ui view logs table

* ui view spendLogs table

* ui_view_spend_logs

* fix code quality

* test_spend_logs_payload_with_prompts_enabled

* _get_messages_for_spend_logs_payload

* test_spend_logs_payload_with_prompts_enabled

* test_spend_logs_payload_with_prompts_enabled

* ui view spend logs

* minor ui fix

* ui - update leftnav

* ui - clean up ui

* fix leftnav

* ui fix navbar

* ui fix moving chat ui tab
2025-01-17 18:53:45 -08:00
..
_experimental Litellm dev 01 11 2025 p3 (#7702) 2025-01-11 20:06:54 -08:00
analytics_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
auth test: initial test to enforce all functions in user_api_key_auth.py h… (#7797) 2025-01-15 21:52:45 -08:00
batches_endpoints (Feat) add `"/v1/batches/{batch_id:path}/cancel" endpoint (#7406) 2024-12-24 20:23:50 -08:00
common_utils fix http parsing utils (#7753) 2025-01-13 19:58:26 -08:00
config_management_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
db use asyncio tasks for logging db metrics (#7663) 2025-01-09 19:59:32 -08:00
example_config_yaml Litellm dev 12 25 2024 p3 (#7421) 2024-12-25 18:54:24 -08:00
fine_tuning_endpoints (Feat) - new endpoint GET /v1/fine_tuning/jobs/{fine_tuning_job_id:path} (#7427) 2024-12-27 17:01:14 -08:00
guardrails (fix) BaseAWSLLM - cache IAM role credentials when used (#7775) 2025-01-14 20:16:22 -08:00
health_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
hooks Litellm dev 01 13 2025 p2 (#7758) 2025-01-14 17:04:01 -08:00
management_endpoints fix(key_management_endpoints.py): fix default allowed team member roles (#7843) 2025-01-17 17:15:22 -08:00
management_helpers (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
openai_files_endpoints (feat) /batches Add support for using /batches endpoints in OAI format (#7402) 2024-12-24 16:58:05 -08:00
pass_through_endpoints test: initial commit enforcing testing on all anthropic pass through … (#7794) 2025-01-15 22:02:35 -08:00
rerank_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
spend_tracking (UI - View SpendLogs Table) (#7842) 2025-01-17 18:53:45 -08:00
ui_crud_endpoints (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
vertex_ai_endpoints Litellm dev 12 24 2024 p2 (#7400) 2024-12-24 20:33:41 -08:00
.gitignore
__init__.py
_logging.py fix(_logging.py): fix timestamp format for json logs 2024-06-20 15:20:21 -07:00
_new_secret_config.yaml test: initial test to enforce all functions in user_api_key_auth.py h… (#7797) 2025-01-15 21:52:45 -08:00
_super_secret_config.yaml docs(enterprise.md): cleanup docs 2024-07-15 14:52:08 -07:00
_types.py (UI - View SpendLogs Table) (#7842) 2025-01-17 18:53:45 -08:00
cached_logo.jpg (feat) use hosted images for custom branding 2024-02-22 14:51:40 -08:00
caching_routes.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
custom_sso.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
enterprise
health_check.py (fix) health check - allow setting health_check_model (#7752) 2025-01-13 20:16:44 -08:00
lambda.py
litellm_pre_call_utils.py (proxy perf improvement) - remove redundant .copy() operation (#7564) 2025-01-06 20:36:47 -08:00
llamaguard_prompt.txt
logo.jpg (feat) admin ui custom branding 2024-02-21 17:34:42 -08: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
post_call_rules.py
prisma_migration.py Litellm expose disable schema update flag (#6085) 2024-10-05 21:26:51 -04:00
proxy_cli.py uvicorn allow setting num workers (#7681) 2025-01-10 19:03:14 -08:00
proxy_config.yaml (UI - View SpendLogs Table) (#7842) 2025-01-17 18:53:45 -08:00
proxy_server.py (Fix + Testing) - Add dd-trace-run to litellm ci/cd pipeline + fix bug caused by dd-trace patching OpenAI sdk (#7820) 2025-01-16 22:03:09 -08:00
README.md [Feat-Proxy] Allow using custom sso handler (#5809) 2024-09-20 19:14:33 -07:00
route_llm_request.py (code quality) run ruff rule to ban unused imports (#7313) 2024-12-19 12:33:42 -08:00
schema.prisma (UI - View SpendLogs Table) (#7842) 2025-01-17 18:53:45 -08:00
start.sh
utils.py fix proxy pre call hook - only use if user is using alerting (#7683) 2025-01-10 19:07:05 -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