Commit graph

5673 commits

Author SHA1 Message Date
Yuneng Jiang
77f2d8ed95
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:28:32 -07:00
Sameer Kankute
5485772a5a Fix encrypted content streaming affinity issue 2026-03-03 18:16:00 +05:30
Sameer Kankute
47daadd125 Add docs for opt out variable 2026-03-03 18:16:00 +05:30
Sameer Kankute
a1be8177ed Fix code qa 2026-03-03 18:15:50 +05:30
Ishaan Jaff
eb8b74a14e feat(vertex_ai): Vertex AI Gemini Live via unified /realtime endpoint (#22153)
* feat(vertex_ai): add Vertex AI Gemini Live support via unified /realtime endpoint

Adds VertexAIRealtimeConfig which translates the OpenAI Realtime WebSocket
protocol to Vertex AI BidiGenerateContent. Supports voice in/voice out
(16 kHz mic → 24 kHz speaker) and text in/text out through the proxy's
/realtime endpoint.

Key changes:
- New litellm/llms/vertex_ai/realtime/transformation.py with VertexAIRealtimeConfig
  - Builds correct wss:// URL (regional + global)
  - OAuth2 Bearer token auth (not API key)
  - Full model path (projects/.../publishers/google/models/...)
  - Ignores session.update (Vertex AI only accepts one setup message)
- realtime_api/main.py: vertex_ai branch resolves OAuth token + constructs config
- llm_http_handler.py: auto-sends session setup before bidirectional_forward
- gemini/realtime/transformation.py: fix crashes on empty turnComplete events
- realtime_streaming.py: try/except guard so bad messages don't kill the loop
- proxy_server.py: add missing websockets.exceptions import

* docs: add vertex_realtime to sidebars

* fix: drop unknown event types in Gemini transform; add vertex_ai health check

* fix: propagate UUID fallback IDs from transform_content_done_event to return_additional_content_done_events

* fix: route guardrail backend sends through provider transform; fix str.strip misuse for model prefix

* fix: handle Vertex AI full resource path in session.created; route guardrail block sends through _send_to_backend

* fix: remove unused VertexBase in transformation.py; apply UUID fallback in return_additional_content_done_events
2026-03-03 18:15:28 +05:30
Ishaan Jaff
6c5cf440e8 feat(realtime): guardrails support for /v1/realtime WebSocket endpoint (#22152)
* feat(realtime): add guardrails query param to /v1/realtime WebSocket endpoint

- Add 'guardrails' query param (comma-separated) to realtime_websocket_endpoint
- Import websockets and websockets.exceptions at module level (fixes NameError in except clause)
- Split try/except into Phase 1 (pre-call) and Phase 2 (routing) so guardrail
  errors send back a typed error event before closing, while upstream errors
  close silently with 1011

* feat(ui): pass selectedGuardrails from sidebar to RealtimePlayground WebSocket URL

* docs(realtime): add guardrails section with dynamic passing examples
2026-03-03 18:15:28 +05:30
Steve G
68512bdc05 Add Lakera v2 post-call hook and tests (fixed PII masking) (#21783)
* Add post-call hook for Lakera guardrail and mask PII in responses

* Add post-call hook for Lakera and mask PII in responses

* Fix post-call hook: pass event_type to call_v2_guard

* Address Greptile review: return ModelResponse, fix mutation, add header, test location, mask order

- PII masking path: return ModelResponse instead of dict so deployment hook accepts it
- Avoid mutating request data: deep copy original_messages and messages in _mask_pii_in_messages
- Add guardrail header in PII-only return path
- Add test in tests/test_litellm/ (test_lakera_ai_v2.py) per PR checklist
- Sort PII payload spans by (start,end) descending so multiple spans in one message mask correctly

Co-authored-by: Cursor <cursoragent@cursor.com>

* Updated ponteital for index mismatch when choices have null content and inconsistent on_flagged access pattern

* Update litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py

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

* Update to explicitly state supported endpoints - chat completions

* Fix minor lint error on masked_entity_count

---------

Co-authored-by: Steve <steve.giguere@lakera.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-03 18:15:27 +05:30
Ishaan Jaff
6ca4a9b2ce Proxy request tags docs (#22129)
* docs: document x-litellm-tags header and request body tags parameter

- Add documentation for x-litellm-tags header (comma-separated or array)
- Add documentation for tags in request body
- Clarify that dynamic tags override config tags

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

* docs: consolidate tag documentation and improve cross-references

- Make request_tags.md the single source of truth for all tag options
- Add cross-reference from cost_tracking.md to request_tags.md
- Document both direct tags and metadata.tags formats
- Add key/team tag setup and custom header tracking to request_tags.md
- Reduce duplication and make navigation clearer

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

* docs: use generic examples instead of specific company names

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

* docs: clarify x-litellm-tags header format is comma-separated string

HTTP headers are always strings, not arrays. Remove misleading
array format documentation for the header parameter.

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

* Update docs/my-website/docs/proxy/request_tags.md

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

---------

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-03-03 18:15:27 +05:30
yuneng-jiang
f4dc7c665f [Docs] Add Credential Usage Tracking documentation
Add new document explaining automatic credential usage tracking and tagging. When models use reusable credentials, LiteLLM automatically injects a Credential: <name> tag on requests, enabling credential-level spend tracking on the Usage page with no additional configuration.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-03 18:15:17 +05:30
Sameer Kankute
68993c510c Fix docs 2026-03-03 18:15:16 +05:30
Sameer Kankute
ef9414cdc9 Fix docs 2026-03-03 18:15:16 +05:30
Sameer Kankute
0ab766ed75 add docs for Authentication Headers forwarding 2026-03-03 18:15:16 +05:30
Harshit28j
893eeef1ad fix(guardrails): prevent presidio crash on non-json responses 2026-03-03 18:15:16 +05:30
Harshit Jain
0880e1160e fix: Metadata / Trace ID Missing in S3 Streaming Callbacks 2026-03-03 18:15:16 +05:30
Ryan Crabbe
28a225d8bd fix: add prompt_cache_key and prompt_cache_retention support for OpenAI
These params were silently dropped for Chat Completions because they
were missing from the supported params whitelist. Also adds
prompt_cache_retention to the Responses API TypedDict and fixes
misleading cache_control comments in OpenAI prompt caching docs.
2026-03-03 18:15:05 +05:30
Ryan Crabbe
6cda26fc75 docs: add trailing slash to /mcp endpoint URLs
The /mcp endpoint requires a trailing slash because the MCP server
is mounted as a sub-application using app.mount(). Starlette's mount
behavior causes a 307 redirect from /mcp to /mcp/, which many MCP
clients fail to handle.

Updates documentation examples to use /mcp/ consistently.
2026-03-03 18:15:05 +05:30
Ishaan Jaff
ac2f2da0d7 docs: update v1.81.12-stable release notes to point to v1.81.12-stable.1 (#22036) 2026-03-03 18:14:40 +05:30
Sameer Kankute
dec036464b Fix phase docs link 2026-03-03 18:14:40 +05:30
Sameer Kankute
6ab5042ca0 Fix phase docs link 2026-03-03 18:14:40 +05:30
Sameer Kankute
4bb9882d5b Fix release version for gpt-5.3-codex 2026-03-03 18:14:40 +05:30
Sameer Kankute
00d5d83c6b Add documentation related to phase 2026-03-03 18:14:40 +05:30
Ishaan Jaff
e0818b1696 feat(prometheus): add opt-in stream label to litellm_proxy_total_requests_metric (#22023)
Set prometheus_emit_stream_label: true in litellm_settings to emit a
stream label (True/False/None) on litellm_proxy_total_requests_metric.

Opt-in to avoid breaking cardinality on existing deployments.
2026-03-03 18:14:40 +05:30
shivam
53bfcfb9ec replaced with mock key 2026-03-03 18:14:40 +05:30
Kesku
003cdc43df feat(perplexity): update Responses API integration to match Agent API
- Rename "Agentic Research API" to "Agent API"
Expand
- supported Responses API parameters
- Fix function
tool handling to pass custom function tools through unchanged instead of heuristically mapping them.
 -Update model registry with current Perplexity
models and presets
- Add Function Calling and Structured Outputs documentation sections.
- Unit tests for transformation logic.
2026-03-03 18:13:36 +05:30
Harshit28j
b7f0721c66 security: fix critical/high CVEs in OS-level libs and NPM transitive 2026-03-03 18:13:36 +05:30
Sameer Kankute
26c414f285 Update the docs 2026-02-27 16:01:23 +05:30
Sameer Kankute
db0ece391c ADd incident report 2026-02-24 16:24:57 +05:30
Sameer Kankute
863867c4fe Add docs for encrypted_content_affinity 2026-02-24 16:22:15 +05:30
Ishaan Jaff
c79d94fd16
feat(realtime): guardrail hook for voice transcription (#21976)
* feat(realtime): add guardrail hook for voice transcription in Realtime API

Adds a new `realtime_input_transcription` guardrail event hook that fires
after Whisper transcription completes, before the LLM generates a response.

When a guardrail blocks, a synthetic warning is sent to the client and
`response.create` is never forwarded — the LLM never responds.

Also rewrites `create_response: true` → `false` in client `session.update`
so the proxy controls when responses are triggered.

* feat(realtime): speak guardrail block message as audio via TTS

Instead of sending synthetic text events when a guardrail blocks,
send response.create with forced instructions so OpenAI's TTS speaks
the warning message — user hears the block instead of just seeing text.

* fix(realtime): speak exact content filter error message via TTS

Extract the human-readable error string from HTTPException.detail
so the spoken warning says e.g. "Content blocked: keyword 'system update'
detected" instead of the raw str(e) repr.

* fix(realtime): reliably enforce create_response=false for guardrails

- Proxy now injects session.update with create_response=false immediately
  on session.created (when guardrails are active), instead of rewriting
  the client's session.update — works regardless of what the client sends
- Add response.cancel before the warning response.create to kill any
  in-flight LLM response that snuck through before the guardrail fired

* refactor(realtime): call apply_guardrail directly, remove dedicated hook method

The async_realtime_input_transcription_hook in CustomGuardrail and
ContentFilterGuardrail was just a thin wrapper that called apply_guardrail —
the same interface used by /chat and /messages. Remove the wrapper and call
apply_guardrail directly from run_realtime_guardrails, keeping the pattern
consistent across all endpoints.

* docs: add Realtime API guardrails tutorial and flow diagram

* fix: address Greptile review comments

- Forward user_api_key_dict through realtime_api/main.py (_arealtime) so
  it actually reaches RealTimeStreaming instead of always being None
- Run guardrail interception in provider_config path too (e.g. Gemini),
  not only the OpenAI direct path
- Narrow exception catch to HTTPException/ValueError only; re-raise
  unexpected errors so programming bugs surface in logs rather than
  silently appearing as guardrail blocks
- Update tests: mock apply_guardrail directly (hook method was removed),
  replace session.update client-rewrite test with session.created
  injection test matching the new server-side approach

* fix: address latest Greptile review comments

- Remove fastapi import from SDK-layer file; check for status_code/detail
  attrs instead to identify guardrail-block exceptions vs programming errors
- Add store_message() before continue in transcription interception so
  transcription events are logged in the non-provider_config path
- Inject create_response=false on session.created in provider_config path
  (Gemini etc.) to match the OpenAI path — prevents LLM auto-responding
  before guardrail runs on VAD-detected turns
2026-02-23 21:04:40 -08:00
Nicolò Pignatelli
b8dddab311
feat: add groq/openai/gpt-oss-safeguard-20b model pricing (#21951)
* feat: add groq/openai/gpt-oss-safeguard-20b model pricing

Add pricing and context window data for OpenAI's GPT-OSS-Safeguard-20B
model on Groq, a reasoning model trained for safety classification tasks.

- Input: $0.075/1M tokens
- Cached input: $0.037/1M tokens
- Output: $0.30/1M tokens
- Context window: 131,072 tokens
- Max output: 65,536 tokens

Reference: https://console.groq.com/docs/model/openai/gpt-oss-safeguard-20b

* docs: add gpt-oss-safeguard-20b to Groq provider docs
2026-02-23 21:03:18 -08:00
Harshit Jain
a15c4db499
Merge pull request #21949 from BerriAI/fix/presidio-streaming-false-positives
fix: presidio streaming, false positives
2026-02-24 10:09:47 +05:30
Sameer Kankute
3b2ff5b06a Fix cicd code quality 2026-02-24 09:22:40 +05:30
ryan-crabbe
0ca9869b99
Merge pull request #21950 from ryan-crabbe/docs/v1-81-14-perf-section
docs: add performance & reliability section to v1.81.14 release notes
2026-02-23 13:13:21 -08:00
Arindam Majumder
71b4bd12a7
Add OpenAI Agents SDK tutorial with LiteLLM Proxy to docs (#21221)
* Add OpenAI Agents SDK tutorial to docs

* Update OpenAI Agents SDK tutorial to use LiteLLM environment variables

* Enhance OpenAI Agents SDK tutorial with built-in LiteLLM extension details and updated configuration steps. Adjust section headings for clarity and improve the flow of information regarding model setup and usage.
2026-02-23 12:10:01 -08:00
Ryan Crabbe
67ceade162 docs: add performance & reliability section to v1.81.14 release notes 2026-02-23 11:23:29 -08:00
Harshit28j
af9ad68a43 fix: presidio streaming, false positives 2026-02-24 00:42:29 +05:30
ryan-crabbe
c4c48fe977
Merge pull request #21942 from BerriAI/litellm_network_mock
feat: Litellm network mock
2026-02-23 10:07:11 -08:00
yuneng-jiang
bba98c2f15
Merge pull request #21886 from Chesars/docs/ui-contributing-pre-pr-checklist
docs(ui): add pre-PR checklist to UI contributing guide
2026-02-23 09:50:26 -08:00
Ryan Crabbe
8244ad1f0e docs: tweak benchmarks wording 2026-02-23 09:50:02 -08:00
Ryan Crabbe
5b41b009f6 docs: add network mock benchmarking section 2026-02-23 09:44:02 -08:00
Cesar Garcia
64d1de0552
docs: add Google GenAI SDK tutorial (JS & Python) (#21885)
* docs: add Google GenAI SDK tutorial for JS and Python

Add tutorial for using Google's official GenAI SDK (@google/genai for JS,
google-genai for Python) with LiteLLM proxy. Covers pass-through and
native router endpoints, streaming, multi-turn chat, and multi-provider
routing via model_group_alias. Also updates pass-through docs to use the
new SDK replacing the deprecated @google/generative-ai.

* fix(docs): correct Python SDK env var name in GenAI tutorial

GOOGLE_GENAI_API_KEY does not exist in the google-genai SDK.
The correct env var is GEMINI_API_KEY (or GOOGLE_API_KEY).
Also note that the Python SDK has no base URL env var.

* fix(docs): replace non-existent GOOGLE_GENAI_BASE_URL env var in interactions.md

The Python google-genai SDK does not read GOOGLE_GENAI_BASE_URL.
Use http_options={"base_url": "..."} in code instead.
2026-02-23 09:20:46 -08:00
Krrish Dholakia
a26f83fd3c fix: update calendly on repo 2026-02-23 06:13:59 -08:00
Sameer Kankute
9b5bbee906
Merge pull request #21786 from BerriAI/litellm_oss_staging_02_21_2026
Litellm oss staging 02 21 2026
2026-02-23 18:51:55 +05:30
Sameer Kankute
8decf04d8a
Merge pull request #21877 from BerriAI/litellm_oss_staging_02_22_2026
Litellm oss staging 02 22 2026
2026-02-23 18:50:47 +05:30
Sameer Kankute
37d45139f2
Merge pull request #21917 from BerriAI/litellm_fix_model_cost_map_wildcard
Fix: Anthropic model wildcard access issue
2026-02-23 18:45:49 +05:30
TomAlon
99184c48d9
Add Noma guardrails v2 based on custom guardrails (#21400) 2026-02-23 05:05:27 -08:00
Sameer Kankute
c7aafdf794
Merge pull request #21926 from BerriAI/main
merge main in oss 21 02
2026-02-23 18:17:30 +05:30
Sameer Kankute
57af8e6a93
Merge pull request #21924 from BerriAI/main
merge main in oss 22 02
2026-02-23 18:11:36 +05:30
Sameer Kankute
eaf3900200 Fix name of title 2026-02-23 17:18:31 +05:30
Sameer Kankute
9b27cd8c0e Add incident report 2026-02-23 17:13:44 +05:30