Commit graph

27089 commits

Author SHA1 Message Date
Jamie Goodyear
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 Garcia
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 Alexandru
911e802969
feat: add parallel execution handling in during_call_hook (#16279) 2025-11-05 18:35:25 -08:00
Guan Zheng Huang
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-jiang
812c8b88e9
Fixed /model_group/info returning entire model list for SSO users (#16296) 2025-11-05 18:30:30 -08:00
yuneng-jiang
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 Hamir
263629b781
fix(aiohttp): Gracefully handle connection closed errors during streaming (#16294) 2025-11-05 18:26:49 -08:00
yuneng-jiang
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 Jaff
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 Kuzmik
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
Sameer Kankute
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 Hamir
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-jiang
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 Jaff
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 Hamir
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
Deepanshu Lulla
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 Jaff
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 Jaff
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-zavad
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 Kankute
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 Kankute
781f9df883
Add gpt-image-1 pricing for azure (#16182) 2025-11-04 19:21:44 -08:00
Fabrício Ceschin
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 Hamir
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
Cesar Garcia
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 Liang
4e12e3f90d
fix typo of orginal (#16255) 2025-11-04 18:55:44 -08:00
Alexsander Hamir
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
Alan Ponnachan
b564ed81f5
add reasoning effort and test (#16261) 2025-11-04 18:53:02 -08:00
Ishaan Jaffer
4a83ae0695 test_aresponses_service_tier_and_safety_identifier 2025-11-04 18:05:30 -08:00
Ishaan Jaffer
ede8944e49 fix _handle_callback_failure 2025-11-04 18:00:12 -08:00
Ishaan Jaffer
5b658ce1eb ui fix 2025-11-04 17:58:51 -08:00
Ishaan Jaff
60f3a3b0ad
[Feat] add serxng search API provider (#16259)
* TestFirecrawlSearch

* add SearchProviders

* add to get_provider_search_config

* add FirecrawlSearchConfig

* add FirecrawlSearchRequest

* add firecrawl API docs

* add pricing firecrawl/search

* add new search APIs

* add SearXNGSearchConfig

* add searxng/search

* add serxng params

* TestSearXNGSearch

* docs serxng

* docs fix

* docs fix

* docs serxng
2025-11-04 17:56:07 -08:00
Ishaan Jaff
af78a93ecf
[Feat] /search API - add firecrawl search API support (#16257)
* TestFirecrawlSearch

* add SearchProviders

* add to get_provider_search_config

* add FirecrawlSearchConfig

* add FirecrawlSearchRequest

* add firecrawl API docs

* add pricing firecrawl/search

* add new search APIs
2025-11-04 17:52:12 -08:00
Krrish Dholakia
a3810a5f3a docs(openai_passthrough.md): document how to make openai passthrough route work 2025-11-04 17:12:33 -08:00
Ishaan Jaff
c1ac6e25aa
[Feat] Add Bedrock Agentcore as a provider on LiteLLM Python SDK and LiteLLM AI Gateway (#16252)
* add agentcore in get_bedrock_route

* add AmazonAgentCoreConfig

* fix get_runtime_endpoint

* init AmazonAgentCoreConfig

* add get_bedrock_chat_config

* get_bedrock_chat_config

* add AmazonAgentCoreConfig

* fix get_complete_url

* refactor transform response

* test agentcore

* test_bedrock_agentcore_with_streaming

* fix _parse_json_response

* fix _calculate_usage

* test_bedrock_agentcore_basic

* add AgentCoreSSEStreamIterator

* add native streaming for agentcore

* test_bedrock_agentcore_with_streaming

* test_bedrock_agentcore_basic

* add agentcore

* _calculate_usage

* fix linting
2025-11-04 16:35:12 -08:00
Deepanshu Lulla
812ea03d28
Add tags and descriptions support to aws secrets manager (#16224)
* Add tags and descriptions support to aws secrets manager

* add tags

---------

Co-authored-by: deepanshu <deepanshu.lulla@hq.bill.com>
2025-11-04 16:11:51 -08:00
yuneng-jiang
2b0aea87c0
[Feature] UI - Initial changes for supporting prompts to multiple models (#16223)
* Initial changes for supporting prompts to multiple models

* Additional tests to prevent regressions

* Resolve merge conflicts

* Fixing E2E build issues
2025-11-04 16:02:19 -08:00
Cesar Garcia
78ed5126a5
fix: Fix Responses API streaming tests usage field names and cost (#16236)
This commit fixes two bugs in Responses API streaming tests:

1. **Usage field naming bug**: Tests were using `input_tokens` and
   `output_tokens` but the Usage object uses `prompt_tokens` and
   `completion_tokens`.

2. **Missing cost in streaming usage**: When `include_cost_in_streaming_usage`
   was enabled, the cost was calculated and added to ResponseAPIUsage, but was
   lost during the transformation to the Usage object.

Changes:
- Updated test assertions to use correct field names (prompt_tokens, completion_tokens)
- Added cost preservation logic in FakeStreamerResponsesAPIIterator
- Modified _transform_response_api_usage_to_chat_usage() to preserve cost attribute

All streaming tests now pass successfully.
2025-11-04 15:57:59 -08:00
Alexsander Hamir
7878ebd2a2
fix(proxy): handle None values in daily spend sort key (#16245)
Fixes TypeError when sorting daily spend transactions with missing entity IDs (e.g., null tags).
Changed x[1].get(entity_id_field) to x[1].get(entity_id_field) or "" to provide a sortable
default value when the field is None, preventing comparison errors between NoneType and str.
2025-11-04 15:56:48 -08:00
yuneng-jiang
2ed95e216c
[Feature] UI - Tag Usage Top Model Table View and Label Fix (#16249)
* Tag Usage Top Model Table View and Label Fix

* Removed unused state
2025-11-04 14:24:43 -08:00
yuneng-jiang
4d756a62d9
Prevent trailing slash in sso proxy base url input (#16244) 2025-11-04 14:22:50 -08:00
yuneng-jiang
615f76de88
[Feature] UI - Litellm test key audio (#16251)
* Add audio/transcriptions and audio/speech to Test key UI

* Removed unused import in test

* Fixed voice parameter not being passed in
2025-11-04 14:21:26 -08:00
Krish Dholakia
726452dfe8
Revert "add: comparison with portkey (#16145)" (#16247)
This reverts commit 844ace1283.
2025-11-04 10:37:56 -08:00
Alexsander Hamir
844ace1283
add: comparison with portkey (#16145) 2025-11-04 10:37:17 -08:00
YutaSaito
8e27b6c0b4
[MCP] configure static mcp header (#16179)
* feat: configure extra mcp headers in ui

* doc: static header

* build: add new migration file

* chore: add missing image file

* fix: test
2025-11-03 21:06:36 -08:00
Alan Ponnachan
45cf6fc289
feat: support dashscope tiered pricing
* add helper functions

* update generic_cost_per_token function

* add test

* formatting

* add examples in docstring for _calculate_tiered_cost

* Restore files to upstream/main version

* dashscope specific calculation

* improve for different costs

* remove _calculate_flat_cost function
2025-11-03 20:27:25 -08:00
pablobgar
5ddc5410bf
fix: cumulative index (#16194) 2025-11-03 20:25:05 -08:00