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
fix(bedrock): route reasoning_effort to reasoning.effort for OpenAI GPT-5.x on Converse
Matthew Lapointe74e86d3c0d16
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.pyindex 767677cbcbf..38dabafa441 100644--- a/litellm/llms/bedrock/chat/converse_transformation.py+++ b/litellm/llms/bedrock/chat/converse_transformation.py@@ -418,12 +418,18 @@ class AmazonConverseConfig(BaseConfig):Handle the reasoning_effort parameter based on the model type.- GPT-OSS models: passed through unchanged via additionalModelRequestFields.+ - OpenAI GPT-5.x models: mapped to ``reasoning.effort`` via additionalModelRequestFields.- Nova 2 models: transformed to reasoningConfig.- Anthropic models: mapped to ``thinking`` (and ``output_config.effort`` onadaptive Claude 4.6 / 4.7)."""if "gpt-oss" in model:optional_params["reasoning_effort"] = reasoning_effort+ elif "openai.gpt-5" in model:+ # Converse rejects Anthropic's `thinking` for OpenAI GPT-5.x; effort goes+ # under additionalModelRequestFields as {"reasoning": {"effort": ...}}.+ optional_params.pop("thinking", None)+ optional_params["reasoning"] = {"effort": reasoning_effort}elif self._is_nova_2_model(model):reasoning_config: Final = self._transform_reasoning_effort_to_reasoning_config(reasoning_effort)optional_params.update(reasoning_config)diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 9ca8d9e1bac..7fa0e8b73d8 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -49473,6 +49473,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-sol": {@@ -49498,6 +49499,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"us.openai.gpt-5.6-terra": {@@ -49523,6 +49525,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-terra": {@@ -49548,6 +49551,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"us.openai.gpt-5.6-luna": {@@ -49573,6 +49577,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-luna": {@@ -49598,6 +49603,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"bedrock_mantle/openai.gpt-5.5": {diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 9ca8d9e1bac..7fa0e8b73d8 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -49473,6 +49473,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-sol": {@@ -49498,6 +49499,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"us.openai.gpt-5.6-terra": {@@ -49523,6 +49525,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-terra": {@@ -49548,6 +49551,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"us.openai.gpt-5.6-luna": {@@ -49573,6 +49577,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"global.openai.gpt-5.6-luna": {@@ -49598,6 +49603,7 @@],"supports_function_calling": true,"supports_tool_choice": true,+ "supports_reasoning": true,"supports_vision": true},"bedrock_mantle/openai.gpt-5.5": {diff --git a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.pyindex 4d2c077b548..66b588168e9 100644--- a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py+++ b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py@@ -284,6 +284,37 @@ def test_reasoning_with_forced_tool_choice_switches_to_auto():assert optional_params["tool_choice"] == {"auto": {}}+ "model",+ [+ "us.openai.gpt-5.6-sol",+ "global.openai.gpt-5.6-terra",+ "bedrock/converse/us.openai.gpt-5.6-luna",+ ],+)+def test_reasoning_effort_maps_to_reasoning_effort_for_openai_gpt5_converse(model, local_model_cost_map):+ """OpenAI GPT-5.x on Bedrock Converse routes reasoning_effort to+ ``additionalModelRequestFields.reasoning.effort`` rather than Anthropic ``thinking``."""+ config = AmazonConverseConfig()++ assert "reasoning_effort" in config.get_supported_openai_params(model=model)++ optional_params = config.map_openai_params(+ non_default_params={"reasoning_effort": "high"},+ optional_params={},+ model=model,+ drop_params=False,+ )++ assert optional_params["reasoning"] == {"effort": "high"}+ assert "thinking" not in optional_params+ assert "reasoning_effort" not in optional_params++ _, additional_request_params, _, _ = config._prepare_request_params(optional_params, model)+ assert additional_request_params["reasoning"] == {"effort": "high"}+ assert "thinking" not in additional_request_params++@pytest.mark.parametrize("model",[