Commit graph

7236 commits

Author SHA1 Message Date
Harshit28j
99210e9867 fix req changes 2026-02-28 21:32:57 +05:30
Harshit Jain
1c9ecd4ec6
Merge pull request #22384 from BerriAI/litellm_aws_edge_case
Litellm aws edge case
2026-02-28 19:52:55 +05:30
Chesars
8a85a2cf82 Merge branch 'litellm_oss_staging_02_27_2026' of https://github.com/BerriAI/litellm into litellm_oss_staging_02_27_2026 2026-02-28 09:54:56 -03:00
Harshit Jain
bfdea4227a
Merge pull request #22103 from Harshit28j/litellm_feat_datadog_metrics
feat: ability to trace metrics datadog
2026-02-28 17:25:23 +05:30
Harshit28j
b39218059a fix req change 2026-02-28 16:34:23 +05:30
Harshit Jain
24aa8bac09
fix req changes test case 2026-02-28 16:31:05 +05:30
Harshit28j
0b7d8b9a0d fix: edge case when key alias empty 2026-02-28 16:05:55 +05:30
Harshit Jain
1576033495
Merge pull request #22299 from BerriAI/litellm_health_check_tokens
Litellm health check tokens
2026-02-28 15:05:45 +05:30
Harshit28j
e0168db683 add docs and formatting 2026-02-28 14:08:09 +05:30
Harshit28j
465adce872 feat reaq changes 2026-02-28 13:40:53 +05:30
Harshit28j
9dc085694c feat: jwt mapping vkeyv 2026-02-28 13:29:46 +05:30
yuneng-jiang
c4b21fab06
Merge pull request #22356 from BerriAI/litellm_key_list_filters
[Feature] Key list endpoint: Add project_id and access_group_id filters
2026-02-27 22:09:54 -08:00
yuneng-jiang
6d8b5b75ce [Feature] Key list endpoint: Add project_id and access_group_id filters
Add filtering capabilities to /key/list endpoint for project_id and access_group_id parameters. Both filters work globally across all visibility rules and stack with existing sort/pagination params. Added comprehensive unit tests for the new filters.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-27 21:25:44 -08:00
Ishaan Jaff
ee703cea99
fix(jwt): OIDC discovery URLs, roles array handling, dot-notation error hints (#22336)
* fix(jwt): support OIDC discovery URLs, handle roles array, improve error hints

Three fixes for Azure AD JWT auth:

1. OIDC discovery URL support - JWT_PUBLIC_KEY_URL can now be set to
   .well-known/openid-configuration endpoints. The proxy fetches the
   discovery doc, extracts jwks_uri, and caches it.

2. Handle roles claim as array - when team_id_jwt_field points to a list
   (e.g. AAD's "roles": ["team1"]), auto-unwrap the first element instead
   of crashing with 'unhashable type: list'.

3. Better error hint for dot-notation indexing - when team_id_jwt_field is
   set to "roles.0" or "roles[0]", the 401 error now explains to use
   "roles" instead and that LiteLLM auto-unwraps lists.

* Add integration demo script for JWT auth fixes (OIDC discovery, array roles, dot-notation hints)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* Add demo_servers.py for manual JWT auth testing with mock JWKS/OIDC endpoints

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* Add demo screenshots for PR comment

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* Add integration test results with screenshots for PR review

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* address greptile review feedback (greploop iteration 1)

- fix: add HTTP status code check in _resolve_jwks_url before parsing JSON
- fix: remove misleading bracket-notation hint from debug log (get_nested_value does not support it)

* Update tests/test_litellm/proxy/auth/test_handle_jwt.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* remove demo scripts and assets

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-27 20:30:47 -08:00
Julio Quinteros Pro
8ab542875c
Merge pull request #21107 from BerriAI/fix/bedrock-filter-json-tool-call-scoped
fix(bedrock): filter internal json_tool_call when mixed with real tools
2026-02-28 01:17:09 -03:00
rasmi
bffce842a1
Remove Apache 2 license from SKILL.md (#22322) 2026-02-27 19:33:55 -08:00
Julio Quinteros Pro
fcabf9b602 fix(bedrock): filter internal json_tool_call when mixed with real tools
Fixes #18381: When using both tools and response_format with Bedrock
Converse API, LiteLLM internally adds json_tool_call to handle structured
output. Bedrock may return both this internal tool AND real user-defined
tools, breaking consumers like OpenAI Agents SDK.

Changes:
- Non-streaming: Added _filter_json_mode_tools() to handle 3 scenarios:
  only json_tool_call (convert to content), mixed (filter it out), or
  no json_tool_call (pass through)
- Streaming: Added json_mode tracking to AWSEventStreamDecoder to suppress
  json_tool_call chunks and convert to text content
- Fixed optional_params.pop() mutation issue

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-28 00:18:56 -03:00
Shivam Rawat
d49abf8577
[Fix] Pass MCP auth headers from request into tool fetch for /v1/responses and chat completions (#22291)
* fixed dynamic auth for /responses with mcp

* fixed greptile concern
2026-02-27 19:15:51 -08:00
Julio Quinteros Pro
2d649f239f
Merge pull request #22026 from ZeroClover/fix/img-extra-headers
fix(image_generation): propagate extra_headers to Upstream
2026-02-28 00:14:43 -03:00
Julio Quinteros Pro
98bc247618
Merge pull request #22143 from shivaaang/fix/llm-client-cache-unawaited-coroutine
fix(caching): store task references in LLMClientCache._remove_key
2026-02-28 00:13:52 -03:00
milan-berri
3e60ca3682
fix: populate user_id and user_info for admin users in /user/info (#22239)
* fix: populate user_id and user_info for admin users in /user/info endpoint

Fixes #22179

When admin users call /user/info without a user_id parameter, the endpoint
was returning null for both user_id and user_info fields. This broke
budgeting tooling that relies on /user/info to look up current budget and spend.

Changes:
- Modified _get_user_info_for_proxy_admin() to accept user_api_key_dict parameter
- Added logic to fetch admin's own user info from database
- Updated function to return admin's user_id and user_info instead of null
- Updated unit test to verify admin user_id is populated

The fix ensures admin users get their own user information just like regular users.

* test: make mock get_data signature match real method

- Updated MockPrismaClientDB.get_data() to accept all parameters that the real method accepts
- Makes mock more robust against future refactors
- Added datetime and Union imports
- Mock now returns None when user_id is not provided
2026-02-27 19:12:16 -08:00
milan-berri
594600dcb5
fix: Add PROXY_ADMIN role to system user for key rotation (#21896)
* fix: Add PROXY_ADMIN role to system user for key rotation

The key rotation worker was failing with 'You are not authorized to regenerate this key'
when rotating team keys. This was because the system user created by
get_litellm_internal_jobs_user_api_key_auth() was missing the user_role field.

Without user_role=PROXY_ADMIN, the system user couldn't bypass team permission checks
in can_team_member_execute_key_management_endpoint(), causing authorization failures
for team key rotation.

This fix adds user_role=LitellmUserRoles.PROXY_ADMIN to the system user, allowing
it to bypass team permission checks and successfully rotate keys for all teams.

* test: Add unit test for system user PROXY_ADMIN role

- Verify internal jobs system user has PROXY_ADMIN role
- Critical for key rotation to bypass team permission checks
- Regression test for PR #21896
2026-02-27 19:11:29 -08:00
Julio Quinteros Pro
8b50703f74
Merge pull request #22327 from BerriAI/fix/mcp-test-mock-filter-method-name
fix(mcp): update test mocks for renamed filter_server_ids_by_ip_with_info
2026-02-27 23:52:39 -03:00
Ishaan Jaff
8ce358e303
[Feat] Agent RBAC Permission Fix - Ensure Internal Users cannot create agents (#22329)
* fix: enforce RBAC on agent endpoints — block non-admin create/update/delete

- Add /v1/agents/{agent_id} to agent_routes so internal users can
  access GET-by-ID (previously returned 403 due to missing route pattern)
- Add _check_agent_management_permission() guard to POST, PUT, PATCH,
  DELETE agent endpoints — only PROXY_ADMIN may mutate agents
- Add user_api_key_dict param to delete_agent so the role check works
- Add comprehensive unit tests for RBAC enforcement across all roles

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* fix: mock prisma_client in internal user get-agent-by-id test

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* feat(ui): hide agent create/delete controls for non-admin users

Match MCP servers pattern: wrap '+ Add New Agent' button in
isAdmin conditional so internal users see a read-only agents view.
Delete buttons in card and table were already gated.
Update empty-state copy for non-admin users.
Add 7 Vitest tests covering role-based visibility.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-27 18:32:39 -08:00
Shivaang
fb72979432 fix(caching): store background task references in LLMClientCache._remove_key to prevent unawaited coroutine warnings
Fixes #22128
2026-02-27 21:23:56 -05:00
Julio Quinteros Pro
332dc32299
Merge pull request #22334 from BerriAI/fix/anthropic-passthrough-azure-test
fix(test): update Azure pass-through test after Responses API routing change
2026-02-27 23:09:04 -03:00
Julio Quinteros Pro
9b20a050ec
Merge pull request #22332 from BerriAI/fix/realtime-guardrail-test-assertions
fix(test): update realtime guardrail test assertions for voice violation behavior
2026-02-27 23:08:04 -03:00
Julio Quinteros Pro
2ac5365e06 fix: update stale docstring to match guardrail voicing behavior
Addresses Greptile review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 23:04:43 -03:00
Ishaan Jaff
15fcd90b9c
feat: add in_flight_requests metric to /health/backlog + prometheus (#22319)
* feat: add in_flight_requests metric to /health/backlog + prometheus

* refactor: clean class with static methods, add tests, fix sentinel pattern

* docs: add in_flight_requests to prometheus metrics and latency troubleshooting
2026-02-27 18:00:50 -08:00
Julio Quinteros Pro
273994b996 fix(test): update Azure pass-through test to mock litellm.completion
Commit 99c62ca40e removed "azure" from _RESPONSES_API_PROVIDERS,
routing Azure models through litellm.completion instead of
litellm.responses. The test was not updated to match, causing it
to assert against the wrong mock.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:59:38 -03:00
Julio Quinteros Pro
9a48c8e36a fix(test): update realtime guardrail test assertions for voice violation behavior
Tests were asserting no response.create/conversation.item.create sent to
backend when guardrail blocks, but the implementation intentionally sends
these to have the LLM voice the guardrail violation message to the user.

Updated assertions to verify the correct guardrail flow:
- response.cancel is sent to stop any in-progress response
- conversation.item.create with violation message is injected
- response.create is sent to voice the violation
- original blocked content is NOT forwarded

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:53:09 -03:00
Julio Quinteros Pro
cb4cfa1db4 fix(mcp): update test mocks to use renamed filter_server_ids_by_ip_with_info
Tests were mocking the old method name `filter_server_ids_by_ip` but production
code at server.py:774 calls `filter_server_ids_by_ip_with_info` which returns
a (server_ids, blocked_count) tuple. The unmocked method on AsyncMock returned
a coroutine, causing "cannot unpack non-iterable coroutine object" errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 22:37:05 -03:00
Dylan Duan
af6fe184fb
docs: update AssemblyAI docs with Universal-3 Pro, Speech Understanding, and LLM Gateway (#21130)
* docs: update AssemblyAI docs with Universal-3 Pro, Speech Understanding, and LLM Gateway provider config

* feat: add AssemblyAI LLM Gateway as OpenAI-compatible provider
2026-02-27 17:24:48 -08:00
Ryan Crabbe
4fa6742b01 Add Prometheus child_exit cleanup for gunicorn workers
When a gunicorn worker exits (e.g. from max_requests recycling), its
per-process prometheus .db files remain on disk. For gauges using
livesum/liveall mode, this means the dead worker's last-known values
persist as if the process were still alive. Wire gunicorn's child_exit
hook to call mark_process_dead() so live-tracking gauges accurately
reflect only running workers.
2026-02-27 16:11:15 -08:00
Rahul Dhanawade
64c85dbc9f
Fix/claude code plugin schema (#22271)
* fix: add missing LiteLLM_ClaudeCodePluginTable to schema.prisma

- Claude Code Plugin Marketplace endpoints (/claude-code/marketplace.json,
  /claude-code/plugins) were returning 500 errors because
  LiteLLM_ClaudeCodePluginTable model was missing from both schema.prisma files
- Prisma client was generated without this table causing AttributeError:
  'Prisma' object has no attribute 'litellm_claudecodeplugintable'
- Added missing model definition to root schema.prisma and
  litellm/proxy/schema.prisma

Fixes #21310

* test: add regression test for LiteLLM_ClaudeCodePluginTable schema

* fix: address greptile review - add @updatedAt, clean up test imports
2026-02-27 15:59:37 -08:00
yuneng-jiang
8bb6457471 [Fix] Include created_at and updated_at in /project/list response
The /project/list endpoint was not returning created_at and updated_at timestamps because these fields were not defined in LiteLLM_ProjectTable. Added these fields to the model so FastAPI includes them in the response (values come from the database). This allows the UI to display project creation and last-updated times.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-27 15:41:03 -08:00
tombii
d292da2c14 fix(openrouter): pattern-based fix for native OpenRouter model double-stripping
Replace the hardcoded NATIVE_OPENROUTER_MODELS set approach with a
pattern-based check in _get_openai_compatible_provider_info: after
stripping the outer "openrouter/" provider prefix, if the remaining
model name still starts with "openrouter/", return immediately without
further stripping.

This fixes openrouter/openrouter/aurora-alpha, openrouter/openrouter/polaris-alpha,
and any future native OpenRouter models — not just the three hard-coded
ones (auto, free, bodybuilder) from the previous approach.

Fixes #16353

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 23:14:53 +01:00
Cesar Garcia
6430173bde
Merge pull request #20516 from Chesars/fix/openrouter-native-model-double-strip
fix(adapter): double-stripping of model names with provider-matching prefixes
2026-02-27 18:58:37 -03:00
Cesar Garcia
587977e19a
Merge pull request #19792 from Chesars/fix/openrouter-register-model-index-error
fix(register_model): handle openrouter models without '/' in name
2026-02-27 18:52:14 -03:00
Cesar Garcia
1e68b17a14
Merge pull request #19288 from Chesars/fix/helicone-gemini-support
fix(helicone): add Gemini and Vertex AI support to HeliconeLogger
2026-02-27 18:33:15 -03:00
Cesar Garcia
47a7645584
Merge pull request #22301 from Chesars/fix/count-tokens-include-system-and-tools
fix(count_tokens): include system and tools in token counting API requests
2026-02-27 18:29:31 -03:00
ryan-crabbe
d9cfae9092
Merge pull request #22313 from BerriAI/tests/add_llmclientcache_regression_tests
Tests: add llmclientcache regression tests
2026-02-27 13:04:02 -08:00
Ryan Crabbe
dce597b806 Close httpx clients after assertions to prevent resource leaks 2026-02-27 12:58:33 -08:00
Cesar Garcia
8f02d2d840
Merge pull request #21337 from Chesars/fix/streaming-parallel-tool-call-index
fix(responses): use output_index for parallel tool call streaming indices
2026-02-27 17:54:19 -03:00
Cesar Garcia
fc7bc9147f
Merge pull request #21629 from Chesars/fix/pydantic-serialization-warnings
fix(types): remove StreamingChoices from ModelResponse, use ModelResponseStream
2026-02-27 17:48:33 -03:00
Cesar Garcia
1552775166
Merge pull request #21595 from Chesars/fix/moonshot-preserve-image-url-content
fix(moonshot): preserve image_url blocks in multimodal messages
2026-02-27 17:47:02 -03:00
Ryan Crabbe
0b7e9a1971 Add e2e tests: httpx clients survive LLMClientCache eviction
Tests go through the real get_async_httpx_client() code path to verify
clients remain usable after both capacity eviction and TTL expiry.
Regression tests for PR #22247.
2026-02-27 12:43:08 -08:00
Ryan Crabbe
6490ad1d48 Revert "Add LLMClientCache regression tests for httpx client eviction safety"
This reverts commit ad9c70ec5d.
2026-02-27 12:43:03 -08:00
Cesar Garcia
bb8e6b1426
Merge pull request #21592 from Chesars/fix/openrouter-stream-usage-no-stream-options
fix(openrouter): use provider-reported usage in streaming without stream_options
2026-02-27 17:42:47 -03:00
Cesar Garcia
acf2fd9828
Merge branch 'main' into fix/openrouter-stream-usage-no-stream-options 2026-02-27 17:41:13 -03:00