Commit Graph
6901 Commits
Author SHA1 Message Date
yuneng-jiangandGitHub 71c3503e57 Revert "[Feature] Add /public/supported_endpoints endpoint" 2026-02-26 17:21:43 -08:00
yuneng-jiangandGitHub 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 JaffandGitHub 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-jiangandClaude Sonnet 4.6 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-jiangandClaude Haiku 4.5 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 JaffandGitHub 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-jiangandGitHub 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-jiangandClaude Haiku 4.5 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-jiangandClaude Haiku 4.5 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-crabbeandGitHub 3639800892 Merge pull request #22221 from BerriAI/litellm_prometheus_multiproc_cleanup
Litellm prometheus multiproc cleanup
2026-02-26 13:51:00 -08:00
Ryan Crabbe 0ee8cb5f02 refactor: remove shutdown cleanup, rely solely on startup wipe
Phase 2 (per-worker mark_process_dead on shutdown) only ever fired
when all workers shut down together, making it redundant — Phase 1
wipes everything on next startup anyway. This aligns with the
prometheus_client docs: just wipe the directory between runs.
2026-02-26 12:17:31 -08:00
Ishaan JaffandGitHub cbdaaaeba4 [Feat] Add control for setting upperbound on chunk processing time (#22209)
* add LITELLM_MAX_STREAMING_DURATION_SECONDS

* add add LITELLM_MAX_STREAMING_DURATION_SECONDS

* fix: address Greptile review - rename constant, add sync check, add tests

- Rename MAX_STREAMING_CHUNK_DURATION_S → MAX_STREAMING_DURATION_S (misleading "CHUNK")
- Add _check_max_streaming_duration to SyncResponsesAPIStreamingIterator.__next__
- Add 8 unit tests covering both CustomStreamWrapper and ResponsesAPI paths
- Fix pre-existing pyright errors in streaming_handler.py

Made-with: Cursor

* add add LITELLM_MAX_STREAMING_DURATION_SECONDS
2026-02-26 11:39:09 -08:00
yuneng-jiangandGitHub 50bf2da05e Merge pull request #22137 from BerriAI/litellm_key_info_crash_fix
[Fix] /key/aliases: Add pagination and search to prevent OOMs
2026-02-26 10:27:10 -08:00
Harshit JainandGitHub 4d2fab49a7 Merge pull request #22164 from Harshit28j/litellm_custom_auth_budget_fix
fix: custom auth budget issue
2026-02-26 23:38:38 +05:30
yuneng-jiang 857a324f7a Merge remote-tracking branch 'origin' into litellm_key_info_crash_fix 2026-02-26 10:04:54 -08:00
Ryan Crabbe acfb5ade97 refactor: remove periodic dead PID cleanup, trim redundant tests
Startup wipe + graceful shutdown cleanup are sufficient. Remove
hourly mark_dead_pids scan, its helpers, and redundant test cases.
2026-02-26 10:03:51 -08:00
michelligabrieleandGitHub ae13a40c01 test(mcp): add e2e test for stateless StreamableHTTP behavior (#22033)
Adds TestProxyMcpStatelessBehavior to test_proxy_mcp_e2e.py with a test
that verifies two independent MCP clients can connect, initialize, and
call tools without sharing session state. This catches the regression
from PR #19809 where stateless=False broke clients that don't manage
mcp-session-id headers.

Regression test for #20242
2026-02-26 09:30:03 -08:00
Sameer KankuteandGitHub 1790a6bf82 Merge pull request #21604 from michelligabriele/fix/websearch-thinking-blocks
fix(websearch_interception): preserve thinking blocks in agentic loop follow-up messages
2026-02-26 22:26:38 +05:30
Julio Quinteros ProandClaude Opus 4.6 ace49b18d3 fix(tests): update MCP server test mocks to match production API
The tests were mocking `filter_server_ids_by_ip` but the production
code in server.py now calls `filter_server_ids_by_ip_with_info` which
returns a (server_ids, blocked_count) tuple. Update all 8 mock sites
to use the correct method name and return signature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 13:11:57 -03:00
Sameer KankuteandGitHub 6600c86dbd Merge pull request #22170 from BerriAI/litellm_fix_video_veo_vertex
Fix: Passing of image and parameters in videos api
2026-02-26 18:55:25 +05:30
Sameer KankuteandGitHub 16d6c279da Merge pull request #22180 from BerriAI/litellm_fix_vllm_test
Add JSON exact match test for vLLM embeddings
2026-02-26 18:43:52 +05:30
Sameer KankuteandGitHub dc1e97d345 Merge pull request #22144 from BerriAI/litellm_allowed_openai_params_embeddings
fix(embeddings): allow dimensions param passthrough via allowed_openai_params for non-text-embedding-3 OpenAI models
2026-02-26 18:41:47 +05:30
Sameer KankuteandGitHub 2772c88864 Merge pull request #22142 from BerriAI/litellm_fix_mcp_server_ip
Return Clear error message why no tools are available / IP Filtering occured
2026-02-26 18:41:22 +05:30
Sameer KankuteandGitHub 95b8fb823b Revert "fix(proxy): improve auth exception logging levels and add structured …"
This reverts commit efeaf650aa.
2026-02-26 18:38:52 +05:30
Sameer KankuteandGitHub 87b4fed967 Merge pull request #22186 from BerriAI/main
merge main
2026-02-26 18:21:38 +05:30
Sameer KankuteandGitHub d9cd3ea185 Merge pull request #22181 from mubashir1osmani/fix/arize-phoenix-nested-traces-test-update
fix(test): update Phoenix OTEL test
2026-02-26 17:12:17 +05:30
mubashir1osmaniandClaude 3c595f6fd2 fix(test): update Phoenix OTEL test for dedicated TracerProvider architecture
The old test assumed ArizePhoenixLogger reused the global TracerProvider.
With the nested traces fix, Phoenix now creates its own dedicated provider
and produces litellm_proxy_request + litellm_request + raw_gen_ai_request
spans independently.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-26 06:40:24 -05:00
Sameer Kankute 1a3d4c80db Add JSON exact match test for vLLM embeddings 2026-02-26 16:49:34 +05:30
Sameer KankuteandGitHub ecbefc0735 Merge pull request #22169 from mubashir1osmani/fix/arize-phoenix-nested-traces
fix: arize phoenix nested traces
2026-02-26 16:24:20 +05:30
mubashir1osmaniandClaude 96bcee0b0a fix(arize-phoenix): enable nested traces coexistence with otel callback
- ArizePhoenixLogger now creates spans on its own dedicated TracerProvider
  instead of trying to reuse parent spans from the global otel TracerProvider
  (which were invisible in Phoenix since they go to a different exporter)
- Auto-initialize ArizePhoenixLogger when otel callback is configured and
  Phoenix env vars (PHOENIX_API_KEY, PHOENIX_COLLECTOR_*) are detected
- Use exact type check in get_custom_logger_compatible_class to prevent
  ArizePhoenixLogger (subclass) from being returned when looking up otel
- Fix tool_permission guardrail to check non-function tools like
  code_interpreter (previously skipped with `type != "function"`)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-26 04:59:17 -05:00
Harshit28j 39af85da53 fix: req changes 2026-02-26 15:19:32 +05:30
Sameer Kankute aeb723816f Fix: Passing of image and parameters in videos api 2026-02-26 14:49:46 +05:30
Roni FrantchiandGitHub 475bb94f5a fix(adapter): populate cache_read_input_tokens from prompt_tokens_details for OpenAI/Azure (#22090)
* fix(adapter): populate cache_read_input_tokens from prompt_tokens_details

The Anthropic adapter's translate_openai_response_to_anthropic checked
only the private _cache_read_input_tokens attr (set by Anthropic/DeepSeek)
but not prompt_tokens_details.cached_tokens (set by OpenAI/Azure).

Use prompt_tokens_details.cached_tokens directly — it is already extracted
and is the standard field populated by all providers.

Fixes #22089

* fix(adapter): apply same cache_read_input_tokens fix to streaming path

The streaming path in translate_streaming_openai_response_to_anthropic
had the same bug — relying on _cache_read_input_tokens instead of
prompt_tokens_details.cached_tokens.
2026-02-26 00:10:18 -08:00
Benedikt ÓskarssonGitHubgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
efeaf650aa fix(proxy): improve auth exception logging levels and add structured context (#22099)
* fix(proxy): improve auth exception logging levels and add structured context

Downgrade expected auth failures (ProxyException, HTTPException < 500,
BudgetExceededError) from ERROR to WARNING log level to reduce noise from
routine rejected requests (e.g. missing/invalid API keys on polled endpoints
like /schedule/model_cost_map_reload/status).

Unexpected exceptions and HTTPException with status >= 500 still log at
ERROR with full traceback.

Enrich log messages with structured context: route, HTTP method, masked
API key (using existing abbreviate_api_key), error type, and error code.
All fields also passed via log extra dict for log aggregation tools.

Fixes #21293

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

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

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-26 00:08:35 -08:00
Gaurav SinghandGitHub f3e31bc8ef fix(proxy): honor MAX_STRING_LENGTH_PROMPT_IN_DB from config env vars (#22106)
* fix(proxy): honor MAX_STRING_LENGTH_PROMPT_IN_DB from config env vars

* fix(proxy): reuse constants fallback for MAX_STRING_LENGTH_PROMPT_IN_DB runtime resolver

* test(proxy): restore PEP8 spacing between spend tracking tests
2026-02-26 00:06:18 -08:00
Sameer KankuteandGitHub 4d68151d03 Merge pull request #22151 from BerriAI/litellm_fix_cicd_26_02
[Fix] CICD 26/02/26
2026-02-26 13:30:23 +05:30
Ishaan JaffGitHubgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
965ca117bc feat(realtime guardrails): end_session_after_n_fails + Endpoint Settings wizard step (#22165)
* feat(realtime guardrails): end_session_after_n_fails + Endpoint Settings wizard step

Adds per-session violation thresholds and an optional endpoint-settings step
to the guardrail wizard for /v1/realtime.

Backend:
- Add end_session_after_n_fails, on_violation, realtime_violation_message fields
  to BaseLitellmParams (no DB migration — stored in existing JSON column)
- Store same fields on CustomGuardrail instance attrs
- Pass through in litellm_content_filter initializer
- Track _violation_count per RealTimeStreaming session; close backend_ws when
  on_violation=end_session OR violation count >= end_session_after_n_fails
- Use realtime_violation_message as the spoken text (falls back to guardrail
  error string if not configured)

UI (add_guardrail_form.tsx):
- Rename "Default Categories" step to "Topics"
- Add step 5 "Endpoint Settings (Optional)" for content filter guardrails
- Call type dropdown shows /v1/realtime
- Settings are in a collapsed accordion (closed by default)
- "End session after X violations" + on_violation radio + spoken message field

Tests: 2 new tests in test_realtime_streaming.py
- test_end_session_after_n_fails_closes_connection
- test_on_violation_end_session_closes_on_first_fail

* fix(test): move inline imports to module level in realtime streaming tests

* Update ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.tsx

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

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-25 23:49:03 -08:00
Ishaan JaffandGitHub 819581f6bf fix(realtime): guardrails with pre_call/post_call mode now work on realtime WebSocket (#22161)
* fix(realtime): guardrails with pre_call/post_call mode now work on realtime WebSocket; return error directly to consumer

* fix(realtime guardrails): address code review feedback

- Restore session.update injection for audio/VAD path, but only when
  realtime_input_transcription guardrails are configured (not pre_call).
  Forward session.created to the client first so no error arrives before
  the client sees the session.
- Change _swallow_next_response_create bool to int counter so consecutive
  blocked items are handled correctly.
- Extract _build_litellm_metadata() helper to eliminate duplicated
  metadata-building logic across OpenAI/Azure/XAI provider branches.
- Plumb litellm_metadata and user_api_key_dict to Azure and XAI handlers
  so guardrails work for those providers too.
- Add tests for session.update injection, no-inject for pre_call-only,
  and consecutive-block counter.

* simplify: remove response.create swallowing after guardrail block

When an item is blocked, the error event is already sent to the client.
The subsequent response.create from the client is fine to forward through —
the LLM may respond to previous context which is acceptable behavior.
Removing the swallow counter eliminates unnecessary state tracking.
2026-02-25 23:43:13 -08:00
Sameer Kankute 8f8ebbec8d Fix test_vertex_passthrough_forwards_anthropic_beta_header 2026-02-26 13:06:25 +05:30
Harshit28j 14badde13c fix: custom auth budget issue 2026-02-26 13:03:01 +05:30
Sameer Kankute 143e8dfe27 Fix pass through tests 2026-02-26 12:55:59 +05:30
Sameer Kankute 0debe92605 Fix_mapped tests part 2 2026-02-26 12:43:39 +05:30
Sameer Kankute 9c7f8138e1 FIx : litellm/tests/test_litellm/proxy/management_endpoints/test_key_management_endpoints.py 2026-02-26 12:43:06 +05:30
Sameer Kankute 7cda0e4edd Fix code qa 2026-02-26 12:43:06 +05:30
Sameer KankuteandGitHub 5e63969ed7 Merge branch 'main' into litellm_fix_cicd_26_02 2026-02-26 12:14:49 +05:30
Sameer Kankute a54cf53ffb Fix test_standard_logging_payload_includes_guardrail_information 2026-02-26 12:13:26 +05:30
Sameer Kankute f34b0366a3 Fix: test_gaurdrails* 2026-02-26 12:10:49 +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
Sameer Kankute 2d231c2f1a Fix code qa 2026-02-26 12:08:40 +05:30