Commit Graph
27109 Commits
Author SHA1 Message Date
Ishaan Jaffer 0a8ae52014 test_guardrail_status_fields_computation 2025-11-06 16:56:50 -08:00
Ishaan Jaffer e6d7a0a153 test fixes 2025-11-06 16:29:18 -08:00
Ishaan Jaffer 89a73b853a fix cyber ark 2025-11-06 16:26:14 -08:00
Ishaan Jaffer 830a9e9585 docs fix 2025-11-06 16:22:17 -08:00
Ishaan Jaffer abd090f151 fix Tuple 2025-11-06 16:19:10 -08:00
Ishaan Jaffer 61cf169926 test_basic_openai_responses_api_streaming 2025-11-06 16:18:30 -08:00
Ishaan Jaffer 7ec2d103f6 test router endpoitns 2025-11-06 16:17:14 -08:00
Ishaan Jaffer 811b5a3c98 test_firecrawl_search_request_body 2025-11-06 16:15:02 -08:00
Ishaan Jaffer 21757af83d parse_jsonl_with_embedded_newlines 2025-11-06 16:05:12 -08:00
Ishaan JaffandGitHub bdc4969526 [Feat] UI - Allow configuring LiteLLM Custom Guardrail (#16339)
* add ContentFilterAction

* store pre-built regex patterns

* add v0 of content filter guard

* add _filter_messages

* test content filter guard

* init ContentFilterGuardrail

* fix ContentFilterGuardrail enums

* rename folder

* fix litellm_content_filter

* refactor content filter guard

* test content filter

* add streaming for ContentFilterGuardrail

* test_streaming_hook_mask

* add litellm_content_filter

* docs show litellm content filter

* docs litellm content filter

* fix lnting

* use ENUM for PrebuiltPatternName

* fix validate_blocked_words_file

* add validateBlockedWordsFile

* LitellmContentFilterGuardrailConfigModel

* add get_config_model

* add litellm content filter

* refactored ui

* fix config

* tests for new components
2025-11-06 16:03:55 -08:00
Ishaan JaffGitHubCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
18a5c4f75a [Feat] Add LiteLLM Gateway built in guardrail (#16338)
* add ContentFilterAction

* store pre-built regex patterns

* add v0 of content filter guard

* add _filter_messages

* test content filter guard

* init ContentFilterGuardrail

* fix ContentFilterGuardrail enums

* rename folder

* fix litellm_content_filter

* refactor content filter guard

* test content filter

* add streaming for ContentFilterGuardrail

* test_streaming_hook_mask

* add litellm_content_filter

* docs show litellm content filter

* docs litellm content filter

* fix lnting

* Potential fix for code scanning alert no. 3675: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-11-06 16:02:28 -08:00
Cesar GarciaandGitHub 1fec48499f fix: Pass extra_body to provider in Responses API requests (#16320)
## Problem
The `extra_body` parameter in `litellm.responses()` and `litellm.aresponses()`
was being accepted but never passed to the HTTP request sent to the LLM provider.
This prevented users from sending custom/experimental parameters to provider APIs.

## Changes
- Added `data.update(extra_body)` in `async_response_api_handler` (line 2138)
- Added `data.update(extra_body)` in `response_api_handler` (line 2012)
- Added tests to `test_openai_responses_api.py` for extra_body functionality

## Testing
- Tests verify extra_body params are passed in both sync and async modes
- Existing Responses API tests continue to pass
- Manually verified with OpenAI API that custom params are sent correctly

## Impact
Users can now pass custom/experimental parameters via extra_body:
```python
litellm.aresponses(
    model="gpt-4o",
    input="hello",
    extra_body={"custom_param": "value"}  # Now works!
)
```

This aligns with the OpenAI SDK pattern and matches behavior in other
LiteLLM endpoints (completion, embedding, etc.) that already support extra_body.
2025-11-06 14:54:40 -08:00
Ishaan JaffandGitHub c98b125851 [Feat] OTEL - Log Cost Breakdown on OTEL Logger (#16334)
* add gen_ai cost metrics

* TestOpenTelemetryCostBreakdown

* fix QA check

* validate_redacted_message_span_attributes
2025-11-06 13:53:53 -08:00
Sameer KankuteandGitHub b762493ec5 Remove aws params from claude4_5 request (#16315) 2025-11-06 10:10:30 -08:00
Sameer KankuteandGitHub 9dc22eed5c Update container documentation to be similar to others (#16327) 2025-11-06 10:08:45 -08:00
yuneng-jiangandGitHub b5956e0595 Add Azure AD Token field to Add Model Azure and make API Key not required (#16331) 2025-11-06 09:52:39 -08:00
Sameer KankuteandGitHub ee50f09e73 Added xai responses support (#16310) 2025-11-06 08:39:28 -08:00
Sameer KankuteandGitHub 11508c0339 Remove reasoning support from grok-4 models (#16265) 2025-11-05 18:44:05 -08:00
Krish DholakiaandGitHub 80440e11a7 Revert "Update MCP version from 1.10.1 to 1.20.0 (#16281)" (#16300)
This reverts commit 34c12d0131.
2025-11-05 18:42:34 -08:00
Sameer KankuteandGitHub 34abb7de1a Add azure gpt-5-pro in model map (#16235) 2025-11-05 18:41:53 -08:00
Jamie GoodyearandGitHub 2c9970742f [LiteLLM-16250] Proxy to Bedrock will add name to file content, breaks when cache_control in use (#16275) 2025-11-05 18:39:38 -08:00
Cesar GarciaandGitHub 12284308a3 fix: Resolve MyPy type checking errors and CI linting (#16277)
* fix: Remove unused asyncio import from litellm_logging.py

- Fixes F401 linting error blocking CI

* fix: Add type ignore comments for MyPy false positives

- redis_cache.py: Add type ignore for aclose() - method exists but redis-py type stubs are incomplete
- redis_cluster_cache.py: Add type ignore for ping() and aclose() - redis-py typing issue
- responses/utils.py: Add type ignore for variable shadowing false positive
- transformation.py: Add type ignore for TypedDict expansion - runtime works correctly
- aws_secret_manager_v2.py: Add type ignore for dict[str, Any] assignment

All changes are safe - code works correctly in runtime, these are MyPy inference limitations.
Fixes 7 MyPy errors blocking CI without changing any logic.

* fix: Add type ignore for Redis async methods in cache files

- Add type: ignore[attr-defined] for aclose() in redis_cache.py
- Add type: ignore[attr-defined] for ping() and aclose() in redis_cluster_cache.py
- Methods exist but redis-py type stubs are incomplete

* refactor: Remove variable shadowing in _transform_response_api_usage_to_chat_usage

- Rename parameter 'usage' to 'usage_input' for clarity
- Rename local variable 'usage' to 'chat_usage' to avoid shadowing
- Eliminates MyPy false positive without needing type: ignore
- No functional changes - all tests pass
- Improves code readability and type safety
2025-11-05 18:36:06 -08:00
Petre AlexandruandGitHub 911e802969 feat: add parallel execution handling in during_call_hook (#16279) 2025-11-05 18:35:25 -08:00
Guan Zheng HuangandGitHub 34c12d0131 Update MCP version from 1.10.1 to 1.20.0 (#16281)
* Update MCP version from 1.10.1 to 1.20.0

- Update mcp dependency: 1.10.1 -> 1.20.0 in requirements.txt, pyproject.toml, and CI config
- Update uvicorn dependency: 0.29.0 -> 0.31.1 (required by MCP 1.20.0)
- Update PyJWT constraint to support newer versions required by MCP
- Update all CI pipeline references to MCP 1.20.0
- Add test to verify MCP version and import compatibility

MCP 1.20.0 requires uvicorn >=0.31.1 and PyJWT >=2.10.1.
MCP package remains Python >=3.10 only (no change to version constraint).

* Update poetry.lock for MCP 1.20.0
2025-11-05 18:34:28 -08:00
yuneng-jiangandGitHub 812c8b88e9 Fixed /model_group/info returning entire model list for SSO users (#16296) 2025-11-05 18:30:30 -08:00
yuneng-jiangandGitHub 5d158775b1 [Fix] Litellm non root docker Model Hub Table fix (#16282)
* Fix model hub table 404 on non-root docker

* Adding test
2025-11-05 18:30:20 -08:00
Alexsander HamirandGitHub 263629b781 fix(aiohttp): Gracefully handle connection closed errors during streaming (#16294) 2025-11-05 18:26:49 -08:00
yuneng-jiangandGitHub b1be6185ac [Feature] UI - Include Model Access Group Models on Team Models Table (#16298)
* All Models Page Allow Filtering By Model Access Group

* Fix tests from main merge
2025-11-05 18:23:50 -08:00
Ishaan JaffGitHubCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
630a746c84 [Feat] Add Custom Secret Manager - Allow users to define and write a custom secret manager (#16297)
* add CustomSecretManager class

* docs custom secret manager

* add TestCustomSecretManager

* add KeyManagementSystem.CUSTOM

* add get_secret_from_manager

* add custom secret manager

* Potential fix for code scanning alert no. 3662: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* docs fix

* load_custom_secret_manager

* initialize_secret_manager

* add custom_secret_manager

* fix add custom secret manager

* add custom secret manager to KeyManagementSystem

* fix KeyManagementSystem.CUSTOM

* fix custom secret manager within cookbook

* fix link for custom secret manager

* Potential fix for code scanning alert no. 3663: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-11-05 17:20:26 -08:00
Krrish Dholakia fa278a1886 docs: move guardrails and responses api out of beta 2025-11-05 16:48:54 -08:00
Aliaksandr KuzmikandGitHub d14a637b16 OpikLogger: fix the bug with not incorrect attachment to existing trace & refactor (#15529)
* Fix bug, add new unit test

* Extract payload builder code to a separate namespace

* Update opik.py to use logic from the new namespace

* Code cleanup, type hints improvements

* Run linter

* Log model name as span field

* Reformat arguments in payload builders

* Use dataclasses for payloads, use opik native client if it's available

* Add cost and provider

* Add provider mapping
2025-11-05 16:29:50 -08:00
Krrish Dholakia 7ad6abeb1c fix(batch_utils.py): improve batch utils to handle newlines within batch content
Fixes LIT-1376
2025-11-05 16:15:09 -08:00
0388e3d393 Stabilize main branch (#16243)
* Fix failing container and azure tests

* fix lint error

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-11-05 16:07:28 -08:00
Alexsander HamirandGitHub 8ee9b1bc93 feat: Add configurable mount name and path prefix for HashiCorp Vault (#16253)
- Add HCP_VAULT_MOUNT_NAME env var to override default 'secret' mount
- Add HCP_VAULT_PATH_PREFIX env var to add prefix to secret paths
- Update get_url() method to construct URLs with configurable mount and prefix
- Add test coverage for custom mount names and path prefixes
- Maintain backward compatibility with existing configurations

This allows users to configure Vault paths like:
- Custom mount: {VAULT_ADDR}/v1/{MOUNT_NAME}/data/{SECRET}
- With prefix: {VAULT_ADDR}/v1/secret/data/{PREFIX}/{SECRET}
- Both: {VAULT_ADDR}/v1/{MOUNT_NAME}/data/{PREFIX}/{SECRET}

Resolves issue where mount name was hardcoded and path prefixes weren't supported.
2025-11-05 16:06:07 -08:00
yuneng-jiangandGitHub f1191578ae [Fix] UI - Fixed Label for vLLM in Model Create Flow (#16285)
* Fixed Label for vLLM

* Make vLLM api key not required
2025-11-05 16:03:01 -08:00
Ishaan JaffandGitHub 2541a54023 [Feat] Email Notifications - Ensure Users get Key Rotated Email (#16292)
* add virtual_key_rotated

* add KEY_ROTATED_EMAIL_TEMPLATE

* fix base email

* add _send_key_rotated_email

* fix _send_key_rotated_email

* key rotated email fix

* fix: async_key_generated_hook ensure behavior matches regenerate

* test_send_key_rotated_email

* expose EMAIL_INCLUDE_API_KEY

* docs mask api keys

* add email regen

* docs key regen

* docs email

* docs email

* docs fix

* fix code qa check
2025-11-05 15:56:49 -08:00
Ishaan Jaffer 3fc262e92a fix QA checks 2025-11-05 15:54:38 -08:00
Alexsander HamirandGitHub e06d1d623f Add: benchmark comparison with other AI gateways (#16248)
* fix: benchmark comparison location & content

* add: pros and cons

* remove
2025-11-05 15:44:30 -08:00
3ef210e5f4 Add allowing Key based prefix to s3 path (#16237)
* add Key based prefix

* add Key based prefix

* update documentation

* correct doc

---------

Co-authored-by: deepanshu <deepanshu.lulla@hq.bill.com>
2025-11-05 14:43:21 -08:00
Ishaan JaffandGitHub 466e7d178c [Feat] Cyber Ark - Add Key Rotations support (#16289)
* KeyManagementSystem add cyberark

* add CyberArkSecretManager

* add CyberArkSecretManager

* add CyberArkSecretManager

* docs add CyberArkSecretManager

* docs

* refactor to use get_secret_from_manager

* fix async roate for cyber ark, re-use base class

* fixes

* cyber ark

* docs fix

* docs fix

* docs cyberark

* fix linting

* fix get_secret_from_manager
2025-11-05 14:03:43 -08:00
Ishaan JaffGitHubCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
9a372bfad6 [Feat] Add CyberArk Secrets Manager Integration (#16278)
* KeyManagementSystem add cyberark

* add CyberArkSecretManager

* add CyberArkSecretManager

* add CyberArkSecretManager

* docs add CyberArkSecretManager

* docs

* refactor to use get_secret_from_manager

* Potential fix for code scanning alert no. 3645: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for code scanning alert no. 3650: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for code scanning alert no. 3649: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for code scanning alert no. 3646: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-11-05 14:00:45 -08:00
dean-zavadandGitHub f19356db60 Litellm noma guardrail support images (#16199)
* noma support v2 api and images with during call

* supporting streams and images with texts

* Supporting text now

* annonymization works

* removing function

* fixing noma.py

* all old tests pass

* adding new tests

* removing changes

* Fixing application id headers

* fix whitespace

* deleting unused imports
2025-11-05 11:23:39 -08:00
Krrish Dholakia 9b925c7e47 docs: remove old doc
causing search issues
2025-11-05 08:23:35 -08:00
Sameer KankuteandGitHub c45fad3855 Fix: Send Gemini API key via x-goog-api-key header with custom api_base (#16085)
* Add gemini api key in the custom api url

* Update tests

* Use api key n the header

* Use api key n the header

* fix mypy error

* fix mypy error

* fix test gemini auth
2025-11-05 07:12:13 -08:00
Sameer KankuteandGitHub 781f9df883 Add gpt-image-1 pricing for azure (#16182) 2025-11-04 19:21:44 -08:00
Fabrício CeschinandGitHub 387982fcbf Fix langfuse input tokens logic for cached tokens (#16203)
* Update langfuse.py

Fixing issue with input_tokens and cache_read_tokens

* Clarify input token calculation in langfuse.py

Add comment to clarify input token calculation based on Langfuse documentation.
2025-11-04 19:20:35 -08:00
Alexsander HamirandGitHub 727fe504bb fix(redis): handle float redis_version from AWS ElastiCache Valkey (#16207)
* fix(redis): handle float redis_version from AWS ElastiCache Valkey

AWS ElastiCache Valkey returns redis_version as a float (7.0) instead
of a string ('7.0.0'), causing AttributeError: 'float' object has no
attribute 'split' in async_lpop when parsing version for LPOP count.

Changes:
- Extract version parsing into _parse_redis_major_version() helper
- Add DEFAULT_REDIS_MAJOR_VERSION constant (replaces magic number)
- Support multiple version formats: string, float, int, malformed
- Add comprehensive test coverage for all version format edge cases

Fixes: 'LiteLLM Redis Cache LPOP: - Got exception from REDIS' error
during db_spend_update_job cronjobs

* refactor: move DEFAULT_REDIS_MAJOR_VERSION to constants.py
2025-11-04 19:20:00 -08:00
44a928b631 fix(openai): Remove automatic summary from reasoning_effort transformation (#16210)
* Fix: Remove automatic summary field from reasoning_effort transformation

Problem:
The _map_reasoning_effort() function was automatically adding
reasoning.summary field when users specified reasoning_effort parameter,
causing 400 errors for users with unverified OpenAI organizations.

Root Cause:
According to OpenAI's official documentation, the summary field is opt-in
and requires organization verification:

"Reasoning summary output [...] will not be included unless you explicitly
opt in to including reasoning summaries."

"Before using summarizers with our latest reasoning models, you may need
to complete organization verification"

Source: https://platform.openai.com/docs/guides/reasoning#reasoning-summaries

Solution:
Remove the automatic inclusion of summary field from all reasoning_effort
levels (high, medium, low, minimal). Users who want reasoning summaries
can explicitly pass reasoning={"effort": "high", "summary": "auto"} in
their requests.

Impact:
- Fixes #16032
- Works for all organizations (verified and unverified)
- Maintains backward compatibility for users passing reasoning object directly
- Follows OpenAI's recommended opt-in approach

Testing:
- All existing tests pass (4/4 tests in transformation suite)
- Manual verification confirms only effort field is included

* test: Fix MockResponse missing headers attribute in test_openai_responses_api

The MockResponse class was missing the 'headers' attribute which caused
APIConnectionError when processing the mock response. Added headers={}
to fix the test.

* feat: Add dict support to reasoning_effort parameter

Allow users to pass reasoning_effort as either:
- String: reasoning_effort="high" (no summary, safe default)
- Dict: reasoning_effort={"effort": "high", "summary": "detailed"} (opt-in)

This preserves backward compatibility while giving users flexibility
to explicitly opt-in to the summary field when needed (for verified
OpenAI organizations).

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2025-11-04 19:05:17 -08:00
Bowen LiangandGitHub 4e12e3f90d fix typo of orginal (#16255) 2025-11-04 18:55:44 -08:00
Alexsander HamirandGitHub b4def8899f add: shared_session support to responses API (#16260)
This change enables HTTP client session reuse by:
- Adding shared_session parameter to all responses API methods (responses, delete_responses, get_responses, list_input_items, cancel_responses)
- Passing shared_session to get_async_httpx_client() for connection pooling
- Adding debug logging to track shared session usage

This helps reduce memory overhead by reusing HTTP connections instead of creating new clients for each request, which is particularly important for high-throughput proxy scenarios.
2025-11-04 18:53:54 -08:00