litellm/litellm/proxy
yuneng-jiang 7ac764970b
fix(proxy): return no rows when the aggregated activity entity filter is empty (#37414)
The aggregated daily-activity queries build their WHERE clause as raw SQL, and
an empty entity list rendered as `"team_id" IN ()`, which Postgres rejects with
`syntax error at or near ")"`. Callers reach that state normally: a caller
without admin view and no explicit team_ids has its scope resolved to the teams
it belongs to, so anyone belonging to no teams, an org admin for instance, sent
an empty list and got a 500 back from /team/daily/activity/aggregated.

The paginated endpoint hands the same empty list to Prisma, which renders
`in: []` and matches nothing, so it kept returning 200 with an empty result set.
Emit FALSE for the empty case so the raw-SQL path lands on the same answer,
mirroring what the api_key filter a few lines below already does.

The fix covers both aggregated queries at once because they share one WHERE
clause builder.
2026-08-18 19:37:32 -07:00
..
_experimental fix(mcp): serve token-forwarding servers when oauth discovery fails (#37399) 2026-08-19 01:32:41 +00:00
a2a chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
agent_endpoints fix(proxy): send SSE keepalives on assistants runs and A2A streams (#37368) 2026-08-18 16:22:05 -07:00
analytics_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
anthropic_endpoints fix(proxy): keep ProxyException status codes on /v1/messages instead of wrapping into 500 2026-08-17 12:21:12 -07:00
auth Merge branch 'litellm_internal_staging' into feature/bedrock-mantle-quota-project-itr1 2026-08-18 13:14:14 -07:00
batches_endpoints Merge pull request #37198 from BerriAI/litellm_lit5660_batches_limit_400 2026-08-17 15:53:46 -07:00
client feat(cli): make the hidden lite command list configurable (#36816) 2026-08-13 17:23:03 -07:00
common_utils fix(proxy): send SSE keepalives on assistants runs and A2A streams (#37368) 2026-08-18 16:22:05 -07:00
config_management_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
config_resolvers feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
container_endpoints fix(types): correct annotations that were false about their runtime values 2026-08-06 04:37:48 +00:00
credential_endpoints fix(proxy): return the real status code when a credential update is rejected (#36166) 2026-08-07 08:02:52 +00:00
custom_hooks feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
db chore(typing): drop 1.3k basedpyright errors across 30 Any hotspot files 2026-08-16 03:56:02 +00:00
discovery_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
enterprise_billing chore(lint): clear grandfathered over-limit lint drift and ratchet budgets down 2026-08-05 12:18:13 -07:00
example_config_yaml fix(lint): bring basedpyright rule counts back under their budget limits 2026-08-05 10:23:02 -07:00
fine_tuning_endpoints fix(proxy): authenticate managed ids before routing 2026-08-08 02:42:34 -07:00
google_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
guardrails Merge pull request #37387 from BerriAI/litellm_guardrail_usage_requeue 2026-08-18 16:42:06 -07:00
health_check_utils feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
health_endpoints fix(ui): treat router redis as configured for the no-redis banner 2026-08-11 02:40:14 +00:00
hooks Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_pr35110_itpm_otpm 2026-08-18 16:11:12 -07:00
image_endpoints fix: remove over-strict stream logging validator, restore base seam behavior 2026-08-11 08:22:57 -07:00
logging_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
management_endpoints fix(proxy): return no rows when the aggregated activity entity filter is empty (#37414) 2026-08-18 19:37:32 -07:00
management_helpers fix(access groups): sync assigned_team_ids from the team write paths (#36825) 2026-08-14 04:45:36 +00:00
memory chore(typing): remove 914 basedpyright Any errors across 16 hotspot files 2026-08-10 01:24:40 -07:00
middleware feat(proxy): add Amazon Comprehend Medical passthrough provider 2026-08-17 15:44:06 -07:00
ocr_endpoints fix(ocr): reject invalid req_format values as 400 on the SDK path 2026-08-17 15:49:18 -07:00
openai_evals_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
openai_files_endpoints Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_batch_cost_accounted_once 2026-08-15 15:56:11 -07:00
pass_through_endpoints feat(bedrock): add a config toggle to disable agent-runtime pass-through (#37386) 2026-08-18 17:05:40 -07:00
policy_engine fix(guardrails): scan text on /guardrails/apply_guardrail for Azure Content Safety (#36894) 2026-08-17 11:18:40 -07:00
prompts refactor: replace Any with precise types across responses, proxy, and llms modules 2026-08-13 03:59:26 -07:00
public_endpoints feat(ui): configure the auto router's heuristic scorer from the Admin UI (#37216) 2026-08-18 01:10:13 +00:00
rag_endpoints refactor: replace Any with precise types across responses, proxy, and llms modules 2026-08-13 03:59:26 -07:00
realtime_endpoints chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
rerank_endpoints fix: remove over-strict stream logging validator, restore base seam behavior 2026-08-11 08:22:57 -07:00
response_api_endpoints fix(responses_api): map bridged chat usage on guardrail-blocked replies 2026-08-14 17:04:27 -07:00
response_polling chore(typing): drop 1.3k basedpyright errors across 30 Any hotspot files 2026-08-16 03:56:02 +00:00
search_endpoints fix(proxy): stop resolving the UI session sentinel team on /search_tools/list 2026-08-05 23:22:11 -07:00
shutdown feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
spend_tracking Merge branch 'litellm_internal_staging' into feature/request-logs-user-id-filter 2026-08-17 13:01:19 -07:00
swagger
test_prompts
types_utils chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
ui_crud_endpoints fix(proxy): honor explicit null budget_duration on team and key create + clearable UI dropdowns (#36699) 2026-08-13 15:22:11 -07:00
vector_store_endpoints fix(vector_stores): classify write endpoints before reads on substring collisions 2026-08-14 16:53:48 -07:00
vector_store_files_endpoints fix(proxy): authenticate managed ids before routing 2026-08-08 02:42:34 -07:00
vertex_ai_endpoints chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom 2026-08-05 02:37:24 -07:00
video_endpoints feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
workflows feat(proxy): durable agent workflow run tracking via /v1/workflows/runs (#26793) 2026-04-29 17:12:18 -07:00
.gitignore
__init__.py
_lazy_features.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
_lazy_openapi_snapshot.json chore(guardrails): sync lazy OpenAPI snapshot and dashboard types for usage units 2026-08-17 16:43:58 -07:00
_lazy_openapi_snapshot.py feat(proxy): add GET /v1/indexes to list vector store indexes (#36289) 2026-08-10 15:09:59 -07:00
_logging.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
_new_new_secret_config.yaml Revert "chore: remove _experimental/out (#31546)" 2026-07-01 13:25:47 -07:00
_new_secret_config.yaml Revert "chore: remove _experimental/out (#31546)" 2026-07-01 13:25:47 -07:00
_super_secret_config.yaml Revert "chore: remove _experimental/out (#31546)" 2026-07-01 13:25:47 -07:00
_types.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_pr35110_itpm_otpm 2026-08-18 16:11:12 -07:00
cached_logo.jpg
caching_routes.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
common_request_processing.py Merge pull request #37362 from BerriAI/litellm_lit_5651_bedrock_guardrail_cost 2026-08-18 15:27:43 -07:00
compliance_checks.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_auth_auto.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
custom_prompt_management.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_sso.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
custom_validate.py
dd_span_tagger.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
dev_config.yaml Revert "chore(ci): sync litellm_internal_staging into daily OSS branch (#33337)" (#33339) 2026-07-14 19:32:25 -07:00
enterprise
health_check.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
lambda.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
litellm_pre_call_utils.py fix(guardrails): bill all chunks on mid-chunking block, strip client guardrail cost metadata, add cost map schema keys 2026-08-18 14:52:23 -07:00
llamaguard_prompt.txt
logo.jpg
mcp_registry.json fix(mcp): use official Google Drive streamable HTTP MCP server (#34322) 2026-07-22 23:41:51 +00:00
mcp_tools.py refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets 2026-08-01 15:43:29 -07:00
model_config.yaml
openapi.json
openapi_registry.json fix(mcp): add Google Sheets, Drive, Calendar, and Docs to the OpenAPI registry 2026-07-20 19:02:00 -07:00
plugin_routes.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
post_call_rules.py ci(lint): add blanket-noqa, dataclass-default, and unused-noqa Ruff rules (#30516) 2026-06-16 12:07:22 -07:00
prisma_migration.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
prometheus_cleanup.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
proxy_cli.py feat(proxy): let USE_V2_MIGRATION_RESOLVER select the v2 migration resolver 2026-08-07 22:18:59 -07:00
proxy_config.yaml
proxy_server.py fix(proxy): send SSE keepalives on assistants runs and A2A streams (#37368) 2026-08-18 16:22:05 -07:00
read_model_list.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00
README.md build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
route_llm_request.py fix(proxy): return 400 naming the missing required param on POST /v1/batches 2026-08-17 11:55:06 -07:00
schema.prisma perf(guardrails): aggregate usage units in one sorted pass 2026-08-17 17:19:05 -07:00
start.sh
utils.py Merge pull request #26900 from BerriAI/litellm_model-deprecation-alerts-55bc 2026-08-17 18:15:20 -07:00
wildcard_config.yaml feat: add dev and wildcard proxy configs for local testing (#30556) 2026-06-17 06:47:11 -07:00

litellm-proxy

A local, fast, and lightweight OpenAI-compatible server to call 100+ LLM APIs.

usage

$ uv tool 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