The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Bug Fix] Ensure supported `bedrock/converse/` params = `bedrock/` params (#12466)
Ishaan Jafff62b0ca52b20
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.pyindex 59b83151f55..bd6a29172db 100644--- a/litellm/llms/bedrock/chat/converse_transformation.py+++ b/litellm/llms/bedrock/chat/converse_transformation.py@@ -138,6 +138,7 @@ class AmazonConverseConfig(BaseConfig):or base_model.startswith("meta.llama3-1")or base_model.startswith("meta.llama3-2")or base_model.startswith("meta.llama3-3")+ or base_model.startswith("meta.llama4")or base_model.startswith("amazon.nova")or supports_function_calling(model=model, custom_llm_provider=self.custom_llm_provider@@ -145,8 +146,14 @@ class AmazonConverseConfig(BaseConfig):):supported_params.append("tools")- if litellm.utils.supports_tool_choice(- model=model, custom_llm_provider=self.custom_llm_provider+ if (+ litellm.utils.supports_tool_choice(+ model=model, custom_llm_provider=self.custom_llm_provider+ )+ or litellm.utils.supports_tool_choice(+ model=base_model,+ custom_llm_provider=self.custom_llm_provider+ )):# only anthropic and mistral support tool choice config. otherwise (E.g. cohere) will fail the call - https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolChoice.htmlsupported_params.append("tool_choice")@@ -155,10 +162,15 @@ class AmazonConverseConfig(BaseConfig):"claude-3-7" in modelor "claude-sonnet-4" in modelor "claude-opus-4" in model+ or "deepseek.r1" in modelor supports_reasoning(model=model,custom_llm_provider=self.custom_llm_provider,)+ or supports_reasoning(+ model=base_model,+ custom_llm_provider=self.custom_llm_provider+ )):supported_params.append("thinking")supported_params.append("reasoning_effort")diff --git a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.pyindex 34dcb325d71..b4e8ca93c1f 100644--- a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py+++ b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py@@ -10,6 +10,7 @@ sys.path.insert() # Adds the parent directory to the system pathfrom unittest.mock import MagicMock, patch+import litellmfrom litellm.llms.bedrock.chat.converse_transformation import AmazonConverseConfigfrom litellm.types.llms.bedrock import ConverseTokenUsageBlock@@ -234,3 +235,36 @@ def test_transform_tool_call_with_cache_control():transformed_cache_msg = result["toolConfig"]["tools"][1]assert "cachePoint" in transformed_cache_msgassert transformed_cache_msg["cachePoint"]["type"] == "default"++def test_get_supported_openai_params():+ config = AmazonConverseConfig()+ supported_params = config.get_supported_openai_params(+ model="bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0"+ )+ assert "tools" in supported_params+ assert "tool_choice" in supported_params+ assert "thinking" in supported_params+ assert "reasoning_effort" in supported_params+++def test_get_supported_openai_params_bedrock_converse():+ """+ Test that all documented bedrock converse models have the same set of supported openai params when using+ `bedrock/converse/` or `bedrock/` prefix.++ Note: This test is critical for routing, if we ever remove `litellm.BEDROCK_CONVERSE_MODELS`,+ please update this test to read `bedrock_converse` models from the model cost map.+ """+ for model in litellm.BEDROCK_CONVERSE_MODELS:+ print(f"Testing model: {model}")+ config = AmazonConverseConfig()+ supported_params_without_prefix = config.get_supported_openai_params(+ model=model+ )++ supported_params_with_prefix = config.get_supported_openai_params(+ model=f"bedrock/converse/{model}"+ )++ assert set(supported_params_without_prefix) == set(supported_params_with_prefix), f"Supported params mismatch for model: {model}. Without prefix: {supported_params_without_prefix}, With prefix: {supported_params_with_prefix}"+ print(f"✅ Passed for model: {model}")