Commit graph

34538 commits

Author SHA1 Message Date
Yuneng Jiang
f476c66b3a
chore: fixes
Some checks failed
Unit Tests: Caching (Redis) / caching-redis (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
2026-04-05 00:37:08 -07:00
Harshit28j
8bcbd4a7af Merge upstream/main into litellm_fix_ci_failures
Resolves merge conflicts from 121 commits of upstream drift. Took
upstream/main versions for all 6 conflicted files:
- litellm/a2a_protocol/main.py
- litellm/batches/main.py
- litellm/llms/openrouter/image_edit/transformation.py
- litellm/proxy/guardrails/guardrail_hooks/azure/prompt_shield.py
- litellm/proxy/guardrails/guardrail_hooks/azure/text_moderation.py
- litellm/proxy/management_endpoints/cost_tracking_settings.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 20:55:51 +05:30
Harshit28j
161f5e3f2f fix(mypy): resolve 11 type errors across 8 files
- llms/openai/openai.py + llms/azure/batches/handler.py: add type: ignore[arg-type] for FileExpiresAfter vs OutputExpiresAfter SDK mismatch
- batches/main.py: add type: ignore for dict[str, Any] -> FileExpiresAfter assignment
- llms/openrouter/image_edit/transformation.py: cast value to str before passing to typed methods
- proxy/db/db_transaction_queue/spend_log_cleanup.py: add type: ignore[assignment] for bool | None -> bool
- proxy/management_endpoints/cost_tracking_settings.py: cast base_model to str to match return type
- proxy/guardrails/guardrail_hooks/azure/{text_moderation,prompt_shield}.py: add type: ignore[misc] for TypedDict ** expansion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 20:47:27 +05:30
Harshit28j
612066a623 fix(ci): fix lint, schema, test, and migration issues for release
- Fix PLR0915 lint: extract _create_a2a_client_with_headers and _set_message_context_id helpers in a2a_protocol/main.py to reduce statement count below 50
- Fix JSON schema: add supports_none_reasoning_effort and supports_xhigh_reasoning_effort to test_utils.py schema definition
- Fix gpt-5.1 temperature test: change temperature=0.6 to temperature=1 (gpt-5.1 supports any temperature only when reasoning_effort='none'; temperature=1 is always valid)
- Add Prisma migration for LiteLLM_AgentsTable static_headers/extra_headers columns
- Sync litellm/proxy/schema.prisma with root schema.prisma

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 20:27:25 +05:30
Harshit28j
9a4fd61e46 fix(ci): fix all remaining test failures for release
Anthropic structured output:
- Fix $ref resolution and additionalProperties for Anthropic output_format
- Fixes test_json_response_pydantic_obj, test_json_response_nested_*,
  test_tool_call_and_json_response_format, test_completion_thinking_with_response_format

Test fixes:
- test_validate_environment_raises_without_key: clear env vars with monkeypatch
- test_stream_chunk_builder_openai_audio_output_usage: fix exception handling
  and use resilient field-level assertions
- test_streamable_http_mcp_handler_mock: add missing auth context patches
- test_transcription_on_router: reset file position between API calls
- test_metadata_passed_to_custom_callback_codex_models: add try/finally cleanup
- Update test docstring to reference MidStreamFallbackError

Infrastructure:
- Sync proxy-extras schema.prisma with litellm/proxy/schema.prisma
- Switch Docker build_from_pip from Alpine to Debian slim (polars needs glibc)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 19:52:05 +05:30
Harshit28j
f26db6ee76 fix(ci): use litellm 1.82.0 in docker build (1.82.1 not on PyPI)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 18:41:50 +05:30
Sameer Kankute
8b0375f99c
Merge pull request #22888 from BerriAI/litellm_a2a-custom-headers
[Feat] Add a2a custom headers
2026-03-06 18:24:21 +05:30
Sameer Kankute
447b760a83
Merge pull request #22964 from BerriAI/litellm_claude-code-byok
feat(proxy): Client-side provider API key precedence for Anthropic /v1/messages (BYOK)
2026-03-06 18:23:48 +05:30
Sameer Kankute
e9d797bd8d fix(proxy): do not forward Authorization header to LLM provider when used for LiteLLM proxy auth
When forward_llm_provider_auth_headers=true, Authorization: Bearer <litellm-key> was
being forwarded to Anthropic if it looked like an OAuth key, causing auth failures.

Now checked against authenticated_with_header: if Authorization was used to authenticate
with the proxy, it is always stripped before forwarding to the LLM provider.

Made-with: Cursor
2026-03-06 18:20:48 +05:30
Sameer Kankute
159c477c18 feat(proxy): client-side provider API key precedence for Anthropic /v1/messages
- Add forward_llm_provider_auth_headers support from litellm_settings
- When enabled, client x-api-key takes precedence over deployment keys
- Forward x-api-key when x-litellm-api-key or Authorization used for auth
- Fix duplicate patch lines in test_byok_oauth_endpoints.py
- Add Claude Code BYOK documentation with /login and ANTHROPIC_CUSTOM_HEADERS
- Add unit tests for clean_headers x-api-key forwarding logic
- Sync model_prices backup (pre-commit hook)

Made-with: Cursor
2026-03-06 18:20:46 +05:30
Sameer Kankute
118cad8b54
Merge pull request #22957 from BerriAI/litellm_azure-model-router-cost-tracking
feat(azure_ai): add router flat cost when response contains actual model
2026-03-06 18:18:51 +05:30
Sameer Kankute
c23eb5afc6 feat(azure_ai): add router flat cost when response contains actual model
- Pass request_model to Azure AI cost calculator to detect router requests
- Add router flat cost ($0.14/M input tokens) even when Azure returns actual model in response
- Add test for router flat cost with response containing actual model
- Update docs with cost calculation flow and configuration requirements

Made-with: Cursor
2026-03-06 18:18:06 +05:30
Sameer Kankute
0d699d06f1
Merge pull request #22953 from BerriAI/litellm_gpt5_reasoning_model_map
feat(gpt-5): Add supports_none_reasoning_effort and supports_xhigh_reasoning_effort to model cost map
2026-03-06 18:16:29 +05:30
Sameer Kankute
6ba2e9f10f feat(gpt-5): add supports_none_reasoning_effort and supports_xhigh_reasoning_effort to model cost map
- Shift from hardcoded model checks to dynamic lookup via _supports_factory
- Add supports_none_reasoning_effort for gpt-5.1/5.2/5.4 chat variants
- Add supports_xhigh_reasoning_effort for gpt-5.1-codex-max, gpt-5.2, gpt-5.4+
- Update model_prices_and_context_window.json and backup
- Add ProviderSpecificModelInfo types for new fields
- Fix Azure: use _supports_reasoning_effort_level instead of removed is_model_gpt_5_1_model

Made-with: Cursor
2026-03-06 18:15:32 +05:30
yuneng-jiang
8523bb6b48
Merge pull request #22956 from BerriAI/litellm_key_null_duration
[Fix] Key Expiry Default Duration
2026-03-05 21:06:55 -08:00
yuneng-jiang
e468b0278f [Fix] Key Expiry Default Duration - support null to never expire
Support passing duration=null on /key/update to reset a key's expiry to never expires, alongside the existing "-1" magic string (kept for backward compat).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 20:54:30 -08:00
yuneng-jiang
99c4f3cbea
Merge pull request #22938 from BerriAI/litellm_fix_team_usage_spend
[Fix] Team Usage Spend Truncated Due to Pagination
2026-03-05 20:45:27 -08:00
Daniel Yudelevich
8b2dd4f65a
fix(pricing): add supports_web_search for OpenAI gpt-5.1/5.2/5.3 models (#22934)
OpenAI gpt-5.1, gpt-5.2, and gpt-5.3 chat models all support the
`web_search_options` parameter, but the model cost registry was missing
the `supports_web_search` flag. Only `gpt-5.2-pro` had it set.

Models updated:
- gpt-5.1, gpt-5.1-2025-11-13, gpt-5.1-chat-latest
- gpt-5.2, gpt-5.2-2025-12-11, gpt-5.2-chat-latest
- gpt-5.3-chat-latest
2026-03-05 20:38:27 -08:00
Sameer Kankute
ad59aa02bb
Merge pull request #22954 from BerriAI/litellm_gpt-5-4-pro-model-map
feat(openai): add gpt-5.4-pro to model map
2026-03-06 09:53:45 +05:30
Sameer Kankute
050503469a feat(openai): add gpt-5.4-pro to model map
- Add gpt-5.4-pro and gpt-5.4-pro-2026-03-05 snapshot
- Input: $30/1M tokens, Output: $180/1M tokens
- 1.05M context window, 128K max output tokens
- Priority pricing for >272K input tokens (2x input, 1.5x output)
- Supports reasoning.effort: medium, high, xhigh
- Responses API, Chat Completions, Batch endpoints

Made-with: Cursor
2026-03-06 09:52:56 +05:30
Harshit28j
aa2b9d97e2 fix(ci): sync root schema.prisma + fix MyPy type error
- Copy litellm/proxy/schema.prisma to root schema.prisma so the
  migration test reads the correct schema with BYOK fields
- Fix MyPy arg-type error in SearchAPI transformation (str cast)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:51:49 +05:30
Harshit28j
5a1578b1de fix(ci): fix remaining CI failures - migration, lint, tests
- Create Prisma migration for BYOK MCP fields, MCPUserCredentials,
  JWTKeyMapping models, and re-add spec_path column
- Fix syntax error in test_byok_oauth_endpoints.py (duplicate line)
- Remove unused get_user_credential import (Ruff F401)
- Extract _resolve_byok_auth helper to fix PLR0915 (too many statements)
- Add BYOK mock fields to MCP server tests (Pydantic validation)
- Fix JWT handler test by initializing litellm_jwtauth on jwt_handler

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:39:14 +05:30
Ishaan Jaff
83e237bac2
fix(chat): fix /ui/chat routing, Suspense boundary, serverRootPath support (#22945)
* fix(chat): fix router.push paths to use /ui/chat with serverRootPath support

* fix(chat): wrap chat page in Suspense boundary for Next.js static export

* fix(chat): fix clipboard writeText rejection handler - remove undefined message.error call

* feat(chat): rebuild UI with routing fixes

* fix(chat): use useTheme logoUrl + /get_image fallback for sidebar logo

* feat(chat): rebuild UI with logo fix

* fix(chat): use /get_image directly for logo (no ThemeProvider outside dashboard layout)

* feat(chat): add multi-model comparison and provider logos in chat UI

- Replace single model selector with multi-select (up to 3 models)
- Show provider logos next to model names in dropdown (openai, anthropic, gemini, mistral, groq, etc.)
- Selected models float to the top of the dropdown list
- Multi-model mode: responses stream in parallel side-by-side cards below each user message
- Multi-turn: each follow-up message carries full per-model history as context
- Surface API errors inline in response cards instead of silently swallowing them
- Rebuild UI
2026-03-05 20:00:25 -08:00
Sameer Kankute
bc481f49d3
Merge pull request #22895 from BerriAI/litellm_o-series-generalize-detection
fix(o-series): generalize is_model_o_series_model to match any o+digit prefix
2026-03-06 09:14:57 +05:30
Sameer Kankute
91a8937705
Merge pull request #22750 from BerriAI/litellm_mcp_doc_update
[Chore] update mcp documentation for header forwarding
2026-03-06 09:14:48 +05:30
Sameer Kankute
20ec949cf1
Merge pull request #22734 from vincentkoc/vincentkoc-code/chatgpt-53-oauth-models
feat(models): add ChatGPT 5.3/5.4 aliases + OpenAI gpt-5.4-pro
2026-03-06 08:59:12 +05:30
Sameer Kankute
57596cab1a
Merge pull request #22920 from Varad2001/litellm_gemini_3.1_reasoning_effort
fix(gemini): handle 'minimal' reasoning_effort param for gemini-3.1-f…
2026-03-06 08:55:57 +05:30
Sameer Kankute
31c43ba187
Merge pull request #22948 from BerriAI/litellm_vertex-paygo-docs
docs: add PayGo/priority cost tracking for Gemini Vertex AI
2026-03-06 08:37:39 +05:30
Sameer Kankute
baa5d7262d docs: add PayGo/priority cost tracking for Gemini Vertex AI
- Add PayGo / Priority Cost Tracking section to Vertex AI provider docs
- Document trafficType to service_tier mapping (ON_DEMAND_PRIORITY, FLEX, etc.)
- Add service tier cost keys to custom pricing docs
- Add provider-specific cost tracking note to spend tracking overview

Made-with: Cursor
2026-03-06 08:36:31 +05:30
Ishaan Jaff
ec600aa70a
feat(ui): add Chat UI — ChatGPT-like interface with MCP tools and streaming (#22937)
* feat(ui): add chat message and conversation types

* feat(ui): add useChatHistory hook for localStorage-backed conversations

* feat(ui): add ConversationList sidebar component

* feat(ui): add MCPConnectPicker for attaching MCP servers to chat

* feat(ui): add ModelSelector dropdown for chat

* feat(ui): add ChatInputBar with MCP tool attachment support

* feat(ui): add MCPAppsPanel with list/detail view for MCP servers

* feat(ui): add ChatMessages component; remove auto-scrollIntoView that caused scroll-lock bypass

* feat(ui): add ChatPage — ChatGPT-like UI with scroll lock, MCP tools, streaming

* feat(ui): add /chat route wired to ChatPage

* feat(ui): remove chat from leftnav — chat accessible via navbar button

* feat(ui): add Chat button to top navbar

* feat(ui): add dismissible Chat UI announcement banner to Playground page

* feat(proxy): add Chat UI link to Swagger description

* feat(ui): add react-markdown and syntax-highlighter deps for chat UI

* fix(ui): replace missing BorderOutlined import with inline stop icon div

* fix(ui): apply remark-gfm plugin to ReactMarkdown for GFM support

* fix(ui): remove unused isEvenRow variable in MCPAppsPanel

* fix(ui): add ellipsis when truncating conversation title

* fix(ui): wire search button to chats view; remove non-functional keyboard hint

* fix(ui): use serverRootPath in navbar chat link for sub-path deployments

* fix(ui): remove unused ChatInputBar and ModelSelector files

* fix(ui): correct grid bottom-border condition for odd server count

* fix(chat): move localStorage writes out of setConversations updater (React purity)

* fix(chat): fix stale closure in handleEditAndResend - compute history before async state update

* fix(chat): fix 4 issues in ChatMessages - array redaction, clipboard error, inline detection, remove unused ref
2026-03-05 18:13:04 -08:00
ryan-crabbe
bc23c08d03
Merge pull request #22940 from BerriAI/litellm_fix_admin_viewer_org_list
Fix admin viewer unable to see all organizations
2026-03-05 17:49:57 -08:00
Ryan Crabbe
8d539db108 Fix admin viewer unable to see all organizations
The /organization/list endpoint only checked for PROXY_ADMIN role,
causing PROXY_ADMIN_VIEW_ONLY users to fall into the else branch
which restricts results to orgs the user is a member of. Use the
existing _user_has_admin_view() helper to include both roles.
2026-03-05 17:36:46 -08:00
yuneng-jiang
d0e480414c Fix team usage spend showing lower than expected values
The /team/daily/activity endpoint used Prisma pagination (page_size=1000)
but the UI only fetched page 1. Teams with many keys/models easily exceed
1000 rows in LiteLLM_DailyTeamSpend, causing truncated totals.

Switches the endpoint to use SQL GROUP BY via get_daily_activity_aggregated
with include_entity_breakdown=True, returning all data in a single response
while preserving per-team breakdown. Also adds timezone parameter support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 17:00:51 -08:00
Krish Dholakia
53a1e31729
feat(spend-logs): add truncation note when error logs are truncated for DB storage (#22936)
When the messages or response JSON fields in spend logs are truncated
before being written to the database, the truncation marker now includes
a note explaining:
- This is a DB storage safeguard
- Full, untruncated data is still sent to logging callbacks (OTEL, Datadog, etc.)
- The MAX_STRING_LENGTH_PROMPT_IN_DB env var can be used to increase the limit

Also emits a verbose_proxy_logger.info message when truncation occurs in
the request body or response spend log paths.

Adds 3 new tests:
- test_truncation_includes_db_safeguard_note
- test_response_truncation_logs_info_message
- test_request_body_truncation_logs_info_message

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-03-05 16:58:46 -08:00
yuneng-jiang
92b3160206
Merge pull request #22858 from BerriAI/litellm_rbac_vector_agents
[Feature] RBAC for Vector Stores and Agents
2026-03-05 16:40:38 -08:00
yuneng-jiang
d904b92f5a [Fix] Sync UI settings into general_settings on proxy startup
After a server restart, RBAC flags (disable_agents_for_internal_users, etc.)
were only loaded into general_settings lazily when get_ui_settings or
update_ui_settings was called. This meant restrictions were silently bypassed
until someone hit one of those endpoints.

Add _sync_ui_settings_to_general_settings() to ProxyStartupEvent that reads
the litellm_uisettings DB record and syncs _RUNTIME_GENERAL_SETTINGS_FLAGS
into general_settings immediately after prisma_client is initialized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 16:29:13 -08:00
Antti Puurula
20ce6ddbef
Fix apac.anthropic.claude-sonnet-4-6 -> au.anthropic.claude-sonnet-4-6 (#21466) 2026-03-05 15:54:26 -08:00
yuneng-jiang
05d2ccdf56 [Fix] PATCH /update/ui_settings now merges with existing record instead of overwriting
Previously, model_dump(exclude_none=True) included all bool fields (since
False != None), causing a partial PATCH to overwrite every other setting to
its default. Fix uses exclude_unset=True and reads the existing DB record
before merging, giving proper PATCH semantics.

This was a pre-existing bug but is fixed here since we're touching this code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 15:49:40 -08:00
yuneng-jiang
79817ff796 [Fix] Constrain feature_name to Literal, deduplicate runtime flags, fix silent test swallowing
- rbac_utils.py: change feature_name from str to Literal["agents", "vector_stores"]
  so typos are caught by type checkers at import time
- proxy_setting_endpoints.py: extract _RUNTIME_GENERAL_SETTINGS_FLAGS as a module-level
  constant, replacing duplicated inline lists in get_ui_settings and update_ui_settings
- test_vector_store_rbac.py: remove try/except pattern that silently swallowed non-403
  HTTPExceptions; tests now let any unexpected exception propagate as a test failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 15:42:17 -08:00
yuneng-jiang
271e80cee7
Merge pull request #22932 from BerriAI/litellm_policies_vitest_tests
[Test] UI - Policies: Add Vitest unit tests for policies components
2026-03-05 15:41:33 -08:00
Harshit28j
c453595e92 fix(ci): revert litellm-proxy-extras to 0.4.50 (not published on PyPI)
Main branch has 0.4.51 which doesn't exist on PyPI, causing all CI jobs
to fail with dependency resolution errors and poetry.lock mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 04:47:08 +05:30
yuneng-jiang
b3c092f489 [Fix] Address code review: delegate team admin check to shared helper, fix sidebar team admin exemption
- rbac_utils.py: remove duplicated _check_if_team_admin/_is_user_team_admin_for_any_team;
  delegate to _user_has_admin_privileges from management_endpoints/common_utils with the
  shared user_api_key_cache (fixes no-op DualCache and missing org admin coverage)
- test_rbac_utils.py: update patch target to match new delegation path
- SidebarProvider.tsx: pass allowAgentsForTeamAdmins and allowVectorStoresForTeamAdmins
  props to Sidebar
- leftnav.tsx: add useTeams hook + isTeamAdmin memo; exempt team admins from sidebar
  filtering when allow_*_for_team_admins is enabled (fixes frontend/backend inconsistency)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 15:04:33 -08:00
Vincent Koc
ba3ce77e29 test(openai): cover gpt-5.4-pro parameter behavior 2026-03-05 17:02:14 -05:00
Vincent Koc
fb935a61ae test(chatgpt): restore gpt-5.2 codex transformation coverage 2026-03-05 17:00:49 -05:00
yuneng-jiang
4e7b0fcfdf [Test] Add Vitest unit tests for policies components
Add 58 unit tests across 5 files in ui/litellm-dashboard/src/components/policies/:
- build_attachment_data.test.ts: pure logic tests for global vs specific scope
- impact_preview_alert.test.tsx: rendering for global scope warning and specific scope counts/tags
- PolicySelector.test.tsx: pure function tests for getPolicyOptionEntries/policyVersionRef + component fetch/disable behavior
- policy_info.test.tsx: loading, not-found, policy details rendering, admin gating, onClose/onEdit callbacks
- attachment_table.test.tsx: loading/empty states, row rendering, scope badges, delete admin gating

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 14:00:46 -08:00
weiguang li
3d027c0f7a
fix(bedrock): filter out custom field from tools to prevent 400 errors (#22861)
Claude Code v2.1.69+ sends `custom: {defer_loading: true}` on tool
definitions. Anthropic's API accepts this field, but Bedrock rejects it
with "Extra inputs are not permitted", causing ~90% of requests to fail.

Strip the `custom` field from each tool in the request body before
sending to Bedrock, in both the Messages API and Chat API invoke paths.

Fixes #22847

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2026-03-05 13:54:23 -08:00
Vincent Koc
4e3c957bce docs(chatgpt): add gpt-5.3-chat-latest proxy example 2026-03-05 16:50:38 -05:00
Vincent Koc
9a37fe2821 test(openai): add gpt-5.4 detection and xhigh assertions 2026-03-05 16:50:38 -05:00
Vincent Koc
68ab37cf34 test(chatgpt): add gpt-5.4 alias registration coverage 2026-03-05 16:50:38 -05:00
Vincent Koc
ef7be611ed docs(chatgpt): include gpt-5.4 and gpt-5.4-pro examples 2026-03-05 16:50:38 -05:00