Commit graph

31779 commits

Author SHA1 Message Date
Lovro Seder
726988aed4 Fix Azure AI Anthropic CountTokens 401 auth error (#20069)
Add x-api-key header to CountTokens handler to match chat completion
authentication. Azure AI Anthropic requires this header per Microsoft's
native API format.
2026-02-02 18:24:06 +05:30
Abdullah Habib Biswas
ef73f330f1 fix: prevent error when max_fallbacks exceeds available models (#20071) 2026-02-02 18:23:53 +05:30
Simon Lynch
07bffddbfa fix(bedrock): deduplicate toolResult and toolUse blocks in Converse message transformation (#20049)
Bedrock rejects requests when toolResult or toolUse blocks within a
single message contain duplicate IDs. The Converse message transformer
merges consecutive tool/assistant messages without checking for
duplicate toolUseId values, causing BedrockException errors.

Add _deduplicate_bedrock_content_blocks() — a generalized helper that
removes duplicate blocks by ID, logs a warning for each dropped
duplicate via verbose_logger, and preserves non-tool blocks (e.g.
cachePoint). Apply it at all four merge sites (sync/async × toolResult/
toolUse).

The Anthropic /messages path was fixed in PR #19324; this applies the
equivalent fix to the Bedrock Converse path.

Fixes #20048

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 18:23:43 +05:30
jquinter
1985aa04fa Fix Nova grounding web_search_options={} not applying systemTool (#20044)
* Fix Nova grounding web_search_options={} not applying systemTool

Two bugs prevented web_search_options={} from working for Nova grounding:

1. Empty dict falsy check: The condition `value and isinstance(value, dict)`
   short-circuits to False when value is {} (empty dict is falsy in Python).
   Changed to `isinstance(value, dict)` to match Anthropic's implementation.

2. Pre-formatted tools mangled by _bedrock_tools_pt: The systemTool
   (already in Bedrock format) was added to optional_params["tools"], but
   _process_tools_and_beta passed all tools through _bedrock_tools_pt which
   expects OpenAI-format tools. This corrupted the systemTool into an empty
   toolSpec. Fixed by separating systemTool blocks before transformation
   and appending them after.

Fixes follow-up to #19598

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix python-multipart Python version constraint for Poetry lock

python-multipart ^0.0.22 requires Python >=3.10 but the project supports
>=3.9. Add python = ">=3.10" marker so Poetry can resolve dependencies
for Python 3.9.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 18:23:31 +05:30
Carlo Alberto Ferraris
1e8848ca97 add missing indexes on VerificationToken table (#20040) 2026-02-02 18:22:15 +05:30
Hi120ki
c9757cd0d7 fix(guardrails): populate applied_guardrails when Model Armor blocks content (#20034)
Previously, when Model Armor guardrail blocked a request/response,
the `applied_guardrails` field was not populated in the logs because
`add_guardrail_to_applied_guardrails_header()` was called after the
HTTPException was raised.

This fix moves the `add_guardrail_to_applied_guardrails_header()` call
to before the blocking check in all hooks:
- async_pre_call_hook (pre_call mode)
- async_moderation_hook (during_call mode)
- async_post_call_success_hook (post_call mode)
- async_post_call_streaming_iterator_hook (streaming)

This ensures that even when a guardrail blocks content, the guardrail
name is properly recorded in the logs for observability.

Added regression tests to verify applied_guardrails is populated when
content is blocked.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-02 18:21:44 +05:30
Harshit Jain
6d86808eaf feat: enforce model-level TPM/RPM limits (enforce_model_rate_limits) … (#19230)
* feat: enforce model-level TPM/RPM limits (enforce_model_rate_limits) flag

* fix lint errors
2026-02-02 18:18:46 +05:30
Harshit Jain
a457162517 fix: handle deprecated 'redis_db' arg to prevent crash (#19808)
* fix: handle deprecated 'redis_db' arg to prevent crash

* renamed: changed dir
2026-02-02 18:18:05 +05:30
Cesar Garcia
61a84e9fdb fix(anthropic-adapter): truncate tool names exceeding OpenAI's 64-char limit (#20107)
When using LiteLLM's Anthropic /v1/messages endpoint to route requests to
OpenAI models, requests fail if any tool name exceeds OpenAI's 64-character
limit. Anthropic API has no such limit, causing compatibility issues.

Changes:
- Add truncate_tool_name() function using {55-char-prefix}_{8-char-hash} format
- Modify translate_anthropic_tools_to_openai() to truncate and return mapping
- Modify translate_anthropic_tool_choice_to_openai() to truncate tool name
- Restore original tool names in responses using the mapping
- Support tool name restoration in streaming responses
- Add backwards-compatible API (existing methods still work)

The fix only applies when routing Anthropic requests to OpenAI models.
Native Anthropic/Claude requests pass through unchanged.
2026-02-02 18:16:07 +05:30
Harshit Jain
72e5193451 fix: models loadbalancing billing issue by filter (#18891) (#19220)
* fix: models loadbalancing billing issue by filter (#18891)

* fix: models loadbalancing billing issue by filter

* fix: separate key and team access groups in metadata

* fix: lint issues
2026-02-02 18:14:39 +05:30
Aarish Alam
3e04e20205 🐛 Bug Fix #19642 : bug in Vertex AI context caching (#19657)
* add vertex tests

* add uperbound

* add pagination tests
2026-02-02 18:13:34 +05:30
Chesars
b3f1696946 refactor(vertex_ai): reuse get_vertex_base_url for URL construction
Use existing get_vertex_base_url from common_utils instead of duplicating
the global vs regional URL logic in create_vertex_url and get_api_base.
2026-02-02 18:13:18 +05:30
Chesars
3215dc4d4e feat(vertex_ai): add global endpoint support for Qwen MaaS models
Fixes #19788

- Add `supported_regions: ["global"]` to Qwen MaaS models in model_prices_and_context_window.json
- Update `get_supported_regions()` to read directly from `model_cost` dict
- Update `get_complete_vertex_url()` to use `get_vertex_region()` for global-only models
- Update `create_vertex_url()` to generate correct URL for global location (without region prefix)
- Add tests for Qwen global endpoint support
2026-02-02 18:13:10 +05:30
Emerson Gomes
bb5397d9b2 fix: enforce scheme for Azure AI rerank api_base 2026-02-02 18:13:04 +05:30
Emerson Gomes
92763a14a9 Update litellm/llms/azure_ai/rerank/transformation.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-02 18:12:59 +05:30
Emerson Gomes
c4dd22c079 fix: broaden Azure AI rerank URL handling 2026-02-02 18:12:52 +05:30
Chesars
11fd92c21b refactor(image-gen): move thought_signature to provider_specific_fields
Per review feedback, thought_signature should not be a root-level
param on ImageObject as it's not OpenAI compatible. Moved to
provider_specific_fields dict to match the pattern used in chat
completions (Message, Delta, Choices, etc).
2026-02-02 18:12:41 +05:30
Chesars
b2463291c7 fix(image-gen): add thought_signature to ImageObject for Gemini 3 Pro
Fixes #17184 - Gemini 3 Pro image preview model returns a thoughtSignature
field required for interactive image editing. This change:

- Adds thought_signature field to ImageObject class
- Updates Gemini and Vertex AI transformations to extract thoughtSignature
- Adds test for thought_signature in response transformation
2026-02-02 18:12:28 +05:30
Sameer Kankute
27b4052231
Merge pull request #20244 from BerriAI/litellm_nova_sonic_imp_2_feb
[Feat]Add support for nova sonic Speech to speech model
2026-02-02 18:04:02 +05:30
Sameer Kankute
8e2f7e5757 Fix mypy issues 2026-02-02 17:58:01 +05:30
Sameer Kankute
686aafe03a
Merge pull request #20262 from BerriAI/litellm_test_bedrock_optional_params_embeddings_dimension
Litellm test bedrock optional params embeddings dimension
2026-02-02 17:49:47 +05:30
Sameer Kankute
bb363f0307 Fix: test_bedrock_optional_params_embeddings_dimension 2026-02-02 17:49:18 +05:30
Sameer Kankute
01cdc272ec Fix: test_bedrock_optional_params_embeddings_dimension 2026-02-02 17:47:20 +05:30
Sameer Kankute
be0bb975c0 Fix test_aaamodel_prices_and_context_window_json_is_valid 2026-02-02 17:46:37 +05:30
Sameer Kankute
dafa26baa6
Merge pull request #20247 from BerriAI/litellm_smoketest_suite
Add Anthropic caching and context tests
2026-02-02 17:45:25 +05:30
Sameer Kankute
19f6640309
Merge pull request #20249 from BerriAI/litellm_add_0_budget_model_bypass2
[Feat] Add support for 0 cost models
2026-02-02 17:45:05 +05:30
Sameer Kankute
fe7c7dadba
Merge pull request #20253 from BerriAI/litellm_SAP-model-routing-to-OpenAI
Fix open_ai_embedding_models to have custom_llm_provider None
2026-02-02 17:44:14 +05:30
Sameer Kankute
8d65ac62f7
Merge pull request #20254 from BerriAI/litellm_anthropic_reasoning_content
fix: Map reasoning content to anthropic thinking block(streaming+non-streaming)
2026-02-02 17:43:50 +05:30
Sameer Kankute
fff35ee032
Merge pull request #20257 from BerriAI/litellm_slack_alert_fix_jfeb_02
Fix: Slack alert issue
2026-02-02 17:43:05 +05:30
Sameer Kankute
7773a92069
Merge pull request #20258 from BerriAI/litellm_cerebras_reasoning
fix: add reasoning param support for GPT OSS cerebras
2026-02-02 17:42:28 +05:30
Sameer Kankute
415c26f281 fix: add reasoning param support for GPT OSS cerebras 2026-02-02 17:20:04 +05:30
Sameer Kankute
72482c0cb5 Fix: Slack alert issue 2026-02-02 16:49:10 +05:30
Sameer Kankute
15cec5a4a0
Merge pull request #20255 from BerriAI/litellm_tts_doc
Update Vertex AI Text to Speech doc to show use of audio
2026-02-02 16:16:28 +05:30
Sameer Kankute
c6f178eeae Update Vertex AI Text to Speech doc to show use of audio 2026-02-02 16:15:48 +05:30
Sameer Kankute
eee737520f fix: Map reasoning content to anthropic thinking block(streaming+non-streaming) 2026-02-02 16:04:13 +05:30
Sameer Kankute
c2298c2417 Fix open_ai_embedding_models to have custom_llm_provider None 2026-02-02 15:18:56 +05:30
Sameer Kankute
6f2dc19ea0
Merge pull request #20214 from cscguochang/feat/bedrock-1hr-tiered-caching-cost
feat(bedrock): add 1hr tiered caching costs for long-context models (#18988)
2026-02-02 15:05:22 +05:30
Sameer Kankute
1a7fcfb713
Merge pull request #19881 from jayy-77/feat/user-agent-customization-issue-19017
feat: add User-Agent customization support
2026-02-02 15:01:39 +05:30
Sameer Kankute
14c2932387 Add docs on Zero-Cost Models 2026-02-02 13:29:37 +05:30
Sameer Kankute
1f4222e6b2 Add support for 0 cost models 2026-02-02 13:29:37 +05:30
Sameer Kankute
88cb101d88 Add Anthropic caching and context tests 2026-02-02 13:25:47 +05:30
Sameer Kankute
c13cb4cf51
Merge pull request #20235 from amirzaushnizer/litellm-support-cohere-embed-v4
feat: Support dimensions param for Cohere embed v4
2026-02-02 12:52:16 +05:30
Sameer Kankute
5e17dea24d Add tutorial to use bedrock nova 2026-02-02 12:19:17 +05:30
Sameer Kankute
ea6c31a02a Add documentation on nova sonic 2026-02-02 12:19:04 +05:30
Sameer Kankute
cdeefe85ea Add nova sonic tests 2026-02-02 12:18:43 +05:30
Sameer Kankute
eb0f019359 Add nova sonic realtime 2026-02-02 12:18:32 +05:30
Sameer Kankute
037c10d7cb Add bedrock route in realtim main.py 2026-02-02 12:16:05 +05:30
Shin
0c74e70f65 docs: add OpenClaw integration tutorial
Shows how to route OpenClaw through LiteLLM proxy for:
- Unified logging and cost tracking
- Virtual keys with spend limits
- Model switching without config changes
- Remote access via Gateway mode
2026-02-01 21:04:50 +00:00
amirzaushnizer
f0853b2564 feat: enhance Cohere embedding support with additional parameters and model version 2026-02-01 18:04:08 +02:00
yuneng-jiang
b8876838a6 revert react 18 2026-01-31 20:09:39 -08:00