Commit Graph

56 Commits

Author SHA1 Message Date
yuneng-jiang b314e8d20a Merge pull request #20688 from BerriAI/litellm_budget_tier_enforcement_for_keys
[Fix] Budget-linked keys never had spend reset
2026-03-06 20:44:58 -08:00
Harshit28j b39218059a fix req change 2026-02-28 16:34:23 +05:30
Harshit28j 0b7d8b9a0d fix: edge case when key alias empty 2026-02-28 16:05:55 +05:30
Sameer Kankute af3b6f3334 Fix: litellm/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py 2026-02-26 12:09:42 +05:30
Ryan Crabbe 53c10b0b64 Merge origin/main and address Greptile review feedback
- Resolve merge conflict in pass_through_endpoints.py
- Add .copy() to proxy_server_request headers to prevent cache corruption
- Add test for request.state unavailable fallback path
2026-02-24 15:13:19 -08:00
Sameer Kankute 57af8e6a93 Merge pull request #21924 from BerriAI/main
merge main in oss 22 02
2026-02-23 18:11:36 +05:30
Krish Dholakia 52585eb2d7 Revert "fix(vertex_ai): enable context-1m-2025-08-07 beta header (#21870)" (#21876)
This reverts commit bce078a796.
2026-02-21 20:12:01 -08:00
Edwin Isac bce078a796 fix(vertex_ai): enable context-1m-2025-08-07 beta header (#21870)
* server root path regression doc

* fixing syntax

* fix: replace Zapier webhook with Google Form for survey submission (#21621)

* Replace Zapier webhook with Google Form for survey submission

* Add back error logging for survey submission debugging

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>

* Revert "Merge pull request #21140 from BerriAI/litellm_perf_user_api_key_auth"

This reverts commit 0e1db3f7e4, reversing
changes made to 7e2d6f2355.

* test_vertex_ai_gemini_2_5_pro_streaming

* UI new build

* fix rendering

* ui new build

* docs fix

* docs fix

* docs fix

* docs fix

* docs fix

* docs fix

* docs fix

* docs fix

* release note docs

* docs

* adding image

* fix(vertex_ai): enable context-1m-2025-08-07 beta header

The `context-1m-2025-08-07` Anthropic beta header was set to `null` for vertex_ai,
causing it to be filtered out when users set `extra_headers: {anthropic-beta: context-1m-2025-08-07}`.

This prevented using Claude's 1M context window feature via Vertex AI, resulting in
`prompt is too long: 460500 tokens > 200000 maximum` errors.

Fixes #21861

---------

Co-authored-by: yuneng-jiang <yuneng.jiang@gmail.com>
Co-authored-by: milan-berri <milan@berri.ai>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2026-02-21 20:11:13 -08:00
LeeJuOh 50f36d9ca6 fix(budget): fix timezone config lookup and replace hardcoded timezone map with ZoneInfo (#21754)
* fix(budget): fix timezone config lookup and replace hardcoded timezone map with ZoneInfo

* fix(budget): update stale docstring on get_budget_reset_time
2026-02-21 19:35:06 -08:00
Ishaan Jaffer 2270a3aaf3 Revert "Merge pull request #21140 from BerriAI/litellm_perf_user_api_key_auth"
This reverts commit 0e1db3f7e4, reversing
changes made to 7e2d6f2355.
2026-02-21 16:57:42 -08:00
Ryan Crabbe c7ad8053b1 Merge origin/main into litellm_perf_user_api_key_auth
Resolve conflicts:
- pass_through_endpoints.py: take main's version, re-apply
  MAPPED_PASS_THROUGH_PREFIXES startswith(tuple) optimization
- test_user_api_key_auth.py: keep both auth optimization regression
  tests and JWT admin identity field tests
2026-02-21 15:14:20 -08:00
Ryan Crabbe f0a542c55d fix: add .copy() to create_request_copy and tests for header caching
Protect cached headers from mutation in create_request_copy sites and
add unit tests for _safe_get_request_headers caching behavior.
2026-02-18 09:44:35 -08:00
Ryan Crabbe 3275fb09cb fix: add State() to mock requests in http_parsing_utils tests
The _safe_get_request_headers caching uses request.state._cached_headers,
which returns a truthy MagicMock on bare MagicMock() objects instead of
None, breaking content-type detection for form-data tests.
2026-02-17 16:01:08 -08:00
Shivam Rawat c45a17bad4 Merge branch 'main' into litellm_budget_tier_enforcement_for_keys 2026-02-17 16:00:04 -08:00
shivam 0117b35a6b added more tests, fixed tests 2026-02-16 09:59:19 -08:00
Harshit Jain f33a7ca7d6 fix: as per request changes 2026-02-14 04:34:58 +05:30
Harshit Jain f87b12a2f7 fix grace period with better error handling on frontend and as per best practices 2026-02-14 04:18:08 +05:30
Harshit Jain 673b7d1fea Merge branch 'main' into litellm_fix-virtual-key-grace-period 2026-02-13 18:14:47 +05:30
Varun Chawla e587370f67 fix(proxy): add regression tests for #20441 - <script> tags in messages (#20573)
* fix: empty guardrails/policies arrays should not trigger enterprise license check (#20304)

The UI sends empty arrays for enterprise-only fields (guardrails, policies,
logging) even when the user has not configured these features. The backend
`is not None` check treated `[]` as a truthy intent to use the feature,
falsely requiring an enterprise license for basic team operations.

Backend: Add `and updated_kv[field] != [] and updated_kv[field] != {}`
guards in `_update_metadata_fields` so empty collections are skipped.

UI: Conditionally omit guardrails, logging, and policies from the
payload when empty instead of defaulting to `[]`.

Fixes #20304

* fix: allow clearing fields with empty collections while skipping enterprise check

Address PR review feedback:

1. Move the empty-collection guard into _update_metadata_field (singular)
   so that empty lists/dicts skip only the premium license check but still
   get written into metadata. This lets users intentionally clear a
   previously-set field (e.g. guardrails: []) without being blocked, while
   the UI's default empty arrays still don't trigger a false enterprise
   error.

2. Remove sys.path hack from test file; use standard imports that work
   with pytest discovery.

3. Add tests verifying that empty collections are moved into metadata
   (field clearing works) even though they bypass the premium check.

Fixes #20304

* fix(proxy): add regression tests for #20441 - ensure <script> tags in LLM messages are not blocked

The 403 Forbidden error when sending messages containing `<script>` is caused
by external WAF/reverse proxy infrastructure (confirmed by the standard nginx
HTML 403 response format), not by LiteLLM's own content filtering. However,
these regression tests ensure that:

1. The content filter guardrail's built-in patterns do not match HTML tags
2. Messages containing <script> and other HTML tags pass through the content
   filter unchanged when no explicit HTML-blocking rules are configured
3. The HTTP request body parser correctly handles JSON payloads containing
   HTML content without modification

These tests guard against accidentally introducing HTML/XSS filtering that
would break legitimate LLM API usage (e.g., discussing HTML/JavaScript code).

Closes #20441

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:57:40 +05:30
shivam ba1b466480 fix to ensure budget duration is being inherited from budget tier for keys 2026-02-07 18:16:01 -08:00
Harshit Jain 768f9a44b2 fix: virutal key grace period from env/UI 2026-02-03 09:50:10 +05:30
Harshit Jain b36e704e06 fix: ensure auto-rotation updates existing AWS secret instead of creating new one (#19455) 2026-01-20 18:30:36 -08:00
yuneng-jiang 5a20edf0fa Allow org admins to view org info 2025-12-24 11:43:36 -08:00
yuneng-jiang 0dd4db34bd Working setting generic callbacks on UI 2025-12-05 14:37:48 -08:00
yuneng-jiang cc92fdf90f Merge remote-tracking branch 'origin' into litellm_ui_callback_fix 2025-12-03 11:02:59 -08:00
Richard Song 099ccf56a7 Refactor add_schema_to_components to move definitions to components/schemas and add corresponding unit test (#17389) 2025-12-02 21:57:07 -08:00
Cesar Garcia 01dfc3561a Fix AttributeError when metadata is null in request body (#17263) (#17306)
Handle the case where metadata is explicitly set to null/None in the
request body. This was causing a 401 error with "'NoneType' object
has no attribute 'get'" when calling /v1/batches with metadata: null.

The fix uses `or {}` instead of a default dict value since the key
exists but has a None value.
2025-12-01 19:58:27 -08:00
yuneng-jiang 25e2331510 Merge remote-tracking branch 'origin' into litellm_ui_callback_fix 2025-11-27 17:29:29 -08:00
Saar wintrov cfd35d3b14 Metadata: fix 401 when audio/transcriptions (#17023)
* Metadata: fix 401 when audio/transcriptions

* check if str, CR fixes
2025-11-24 20:56:27 -08:00
yuneng-jiang 6881594632 [Fix] Exclude litellm_credential_name from Sensitive Data Masker (Updated) (#16958)
* Exclude litellm_credential_name from sensitive masker

* Adding missing file
2025-11-21 19:09:48 -08:00
yuneng-jiang eb48d5cc42 Revert "Exclude litellm_credential_name from sensitive masker (#16950)" (#16956)
This reverts commit 5cfacb96e6.
2025-11-21 18:09:54 -08:00
yuneng-jiang 5cfacb96e6 Exclude litellm_credential_name from sensitive masker (#16950) 2025-11-21 16:40:17 -08:00
yuneng-jiang 31535ff4b6 Merge with main 2025-11-20 20:24:03 -08:00
Ishaan Jaff c3c6cef6d8 [Fix] Fixes Swagger UI resolver errors for chat completion endpoints caused by Pydantic v2 $defs not being properly exposed in the OpenAPI schema. (#16784)
* fix add_request_body_to_paths

* test_move_defs_to_components
2025-11-18 17:39:28 -08:00
yuneng-jiang cff8a3115a Merge with main 2025-11-14 20:02:35 -08:00
yuneng-jiang cb27d6c456 [Fix] UI - Delete Callbacks Failing (#16473)
* Temp commit for branch switching

* Created normalize callback name util function and tests
2025-11-12 18:43:37 -08:00
yuneng-jiang 7833b3fdb4 Addressing comments 2025-11-10 17:28:13 -08:00
Ishaan Jaff 6c26971cd4 [Bug Fix] Tags as metadata dicts were raising exceptions (#15625)
* fix get_tags_from_request_body

* Revert "fix get_tags_from_request_body"

This reverts commit 1c044dad999500b5c11ec96f528212c248f72f61.

* fix get_tags_from_request_body

* test_get_tags_from_request_body_with_dict_tags
2025-10-17 13:20:07 -07:00
Ishaan Jaff 527c8f59fa [Feat] Tag Management - Add support for setting tag based budgets (#15433)
* feat: add LiteLLM_TagTable

* fix: use new table for tag management

* fix - allow setting budgets for tags

* working tag creation

* fix schema.prisma

* add tag info

* ui fixes

* ui fix tag info

* TAG_CACHE_IN_MEMORY_TTL_SECONDS

* add Litellm_EntityType

* fix get_aggregated_db_spend_update_transactions

* fix: _update_entity_spend_in_db

* fix _tag_max_budget_check

* add tag budget check

* add tag_list_transactions

* test_get_tag_objects_batch

* test_update_tag_db_without_prisma_client

* fix get_tags_from_request_body

* get_tags_from_request_body

* fix get_tags_from_request_body

* fix spend tracking utils

* get_tags_from_request_body

* test_get_tags_from_request_body_with_metadata_tags

* feat: add _update_tag_cache spend tracking

* fix _PROXY_track_cost_callback

* test_tag_cache_update_multiple_tags

* fix tag info

* docs fix

* docs tag budgets

* doc fix

* docs fix

* fix tag budget

* docs tag budgets

* docs fix

* ruff fix
2025-10-10 19:24:50 -07:00
Ishaan Jaff 628cd13755 [Feat] UI - Allow scheduling key rotations when creating virtual keys (#14960)
* fix design of key reset interval

* fix: LiteLLM_VerificationToken

* fix key manager

* add key_rotation_at

* ui fix

* fix ui view

* set key_rotation_at  on creation

* add key_rotation_at

* fix info

* fix: _set_key_rotation_fields

* fix KeyRotationManager

* fix key edit view

* test_update_key_fn_auto_rotate_enable

* fix KeyRotationManager
2025-09-26 16:24:40 -07:00
Ishaan Jaff ea8d0bb7d5 fix: re-add scheduled rotations 2025-09-26 11:40:46 -07:00
Ishaan Jaffer b1e56c55ad merge 2025-09-24 22:11:37 -07:00
Ishaan Jaff ded823a3a3 [Feat] Initial support for scheduled key rotations (#14877)
* add KeyRotationSettings

* add KeyRotationManager

* add key rotation manager

* add KeyRotationManager

* fix _initialize_spend_tracking_background_jobs

* fix add_key_rotation_fields

* fixes

* new fields in schema

* update schema

* fix fixes for init key rotation manager

* fixes for init key rotation manager

* fix KeyRotationManager

* tests for key rotation

* fix key_rotation_settings

* fix KeyRotationManager

* fix LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS

* fix fixes for init key rotation manager

* ruff check fix

* fix LITELLM_KEY_ROTATION_CHECK_INTERVAL_SECONDS

* fix _initialize_spend_tracking_background_jobs

* docs fix

* docs auto rotate

* schema fix

* bump proxy extras

* fix config.yml
2025-09-24 21:37:56 -07:00
kayoch1n 76555cad81 Format code 2025-09-03 11:20:52 +08:00
kayoch1n ffbe5cd899 Add a testcase 2025-09-03 11:08:23 +08:00
Ishaan Jaff 40395598da [Feat] UI - Allow editing team member rpm/tpm limits (#13669)
* show team member tpm/rpm limits

* ui - allow setting team settings

* fix better debugging

* fix types: TeamMemberUpdateRequest

* add _upsert_budget_and_membership

* allow updating team member RPM/TPM in teamMemberUpdateCall

* editing team member rpm/tpm

* UI - fixes for team member component

* fix info

* test_upsert_rpm_only_creates_new_budget
2025-08-15 17:29:44 -07:00
Krzysztof Gąsiorowski 0b28930ad4 [Fix] Hide sensitive data in /model/info - azure entra client_secret (#13577)
* Remove litellm_params.client_secret from /model/info

Added pop of client_secret (Azure provider secret) from litellm_params in remove_sensitive_info_from_deployment used by /model/info endpoints

* Added test for litellm.proxy.common_utils.openai_endpoint_utils.remove_sensitive_info_from_deployment
2025-08-13 07:35:53 -07:00
Ishaan Jaff eb4bd26f24 [Bug Fix] - Get Routes (#13466)
* fixes get_routes_for_mounted_app

* fix - use _safe_get_endpoint_name

* fix code QA check

* test_get_routes_for_mounted_app_with_static_files

* test fixes
2025-08-09 12:52:23 -07:00
Ishaan Jaff 46c950b17b [Bug Fix] Add swagger docs for LiteLLM /chat/completions, /embeddings, /responses (#12618)
* update ProxyChatCompletionRequest

* use custom OpenAPI schema

* use customize_openapi_schema

* add_llm_api_request_schema_body

* add embeddings and response spec

* fix add_llm_api_request_schema_body

* TestCustomOpenAPISpec

* fixes linting

* fix linting

* bump timeout
2025-07-15 13:37:22 -07:00
Ishaan Jaff d2fe8894c8 [Bug Fix] Include /mcp in list of available routes on proxy (#12612)
* create GetRoutes helper class

* update get routes

* TestGetRoutes

* fix get_routes_for_mounted_app
2025-07-15 09:24:48 -07:00