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): type GPT-5 reasoning field and update capability test
Matthew Lapointe418012aac5e1
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.pyindex b995a948dd8..a4d37810f82 100644--- a/litellm/llms/bedrock/chat/converse_transformation.py+++ b/litellm/llms/bedrock/chat/converse_transformation.py@@ -426,8 +426,8 @@ class AmazonConverseConfig(BaseConfig):if "gpt-oss" in model:optional_params["reasoning_effort"] = reasoning_effortelif "openai.gpt-5" in model:- optional_params.pop("thinking", None)- optional_params["reasoning"] = {"effort": reasoning_effort}+ reasoning: Final[BedrockConverseGptReasoningEffortBlock] = {"effort": reasoning_effort}+ optional_params["reasoning"] = reasoningelif 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/types/llms/bedrock.py b/litellm/types/llms/bedrock.pyindex 6ae2e31fe60..ed23db597ae 100644--- a/litellm/types/llms/bedrock.py+++ b/litellm/types/llms/bedrock.py@@ -3,7 +3,7 @@ from collections.abc import Sequencefrom enum import Enumfrom typing import TYPE_CHECKING, Any, Final, Literal-from typing_extensions import Required, TypedDict, override+from typing_extensions import ReadOnly, Required, TypedDict, overridefrom .openai import ChatCompletionToolCallChunk@@ -97,6 +97,10 @@ class BedrockConverseReasoningContentBlockDelta(TypedDict, total=False):text: str+class BedrockConverseGptReasoningEffortBlock(TypedDict):+ effort: ReadOnly[str]++class GuardrailConverseTextBlock(TypedDict, total=False):text: strdiff --git a/tests/test_litellm/llms/bedrock/test_cross_region_inference_profile_mapping.py b/tests/test_litellm/llms/bedrock/test_cross_region_inference_profile_mapping.pyindex dbd31c7e81b..1388073381e 100644--- a/tests/test_litellm/llms/bedrock/test_cross_region_inference_profile_mapping.py+++ b/tests/test_litellm/llms/bedrock/test_cross_region_inference_profile_mapping.py@@ -293,15 +293,16 @@ def test_bedrock_gpt_5_6_advertises_only_converse_supported_features(@pytest.mark.parametrize("profile", GPT_5_6_PROFILES, ids=lambda p: p.model_id)-def test_bedrock_gpt_5_6_offers_tools_but_not_reasoning(profile, local_model_cost_map):- """Converse rejects the Anthropic-shaped thinking block LiteLLM emits for- reasoning_effort, so neither reasoning param may be offered yet, while the tool- params these models do accept must be."""+def test_bedrock_gpt_5_6_offers_tools_and_reasoning_effort_but_not_thinking(profile, local_model_cost_map):+ """GPT-5.x on Converse maps reasoning_effort to reasoning.effort, so reasoning_effort+ is offered while the Anthropic-only thinking/output_config are not, alongside the tool+ params these models accept."""supported = AmazonConverseConfig().get_supported_openai_params(model=f"bedrock/{profile.model_id}")assert "tools" in supportedassert "tool_choice" in supported- assert "reasoning_effort" not in supported+ assert "reasoning_effort" in supportedassert "thinking" not in supported+ assert "output_config" not in supported