Commit graph

30663 commits

Author SHA1 Message Date
Yuneng Jiang
e3d87fbcdc
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:17:56 -07:00
Alexsander Hamir
20423248df Fix: Handle PostgreSQL cached plan errors during rolling deployments
- Add _query_first_with_cached_plan_fallback() helper function to handle
  'cached plan must not change result type' errors
- This error occurs when schema changes (migrations) are applied during
  rolling deployments while old pods have cached query plans
- The fix automatically retries queries with modified SQL to force
  PostgreSQL to create fresh plans based on the new schema
- Addresses issue caused by migration 20260107111013_add_router_settings_to_keys_teams
  which added router_settings column to LiteLLM_VerificationToken table
- The combined_view query uses SELECT v.* which is vulnerable to schema changes
2026-01-20 10:31:57 -08:00
Otavio Brito
ce37729da4
remove count tokens optional param before request is sent to vertex (#19359) 2026-01-20 09:03:27 -08:00
Ishaan Jaffer
f6d6455cbc fix rc 2026-01-20 08:39:17 -08:00
Sameer Kankute
11dbae85d1
Merge pull request #19390 from BerriAI/litellm_consistent_id_streaming_responses
Fix: ID mismatch between text-start and text-delta
2026-01-20 20:46:34 +05:30
Sameer Kankute
961a424069
Merge pull request #19355 from BerriAI/litellm_staging_01_19_2026
Litellm staging 01 19 2026
2026-01-20 20:45:12 +05:30
Sameer Kankute
9e1275b76c
Merge branch 'main' into litellm_staging_01_19_2026 2026-01-20 19:19:36 +05:30
Sameer Kankute
a3c1f4758d
Merge branch 'main' into litellm_consistent_id_streaming_responses 2026-01-20 19:02:23 +05:30
Sameer Kankute
e69c12b6db
Merge pull request #19396 from BerriAI/litellm_responses_route_fix
Fix for Prometheus Metric Cardinality Issue with /responses Endpoint
2026-01-20 19:01:18 +05:30
Sameer Kankute
bd6f7bae21
Merge pull request #19397 from BerriAI/litellm_google_computer_use_cost_tracking
Add gemini-2.5-computer-use-preview-10-2025 model for vertex ai provider
2026-01-20 19:00:34 +05:30
Sameer Kankute
172ad17fbc
Merge pull request #19398 from BerriAI/litellm_add_multimodal_cost_tracking
Add input_cost_per_video_per_second in ModelInfoBase
2026-01-20 19:00:05 +05:30
Sameer Kankute
37ce6957ab
Merge pull request #19386 from BerriAI/litellm_staging_01_20_2026
Litellm staging 01 20 2026
2026-01-20 18:53:59 +05:30
Sameer Kankute
12c556e485
Merge pull request #19409 from BerriAI/revert-19261-feat/redis-migration-lock-safe
Revert "feat: Add Redis-based migration lock with bug fixes"
2026-01-20 18:46:38 +05:30
Sameer Kankute
3cc19c56ba
Revert "feat: Add Redis-based migration lock with bug fixes (#19261)"
This reverts commit 98e87c3e67.
2026-01-20 18:46:26 +05:30
Sameer Kankute
dc3ee63359 fix: test_env_keys 2026-01-20 18:37:56 +05:30
Sameer Kankute
2153db5e64 fix: test_convert_to_bedrock_format_post_call_streaming_hook 2026-01-20 18:27:36 +05:30
Sameer Kankute
8b24720638 fix: test_standard_logging_payload_includes_guardrail_information 2026-01-20 18:21:32 +05:30
Sameer Kankute
219f650445
Merge pull request #19405 from BerriAI/revert-19315-fix-litellm-params
Revert "fix #19254 - [Bug]: litellm_params ignored by get_llm_provider function in completion() definition"
2026-01-20 17:51:44 +05:30
Sameer Kankute
f6fcd0cb85
Revert "fixed litellm params (#19315)"
This reverts commit 16b8ed6786.
2026-01-20 17:50:45 +05:30
Sameer Kankute
df89e7262a
Merge pull request #19404 from BerriAI/litellm_staging_01_20_2026_fix
Litellm staging 01 20 2026 fix
2026-01-20 17:40:23 +05:30
Sameer Kankute
cd96c8cbb0 Fix:test_aaaaazure_tenant_id_auth 2026-01-20 17:39:08 +05:30
Sameer Kankute
f0785d5a51 Fix:test_supported_params_limited_to_docs 2026-01-20 17:26:40 +05:30
Sameer Kankute
c8ad14dbab
Merge pull request #19402 from BerriAI/revert-19371-feat/configurable-retry-logic
Revert "feat: add retry_delay, exponential_backoff, and jitter to completion()"
2026-01-20 17:07:11 +05:30
Sameer Kankute
ae414ed462
Revert "feat: add retry_delay, exponential_backoff, and jitter to completion(…"
This reverts commit 1678f621db.
2026-01-20 17:07:00 +05:30
Sameer Kankute
dd6b35e825
Merge pull request #19401 from BerriAI/main
Merge main 01 20 2026
2026-01-20 16:45:08 +05:30
Sameer Kankute
deb9142117
Merge pull request #19400 from BerriAI/main
merge main iin 19/1 staging
2026-01-20 16:45:01 +05:30
Sameer Kankute
be0f61854f Add input_cost_per_video_per_second in ModelInfoBase 2026-01-20 16:23:47 +05:30
Sameer Kankute
cebcad48d3 Add gemini-2.5-computer-use-preview-10-2025 model for vertex ai provider 2026-01-20 15:53:02 +05:30
Sameer Kankute
5f80e8d5e8 Fix for Prometheus Metric Cardinality Issue with /responses Endpoint 2026-01-20 15:28:09 +05:30
Sameer Kankute
f945fd9a84 Fix: ID mismatch between text-start and text-delta 2026-01-20 11:15:37 +05:30
Sameer Kankute
3eb3594ab7
Merge pull request #19346 from Chesars/fix/drop-params-prompt-cache-key-19225
fix: drop_params not dropping prompt_cache_key for non-OpenAI providers
2026-01-20 10:15:45 +05:30
Sameer Kankute
931998f170
Merge pull request #19266 from VedantMadane/fix-prompt-caching-string-content
Fix extract_cacheable_prefix to handle string content with message-level cache_control
2026-01-20 10:11:48 +05:30
victorigualada
7d6d419a67
fix: preserve tool output ordering for gemini in responses bridge (#19360)
* fix: preserve tool output ordering for gemini in responses bridge

- Keep function_call_output adjacent to its function_call when building chat messages
- Normalize function_call_output.output lists (input_* parts) into tool message content

* fix test

* small improvements
2026-01-19 20:37:59 -08:00
Igal Boxerman
d7ac8de832
docs: Migrate Pillar Security to Generic Guardrail API (#19364)
Update Pillar Security integration to use the generic_guardrail_api
instead of the dedicated pillar guardrail type. This aligns with
the Generic Guardrail API specification introduced in previous PRs.

Changes:
- Rewrite pillar_security.md with new generic_guardrail_api config
- Add Pillar Security example to generic_guardrail_api.md
- Add Pillar Security to quick_start.md guardrails examples

Related PRs: #17175, #18647, #18932, #19023
2026-01-19 20:35:56 -08:00
victorigualada
581d086c20
fix(responses): stream tool call events in completion bridge (#19368)
Emit Responses API streaming events for tool calls when the underlying chat stream contains tool_call deltas, and recover tool calls into the stream when they only appear in the final response.
2026-01-19 20:29:50 -08:00
Sameer Kankute
2ae308028d
Merge pull request #18787 from aproorg/fix/bedrock-thinking-tool-call-2
fix(bedrock): handle thinking with tool calls for Claude 4 models
2026-01-20 09:43:07 +05:30
YutaSaito
00814d4d90
Merge pull request #19379 from BerriAI/litellm_feat_mcp_version_up
[feat] mcp version up
2026-01-20 13:09:29 +09:00
Ishaan Jaffer
ea2e360cb5 docs 2026-01-19 19:49:51 -08:00
Ishaan Jaffer
f865f92bec docs plugin marketplaces 2026-01-19 19:42:15 -08:00
Yuta Saito
ab11ceff32 tests: patch MCP client mocks via module alias to avoid real network calls 2026-01-20 12:31:27 +09:00
Loïc Rakotoson
1645be3a2f
feat: implement SafeAttributeModel for safe attribute access in models (#18321) 2026-01-19 19:24:03 -08:00
Will Chen
2761077820
docs: fix vertex_region to vertex_location in Vertex AI pass-through docs (#19380)
The documentation incorrectly used `vertex_region` as the parameter name,
but the actual parameter expected by LiteLLM is `vertex_location` as defined
in VertexPassThroughCredentials and other type definitions.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-19 19:15:17 -08:00
이명현
0dfc3fad5a
Fix: bedrock invoke claude 4 optional params #19318 (#19381) 2026-01-19 19:14:58 -08:00
Ishaan Jaff
8c72cacaa4
[Feat] UI - Allow Adding Claude Code Plugins (#19387)
* init schema

* init endpoints

* fix: claude_code_marketplace_router

* refactor

* fix: claude_code_marketplace_router

* claude_code_marketplace_router

* add netwroking methods

* add plugin lefnat

* add plugin form

* add plugin on marketplace / ai hub

* fix find mant bug

* ui fix
2026-01-19 19:08:59 -08:00
Ryan Malloy
58c8c2b7b1
fix: HTTP client memory leaks in Presidio, OpenAI, and Gemini (#19190)
* fix: prevent HTTP client memory leaks in Presidio and OpenAI wrappers

Fixes multiple memory leak issues reported in #14540 and related tickets:

**Presidio Guardrail Fix (#14540)**
- Problem: Every guardrail check created a new aiohttp.ClientSession
- Impact: High-traffic proxies accumulated thousands of unclosed sessions
- Solution: Share a single session across all guardrail checks
  - Added `self._http_session` instance variable
  - Lazy session creation via `_get_http_session()`
  - Proper cleanup via `_close_http_session()` and `__del__()`
- Files: litellm/proxy/guardrails/guardrail_hooks/presidio.py

**OpenAI HTTP Client Caching (#14540)**
- Problem: `_get_async_http_client()` created new httpx.AsyncClient on each call
- Impact: OpenAI/Azure completions bypassed client caching system
- Solution: Route through `get_async_httpx_client()` for TTL-based caching
  - Caches clients by provider and SSL config
  - Fallback to direct creation if caching fails
  - Applied to both async and sync client methods
- Files: litellm/llms/openai/common_utils.py

**Test Script**
- Added validation script to demonstrate fixes
- Counts file descriptors and unclosed session objects
- Files: test_oom_fixes.py

Related issues: #14384, #13251, #12443

* fix(oom): prevent memory leaks in Presidio guardrails and OpenAI client creation

Fixes two high-impact memory leaks:

1. Presidio Guardrail Session Leak (issue #14540)
   - Problem: Created new aiohttp.ClientSession on every guardrail check
   - Impact: Runs on EVERY proxy request when PII masking enabled
   - Fix: Shared session pattern with lifecycle management
   - Files: litellm/proxy/guardrails/guardrail_hooks/presidio.py

2. OpenAI HTTP Client Cache Bypass (issue #14540)
   - Problem: _get_async_http_client() created new httpx.AsyncClient, bypassing TTL cache
   - Impact: Every completion created new client with own connection pool
   - Fix: Route through get_async_httpx_client() for proper caching
   - Critical: Include SSL config in cache key for correctness
   - Files: litellm/llms/openai/common_utils.py

Validation:
- Presidio: 100 requests → 0 new sessions (was 100)
- OpenAI: 100 calls → 1 unique client (was 100)
- test_oom_fixes.py: Automated validation script

* fix(oom): resolve Gemini aiohttp session leak (issue #12443)

Fixes persistent "Unclosed client session" warnings when using Gemini models.

Root Causes:
1. Broken atexit cleanup - get_event_loop() fails at exit time
2. On-demand session creation without reliable cleanup

Changes:

1. Fixed atexit Cleanup (async_client_cleanup.py)
   - OLD: Used get_event_loop() which fails when loop is closed
   - NEW: Always create fresh event loop at exit time
   - Ensures cleanup runs successfully even when main loop is closed

2. Added __del__ Cleanup (aiohttp_handler.py)
   - Defense-in-depth: cleanup on garbage collection
   - Handles abnormal termination cases
   - Similar pattern to Presidio guardrail fix

3. Enhanced Cleanup Scope (async_client_cleanup.py)
   - Now closes global base_llm_aiohttp_handler instance
   - Previously only checked cache, missed module-level handler

Validation:
- Test 1: __del__ cleanup → 0 sessions leaked ✓
- Test 2: atexit cleanup → 0 sessions leaked ✓
- test_gemini_session_leak.py: Automated validation

Related: #14540 (broader OOM issue tracking)

* fix(types): use LlmProviders enum for get_async_httpx_client

MyPy was failing because llm_provider parameter expects Union[LlmProviders, httpxSpecialProvider], not a string.

Changed from string "openai" to LlmProviders.OPENAI enum value.

* test: move validation tests to proper CI directories

- Move test_oom_fixes.py to tests/test_litellm/llms/
- Move test_gemini_session_leak.py to tests/test_litellm/llms/custom_httpx/
- Fix pytest warning: use pytest.skip() instead of return True

This ensures CI actually runs our OOM fix validation tests.

* fix(oom): add asyncio.Lock to prevent race conditions in Presidio session creation

- Make _get_http_session() async with asyncio.Lock protection
- Prevents multiple concurrent requests from creating orphaned sessions
- Add concurrent load test (50 parallel requests) to validate fix
- Test confirms only 1 session created under concurrent load

Critical fix: Previous implementation had race condition where
concurrent guardrail checks could create multiple sessions,
defeating the shared session pattern and causing memory leaks.

* fix(presidio): eliminate race condition in session lock initialization

Move asyncio.Lock creation from lazy initialization in _get_http_session()
to __init__. The previous lazy init had a race condition where concurrent
coroutines could both see _session_lock as None, both create locks, and
end up with different lock instances - defeating the synchronization.

asyncio.Lock() can be safely created without an event loop; it only
requires one when awaited.
2026-01-19 19:02:55 -08:00
南辰燏炚
004bde2c45
feat (volcengine) : Support Volcengine responses api (#18508)
* Add Volcengine responses adapter

* fix llms/volcengine/responses/transformation.py:507:9: F841 Local variable `origin` is assigned to but never used

fix llms/volcengine/responses/transformation.py:95: error: Argument "headers" to "VolcEngineError" has incompatible type

add more supported optional params

removed redundant manual logging/utils fallbacks so litellm/__init__.py uses the registry only.
2026-01-19 19:02:29 -08:00
Emerson Gomes
13d887a275
Fix queue persistence to Redis (#19304)
* Fix queue persistence to Redis

* add test
2026-01-19 19:01:34 -08:00
Connor Luebbehusen
d48df6c17d
fix: correct us.anthropic.claude-opus-4-5 In-region pricing (#19310) 2026-01-19 19:00:24 -08:00
Sameer Kankute
d319517963
Merge pull request #19369 from Lucky-Lodhi2004/fix-tool-call-ollama
Fix #19357 - [Bug]: Tool call fails when using Ollama backend
2026-01-20 08:01:34 +05:30
Ishaan Jaff
818913ee23
[Fix] Fix Pass through routes to work with server root path (#19383)
* test_build_full_path_with_root_default

* fix pt feat
2026-01-19 18:28:55 -08:00