Commit graph

35938 commits

Author SHA1 Message Date
Yuneng Jiang
36c4b413d4
chore: fixes 2026-04-04 23:53:07 -07:00
shivam
1ee2ea9854 iam policy fix 2026-03-21 17:46:26 -07:00
Ishaan Jaff
2ea9e207bd
Litellm ishaan march 20 (#24303)
* feat(redis): add circuit breaker to RedisCache to fast-fail when Redis is down (#24181)

* feat(redis): add circuit breaker env var constants

* feat(redis): add RedisCircuitBreaker and apply guard decorator to all async ops

* fix(dual_cache): fall back to L1 instead of re-raising on Redis increment failures

* test(caching): add circuit breaker unit tests

* fix(redis): fast-fail concurrent HALF_OPEN probes — only one probe at a time

* fix(dual_cache): return None fallback when in_memory_cache is absent and Redis fails

* test(caching): add regression tests for HALF_OPEN concurrency and None fallback

* Fix blocking sync next in __anext__ (#24177)

* Fix blocking sync next

* Update tests/test_litellm/litellm_core_utils/test_streaming_handler.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix PEP 479 regression in __anext__ sync iterator exhaustion

asyncio.to_thread re-raises thread exceptions inside a coroutine, where
PEP 479 converts StopIteration to RuntimeError before any except clause
can catch it. Add _next_sync_or_exhausted() module-level helper that
catches StopIteration in the thread and returns a sentinel instead, then
raise StopAsyncIteration in the coroutine.

Also rewrites the non-blocking test to use asyncio.gather() instead of
asyncio.create_task() (which returned None on Python 3.9 / pytest-asyncio
in CI), and adds an exhaustion regression test that drains the wrapper
fully and asserts no RuntimeError leaks out.

---------

Co-authored-by: Emerson Gomes <emerson.gomes@thalesgroup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* feat: add git-subdir source type to claude-code/plugins API (#24223)

Support a third plugin source type `git-subdir` alongside the existing
`github` and `url` types, as documented in the official Claude Code
plugin marketplaces spec.

New format: {"source": "git-subdir", "url": "...", "path": "subdir/path"}

- Validates url and path fields are present and non-empty
- Rejects absolute paths, '..' segments, backslashes, and percent-encoded
  traversal sequences (including double-encoded variants via regex check)
- Extracts path validation into _validate_git_subdir_path() helper
- Updates Pydantic field description to document all three source types
- Adds isValidUrl() check for url/git-subdir source types in the UI form
- Adds "Git Subdir" option to the UI form with a required Path field
- Adds unit tests covering success, update, missing/empty fields,
  path traversal variants, and unknown source type

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* [FEAT] add extract_header and extract_footer to Mistral OCR supported params (#24213)

* docs: add git-subdir source type to claude-code plugin marketplace docs (#24289)

* fix(ui): swap J/K keyboard navigation in log details drawer (#24279) (#24286)

J should navigate down (next) and K should navigate up (previous),
matching vim/standard conventions.

* fix: use async_set_cache in user_api_key_auth hot path (#24302)

* fix: use async_set_cache in auth hot path to avoid blocking event loop

* test: assert no blocking set_cache call in _user_api_key_auth_builder

* test: broaden blocking call check to all sync DualCache methods

* test: fix regression test to actually catch blocking cache calls

* fix: ruff lint unused variable + UI build MessageManager error

- litellm/caching/redis_cache.py: remove unused variable 'e' in circuit
  breaker exception handler (F841)
- add_plugin_form.tsx: use MessageManager.error() instead of undefined
  message.error() for git URL validation

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

* docs: add REDIS_CIRCUIT_BREAKER env vars to config_settings reference

Add REDIS_CIRCUIT_BREAKER_FAILURE_THRESHOLD and
REDIS_CIRCUIT_BREAKER_RECOVERY_TIMEOUT to the environment variables
reference table so test_env_keys.py passes.

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

---------

Co-authored-by: Emerson Gomes <emerson.gomes@thalesgroup.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Vincenzo Barrea <manamana88@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Robert Kirscht <rkirscht242@gmail.com>
Co-authored-by: Imgyu Kim <kimimgo@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-03-21 12:40:11 -07:00
Krish Dholakia
b64b0d4b9b
Merge pull request #24222 from BerriAI/docs/prompt-caching-gemini-support
docs: add Gemini/Vertex AI prompt caching support to docs
2026-03-21 10:28:49 -07:00
Krish Dholakia
c8a7d5d237
Merge branch 'main' into docs/prompt-caching-gemini-support 2026-03-21 10:28:39 -07:00
Krish Dholakia
ea02c7cc15
Merge pull request #24174 from BerriAI/litellm_oss_staging_03_19_2026
Litellm oss staging 03 19 2026
2026-03-21 10:27:50 -07:00
Sameer Kankute
8d3445fb43
Merge pull request #24297 from BerriAI/revert-23842-fix/deepgram-cost-per-second
Revert "fix(transcription): fix cost_per_second calculation for audio transcription models"
2026-03-21 20:45:12 +05:30
Sameer Kankute
6830b63269
Revert "fix(whisper): correct output_cost_per_second pricing and cost calcula…"
This reverts commit 00dd984415.
2026-03-21 20:44:52 +05:30
Sameer Kankute
676a79e9f7 bump: litellm-enterprise 0.1.34 → 0.1.35 2026-03-21 20:42:34 +05:30
Sameer Kankute
5b5c998dbd
Merge branch 'main' into litellm_oss_staging_03_19_2026 2026-03-21 20:31:08 +05:30
Sameer Kankute
c1e90ed300 Fix mypy errors 2026-03-21 20:29:14 +05:30
Cesar Garcia
a3095f47fd
Merge pull request #24076 from Chesars/feat/cache-control-tool-config-21969
feat(bedrock): support cache_control_injection_points for tool_config location
2026-03-20 23:29:53 -03:00
Cesar Garcia
a4f091c025
Merge pull request #24073 from Chesars/feat/gemini-context-circulation
feat(gemini): support context circulation for server-side tool combination
2026-03-20 23:29:30 -03:00
Chesars
29ab11a9c2 fix(types): add CacheControlToolConfigInjectionPoint to union type 2026-03-20 23:23:28 -03:00
Cesar Garcia
ead607a42b
Merge pull request #24072 from Chesars/fix/strict-additional-properties-20997-clean
fix(adapter): add additionalProperties: false for OpenAI strict mode in Anthropic adapter
2026-03-20 22:19:39 -03:00
yuneng-jiang
d8e4fc4dd0
Merge pull request #24260 from BerriAI/litellm_yj_march_19_2026
[Infra] Merge internal dev branch with main
2026-03-20 17:35:19 -07:00
yuneng-jiang
2ca4fa6189
Merge branch 'main' into litellm_yj_march_19_2026 2026-03-20 17:28:41 -07:00
yuneng-jiang
e6e3085845
Merge pull request #24258 from joereyna/fix/anthropic-file-content-test-mock
fix(test): mock get_auth_header instead of get_api_key in anthropic file content test
2026-03-20 16:14:59 -07:00
yuneng-jiang
e678ddea43 Fix unreachable special MCP server name guard in add_mcp_server
The special name check (all_team_servers, all_proxy_servers) was an elif
after the server_id-is-not-None check, making it unreachable since special
names are non-None strings. Split into separate if blocks so the special
name guard runs before the duplicate-ID check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 16:12:48 -07:00
joereyna
f0e0d98f86 fix(test): mock get_auth_header instead of get_api_key in anthropic file content test 2026-03-20 16:07:09 -07:00
yuneng-jiang
6862930538 Revert test to match reverted team MCP manager feature
The team MCP manager feature was reverted in PR #24255, so the test
needs to go back to the original single auth failure test that expects
a 403 for non-admin users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 15:44:00 -07:00
yuneng-jiang
1fad0d557d
Merge pull request #24255 from BerriAI/revert-24171-litellm_/awesome-dhawan
Revert "[Feature] Team MCP Server Manager Role"
2026-03-20 15:42:10 -07:00
yuneng-jiang
c9683c6f97
Revert "[Feature] Team MCP Server Manager Role" 2026-03-20 15:41:57 -07:00
ryan-crabbe
72c307df0e
Merge pull request #24217 from BerriAI/litellm_ryan_march_18
feat: add control plane for multi-proxy worker management
2026-03-20 14:05:19 -07:00
Ryan Crabbe
541863a566 Merge branch 'litellm_ryan_march_18' of https://github.com/BerriAI/litellm into litellm_ryan_march_18 2026-03-20 13:58:32 -07:00
Ryan Crabbe
6f81eb01fe fix: apply Black formatting to ui_sso.py 2026-03-20 13:57:26 -07:00
ryan-crabbe
59b4a05782
Merge branch 'main' into litellm_ryan_march_18 2026-03-20 13:36:37 -07:00
yuneng-jiang
ba4aae02c7 Fix outdated MCP server auth test for team MCP manager flow
The test_create_mcp_server_auth_failure test expected a 403 for non-admin
users, but the team MCP manager feature changed the auth flow to first
check for team_id (400) before checking permissions. Split into two tests:
one for missing team_id (400) and one for non-manager rejection (403).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 13:10:10 -07:00
yuneng-jiang
5d317c3a5c Merge remote-tracking branch 'origin' into litellm_yj_march_19_2026 2026-03-20 12:59:21 -07:00
yuneng-jiang
50f88c8642
Merge pull request #24243 from BerriAI/litellm_/gifted-spence
[Docs] Add missing team_member_budget_duration param to new_team docstring
2026-03-20 12:51:13 -07:00
yuneng-jiang
4d198558c8
Merge branch 'main' into litellm_/gifted-spence 2026-03-20 12:44:20 -07:00
yuneng-jiang
404c68c74b Add missing team_member_budget_duration param to new_team docstring
Fixes CI failure in test_api_docs.py which validates that all Pydantic
model fields are documented in endpoint docstrings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:42:35 -07:00
yuneng-jiang
3ea69c9539 Merge remote-tracking branch 'origin' into litellm_yj_march_19_2026 2026-03-20 12:37:26 -07:00
yuneng-jiang
b36269e2c1
Merge pull request #24171 from BerriAI/litellm_/awesome-dhawan
[Feature] Team MCP Server Manager Role
2026-03-20 12:30:50 -07:00
yuneng-jiang
700fd86de9 Fix importorskip guard and add LiteLLM_TeamTableCachedObj import
- Add pytest.importorskip("mcp") at module level so tests skip cleanly
  in CI environments without the mcp package (instead of ImportError)
- Import LiteLLM_TeamTableCachedObj into MCP_AVAILABLE block so type
  annotations resolve for static analysis and get_type_hints()
- Remove string quotes from type annotations now that the import exists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:13:09 -07:00
yuneng-jiang
c6ffda9671
Merge pull request #23484 from michelligabriele/fix/team-member-budget-duration-on-create
fix(proxy): add team_member_budget_duration to NewTeamRequest
2026-03-20 11:56:30 -07:00
yuneng-jiang
f884e4ac66
Merge branch 'main' into fix/team-member-budget-duration-on-create 2026-03-20 11:48:08 -07:00
ryan-crabbe
d381b58570
Merge branch 'main' into litellm_ryan_march_18 2026-03-20 11:44:45 -07:00
BillionToken
78139472a1
fix(moonshot): preserve reasoning_content on Pydantic Message objects in multi-turn tool calls (#23828)
* fix(moonshot): preserve reasoning_content on Pydantic Message objects in multi-turn tool calls

The condition 'reasoning_content not in msg' doesn't work correctly for
Pydantic Message objects because they don't support the 'in' operator
like dicts do. This caused reasoning_content to be stripped from
assistant messages in multi-turn conversation history.

Changed the condition to use msg.get('reasoning_content') instead,
which works correctly for both dicts and Pydantic models.

Fixes #23765

* added newline eof

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

* Update tests/test_litellm/llms/moonshot/test_moonshot_chat_transformation.py

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

* Simplify assertions in test_moonshot_chat_transformation

Removed redundant assertions for non-assistant messages.

---------

Co-authored-by: BillionClaw <267901332+BillionClaw@users.noreply.github.com>
Co-authored-by: Aarish Alam <arishalam121@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-21 00:09:17 +05:30
Geoffray Viossat
00dd984415
fix(whisper): correct output_cost_per_second pricing and cost calculation (#23842)
- Set output_cost_per_second to 0.0 (was 0.0001) for whisper-1 and
  azure/whisper-1: transcription is billed on input duration only,
  not output duration
- Fix cost_per_second() in openai/cost_calculation.py: change elif to if
  so input_cost_per_second is evaluated independently of output_cost_per_second,
  and remove the erroneous completion_cost = 0.0 assignment that masked
  any previously-set output cost
- Add TestCostPerSecondArithmetic unit tests covering both cost fields,
  the None-guard, and zero-duration edge case

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 00:02:15 +05:30
Jayachander Reddy kandakatla
714c1b80e1
docs(pricing): add official source links for Azure DeepSeek & Cohere models (#20181)
Added 'source' keys to Azure DeepSeek v3.2(Standard & Speciale) and Cohere Rerank 4.0 (Pro & Fast) entries for pricing verification.
2026-03-20 23:55:53 +05:30
Krish Dholakia
e8ec9eb44a
Merge pull request #24220 from milan-berri/fix/streaming-metadata-hidden-params
fix(logging): merge hidden_params into metadata for streaming requests
2026-03-20 11:25:45 -07:00
Christopher Baer
589c6cdad0
fix(gemini-embeddings): convert task_type to camelCase taskType for Gemini API (#24191)
The Gemini REST API documents the embedding task type parameter as
camelCase `taskType`. The existing transformation functions convert
`dimensions` to `outputDimensionality` but miss the parallel
`task_type` to `taskType` conversion. This adds that conversion to
both `transform_openai_input_gemini_content` (batchEmbedContents path)
and `transform_openai_input_gemini_embed_content` (embedContent path).

Fixes #24190
2026-03-20 22:32:22 +05:30
Klaus
330ef5e579 docs: add Gemini/Vertex AI to prompt caching docs
Add Google AI Studio (gemini/) and Vertex AI (vertex_ai/) as
supported providers for prompt caching. Same cache_control format
as Anthropic works - LiteLLM translates it to Google's context
caching API under the hood.

Includes SDK + proxy examples for both providers.
2026-03-20 09:48:31 -07:00
milan-berri
5372334233
Merge branch 'main' into fix/streaming-metadata-hidden-params 2026-03-20 16:32:36 +00:00
Milan
f36a59d196 fix(logging): merge hidden_params into metadata for streaming completions
Non-streaming paths call _process_hidden_params_and_response_cost; streaming
assembles the full response later and skipped that, so litellm_params.metadata
 lacked hidden_params (e.g. response_cost for OTEL/OpenSearch).

- Add _merge_hidden_params_from_response_into_metadata and call it from
  success_handler and async_success_handler after cost is set, before
  _build_standard_logging_payload.
- Unit tests for merge helper.

Tests: pytest tests/test_litellm/litellm_core_utils/test_litellm_logging.py
Made-with: Cursor
2026-03-20 16:27:41 +00:00
yuneng-jiang
1cd7a48c33 Add tests for edit and delete MCP server manager paths
Addresses Greptile feedback about missing integration tests for PUT/DELETE
when invoked by mcp_server_manager role. Adds tests for edit success/403,
delete success with team cleanup/403, and the _remove_mcp_server_from_team
helper directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 09:19:53 -07:00
Krish Dholakia
523fbed233
Merge pull request #24199 from stias/fix/bedrock-count-tokens-custom-endpoint
fix(bedrock): respect api_base and aws_bedrock_runtime_endpoint in count_tokens endpoint
2026-03-20 09:10:30 -07:00
yuneng-jiang
b8c9bf7d25 refactor: extract _auto_assign and _remove helpers, use team_endpoints helper
- Replace raw prisma_client.db.litellm_teamtable.update with
  handle_update_object_permission from team_endpoints (follows
  established helper-function pattern)
- Extract _auto_assign_mcp_server_to_team and
  _remove_mcp_server_from_team helpers for reuse and testability
- Update tests to mock at the correct boundaries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 09:05:18 -07:00
Seokjun Yang
d3afaf613d
Update tests/litellm_utils_tests/test_bedrock_token_counter.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-20 22:21:22 +09:00