Commit graph

6949 commits

Author SHA1 Message Date
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
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
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
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
ryan-crabbe
dc97e2f714
Merge pull request #22306 from BerriAI/tests/add_llmclientcache_regression_tests
Add LLMClientCache regression tests for httpx client eviction safety
2026-02-27 11:21:38 -08:00
yuneng-jiang
98e944c0cf
Merge pull request #22253 from BerriAI/litellm_access_group_sync
[Feature] Access group CRUD: Bidirectional team/key sync
2026-02-27 11:14:46 -08:00
Ryan Crabbe
ad9c70ec5d Add LLMClientCache regression tests for httpx client eviction safety
Regression tests for PR #22247 — ensures cache eviction (capacity and TTL)
does not close httpx clients that are still in use.
2026-02-27 11:14:13 -08:00
Gaurav Singh
29bb73ffca
fix(mcp): strip stale mcp-session-id header to prevent 400 in multi-worker deployments (#20992) (#21417)
In a multi-worker Uvicorn setup, a client that reconnects to a different
worker sends an mcp-session-id that the new worker has never seen.  The
MCP SDK returns 400 because the session is unknown.

Fix: add _handle_stale_mcp_session() which inspects the inbound
mcp-session-id header before the request reaches the SDK.  If the
session is not in this worker's _server_instances:
  - Non-DELETE: strip the header so the SDK creates a fresh session
  - DELETE: return 200 immediately (idempotent, session already gone)

No new dependencies, no Redis, no latency added to the hot path.

Fixes https://github.com/BerriAI/litellm/issues/20992
2026-02-27 10:59:08 -08:00
Noah Nistler
d13508c1c5
Enable local file support for OCR (#22133)
* [Docs] Enable local file support

Implemented internal handling for converting file-type documents to the required format for OCR processing, ensuring seamless integration with various providers.

* Refactor OCR file handling and improve security checks

Removed deprecated MIME type mapping and file conversion functions, replacing them with updated implementations. Enhanced security by rejecting 'file' document types in JSON requests, ensuring file uploads are handled via multipart/form-data. Updated tests to reflect these changes and ensure proper functionality.

* Enhance MIME type validation in OCR processing

Added a regular expression check to validate MIME types in the convert_file_document_to_url_document function, raising a ValueError for invalid types. Updated tests to ensure proper error handling for unsupported MIME types.

* Enhance type safety in OCR file handling

Added type casting for the uploaded file in the _parse_multipart_form function to ensure proper handling of UploadFile instances. This change improves type safety and reduces potential runtime errors during file processing.

* Refactor MIME type handling in document uploads

Updated the MIME type extraction logic to strip parameters from the Content-Type header, ensuring only the base type is used. Added tests to verify that MIME parameters are correctly handled and stripped in various scenarios.

* Update OCR documentation for MIME type recommendations and remove unnecessary tips

Clarified the recommended usage of MIME types for raw bytes in document uploads. Simplified the documentation by removing the tip about multipart file uploads from tools like Postman, ensuring a more concise and focused guide.

* Enhance multipart form handling in OCR endpoints

Updated the _parse_multipart_form function to ignore both 'file' and 'document' fields during form parsing, ensuring that the document built from the uploaded file is not overridden. Added a new test to verify that injected document fields do not affect the constructed document, improving security and robustness of the file upload process.
2026-02-27 10:50:02 -08:00
Sameer Kankute
ec8aaa9d2f
Merge pull request #22155 from BerriAI/litellm_fix_image
[Bug]Add ChatCompletionImageObject in OpenAIChatCompletionAssistantMessage
2026-02-27 21:18:55 +05:30
Sameer Kankute
63c9b3a137
Merge pull request #22087 from BerriAI/litellm_fix_anthropic_responses
Add v1 for anthropic responses transformation
2026-02-27 21:18:04 +05:30
Sameer Kankute
e583489abe
Merge pull request #22260 from BerriAI/litellm_Fix_tool_pass
[Fix]Preserve forwarding server side called tools
2026-02-27 21:16:56 +05:30
Sameer Kankute
f297036401
Merge pull request #22267 from BerriAI/litellm_fixParallel_tool_cal
Fix converse handling for parallel_tool_calls
2026-02-27 21:16:44 +05:30
Harshit Jain
e575b80f01
Merge pull request #21930 from Harshit28j/litellm_fix_index_query_call
perf(spendlogs): optimize old spendlog deletion cron job
2026-02-27 19:39:05 +05:30
Sameer Kankute
39e0fa9ea9
Merge pull request #22223 from emerzon/feat/vertex-gemini-3-1-flash-image-preview-pricing
feat(vertex): add gemini-3.1-flash-image-preview to model DB
2026-02-27 18:10:04 +05:30
Harshit Jain
d8b134d781
Merge pull request #22216 from BerriAI/litellm_project_tags_handle
feat: add tags in project
2026-02-27 15:48:32 +05:30
Harshit28j
a9d0e2cf91 fix: req changes 2026-02-27 13:33:34 +05:30
Sameer Kankute
33e6b9c67d
Merge branch 'main' into litellm_fixParallel_tool_cal 2026-02-27 13:01:54 +05:30
Sameer Kankute
d0445e1e33 Fix converse handling for parallel_tool_calls 2026-02-27 13:00:57 +05:30
Sameer Kankute
8565c70e53
Revert "Fix mapping of parallel_tool_calls for bedrock converse" 2026-02-27 12:45:08 +05:30
Sameer Kankute
596437b3b9 Add Regression tests for image_url blocks in assistant message content. 2026-02-27 12:04:12 +05:30
Sameer Kankute
6b9ec4247f Preserve forwarding server side called tools 2026-02-27 11:31:45 +05:30
yuneng-jiang
cde23e9b6e fix: normalize null list fields to [] in update_data before DB write
When a client sends null for assigned_team_ids or assigned_key_ids, ensure
the DB receives [] instead of null, preventing null from being stored where
empty list is expected. Extend test to verify the DB call uses [].

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 20:53:30 -08:00
yuneng-jiang
a732c3f177
Merge pull request #22248 from BerriAI/litellm_public_endpoints
[Feature] Add /public/endpoints for provider endpoint support
2026-02-26 20:49:44 -08:00
yuneng-jiang
2144e79bad fix: guard against null assigned_*_ids in update_access_group delta computation
set(None) raises TypeError when a client sends null for assigned_team_ids or
assigned_key_ids. Add `or []` to handle null safely, consistent with create.
Add test covering this case.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 20:48:04 -08:00
yuneng-jiang
516b18feca [Feature] Access group CRUD: Add bidirectional sync for teams/keys
When creating, updating, or deleting access groups, automatically keep
team and key access_group_ids in sync with the access group's assigned_team_ids
and assigned_key_ids. Includes transaction-based DB updates, cache patching,
and handles out-of-sync data by unioning assigned_* fields with hasSome queries.

Adds 12 new tests covering sync behavior across all three CRUD operations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 20:07:51 -08:00
Sameer Kankute
8d1c75c48a
Merge pull request #22225 from dharamendrak/bugfix/midstream-fallback-error-masks-status-code
[Fix] Enhance MidStreamFallbackError to preserve original status code and attributes
2026-02-27 08:28:54 +05:30
yuneng-jiang
86b2efd67a [Feature] Add /public/endpoints endpoint for provider endpoint support
Add new /public/endpoints endpoint that returns which providers support each LiteLLM
endpoint (e.g., chat_completions, embeddings). The endpoint reads from a local backup
JSON file bundled with the package, caches the result in-process, and transforms the
raw provider-centric data into an endpoint-centric response format.

Changes:
- Add litellm/provider_endpoints_support_backup.json (copy of root source file)
- Add Pydantic response models (EndpointProvider, SupportedEndpoint, SupportedEndpointsResponse)
- Add /public/endpoints route with transformation and caching logic
- Add 16 comprehensive tests covering HTTP layer and transformation functions

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-26 18:17:37 -08:00
Ryan Crabbe
df36845839 fix: remove cache eviction close that kills in-use httpx clients 2026-02-26 17:39:01 -08:00
yuneng-jiang
71c3503e57
Revert "[Feature] Add /public/supported_endpoints endpoint" 2026-02-26 17:21:43 -08:00
yuneng-jiang
0a690a55a9
Merge pull request #22243 from BerriAI/litellm_team_budget_inf_fix
[Fix] Prometheus Metrics Team +Inf Budgets
2026-02-26 17:06:40 -08:00
Ishaan Jaff
48b9ecacad
fix(realtime): fix guardrails not firing for Gemini/Vertex AI and provider_config realtime WebSocket sessions (#22168)
* fix(gemini): enable inputAudioTranscription and handle transcription events for realtime guardrails

Gemini sends inputTranscription/outputTranscription inside serverContent separately from modelTurn/turnComplete. This adds handling to convert them into OpenAI-compatible events so the guardrail pipeline can inspect voice input, and enables inputAudioTranscription in the session setup config.

Made-with: Cursor

* fix(vertex_ai): enable inputAudioTranscription in realtime session config

Add inputAudioTranscription to the Vertex AI realtime setup so the backend returns transcripts of user speech, allowing guardrails to inspect voice input.

Made-with: Cursor

* fix(realtime): pass user_api_key_dict and guardrail metadata through async_realtime handler

The base LLM HTTP handler's async_realtime method was not accepting or forwarding user_api_key_dict and litellm_metadata to RealTimeStreaming. This meant guardrails configured with default_on=false were silently skipped for all provider_config-based realtime connections (Gemini, Vertex AI, etc). Also fixes wss:// connections when SSL_VERIFY=False by overriding ssl=False for secure WebSocket URLs.

Made-with: Cursor

* fix(realtime): forward guardrail metadata for generic provider_config and vertex_ai paths

The _arealtime function was not passing user_api_key_dict or litellm_metadata to base_llm_http_handler.async_realtime() for the generic provider_config path and the vertex_ai-specific path. This broke guardrail resolution since RealTimeStreaming.request_data was empty, causing should_run_guardrail to return False.

Made-with: Cursor

* fix(realtime): voice guardrail responses and block duplicate response.create on text input

When a guardrail blocks voice input, send a conversation.item.create + response.create to the backend so the LLM voices the guardrail message as audio instead of only returning text. Also adds pending_guardrail_message tracking to suppress the automatic response.create the client sends after a blocked text message, and broadens _has_audio_transcription_guardrails to match pre_call/post_call modes.

Made-with: Cursor

* test(realtime): update guardrail tests for broadened audio transcription check and add integration tests

Update existing tests to reflect that pre_call guardrails now correctly trigger the audio/VAD session.update injection. Add integration test file for live OpenAI realtime guardrail testing.

Made-with: Cursor

* fix(realtime): instruct LLM to say exact guardrail message verbatim

The previous prompt gave the LLM creative freedom to paraphrase the guardrail violation message. Now it instructs the LLM to repeat the exact configured message word for word.

Made-with: Cursor

* fix(realtime): preserve wss ssl semantics and move live guardrail test

Keep TLS enabled for wss realtime sessions while honoring SSL_VERIFY=False via a no-verify SSLContext, move the OpenAI live guardrail test into llm_translation, and dedupe duplicated guardrail-detection helpers to prevent drift.

Made-with: Cursor
2026-02-26 17:06:07 -08:00
yuneng-jiang
28c77b48c9 fix +Inf user budget metric when metadata max_budget is None
Same bug as team budget: _assemble_user_object fetched user info from DB
but only used budget_reset_at, discarding max_budget. When the key cache
has a stale None for user_max_budget, _safe_get_remaining_budget returns
+Inf. Now falls back to DB max_budget when metadata value is None.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 16:57:31 -08:00
yuneng-jiang
0e1428b59d remove orphan comment from test file
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-26 16:51:18 -08:00
Ishaan Jaff
9546d9b482
_add_dd_apm_tags_for_litellm_call_id (#22219) 2026-02-26 16:42:23 -08:00
yuneng-jiang
f4e3e016a1 fixing inf budget 2026-02-26 16:30:41 -08:00
yuneng-jiang
d5ef6c7f93
Merge pull request #22238 from BerriAI/litellm_supported_endpoints
[Feature] Add /public/supported_endpoints endpoint
2026-02-26 15:38:29 -08:00
yuneng-jiang
efcc856234 Move provider_endpoints_support.json into litellm package
The file was at the repo root and excluded from pip distributions. Moving it to litellm/proxy/public_endpoints/ alongside the other provider JSON files ensures it is packaged correctly. Updates all references in the endpoint handler, coverage tests, and release notes instructions.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-26 15:15:16 -08:00
yuneng-jiang
c20e49620f [Feature] Add /public/supported_endpoints endpoint
Return all supported endpoints and which providers support them. Includes endpoint display names, URL paths, and per-provider support lists. Results are cached for the process lifetime.

Also adds comprehensive test coverage for the new endpoint.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-26 15:01:25 -08:00
ryan-crabbe
3639800892
Merge pull request #22221 from BerriAI/litellm_prometheus_multiproc_cleanup
Litellm prometheus multiproc cleanup
2026-02-26 13:51:00 -08:00