Skip to content

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]

Merge branch 'litellm_internal_staging' into litellm_fix_bedrock_deepseek_thinking_leak

mateo-berri263c34fa2644
diff --cc litellm/llms/bedrock/chat/converse_transformation.py
index a9f34cdd683,4cdf387a11d..fa18361e44c
--- a/litellm/llms/bedrock/chat/converse_transformation.py
+++ b/litellm/llms/bedrock/chat/converse_transformation.py
@@@ -422,15 -427,15 +427,15 @@@ class AmazonConverseConfig(BaseConfig)
"""
Handle the reasoning_effort parameter based on the model type.
- - GPT-OSS models: passed through unchanged via additionalModelRequestFields.
+ - GPT-OSS and DeepSeek V3 models: passed through unchanged via additionalModelRequestFields.
- - OpenAI GPT-5.x models: mapped to ``reasoning.effort`` via additionalModelRequestFields.
+ - OpenAI GPT-5.x and GPT-6 models: mapped to ``reasoning.effort`` via additionalModelRequestFields.
- Nova 2 models: transformed to reasoningConfig.
- Anthropic models: mapped to ``thinking`` (and ``output_config.effort`` on
adaptive Claude 4.6 / 4.7).
"""
- if "gpt-oss" in model:
+ if "gpt-oss" in model or "deepseek" in model:
optional_params["reasoning_effort"] = reasoning_effort
- elif "openai.gpt-5" in model:
+ elif self._is_openai_gpt_reasoning_model(model):
reasoning: Final[BedrockConverseGptReasoningEffortBlock] = {"effort": reasoning_effort}
optional_params["reasoning"] = reasoning
elif self._is_nova_2_model(model):
@@@ -594,11 -569,12 +599,15 @@@
# 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.html
supported_params.append("tool_choice")
- if "gpt-oss" in model or "openai.gpt-5" in model or "openai.gpt-5" in base_model:
+ if (
+ "gpt-oss" in model
+ or self._is_openai_gpt_reasoning_model(model)
+ or self._is_openai_gpt_reasoning_model(base_model)
+ ):
supported_params.append("reasoning_effort")
+ elif self._is_deepseek_model(model=model, base_model=base_model):
+ if not self._is_deepseek_r1_model(model=model, base_model=base_model):
+ supported_params.append("reasoning_effort")
elif self._is_nova_2_model(model):
# Nova 2 models support reasoning_effort (transformed to reasoningConfig)
# These models use a different reasoning structure than Anthropic's thinking parameter
@@@ -948,12 -929,7 +957,12 @@@
optional_params["_parallel_tool_use_config"] = {
"tool_choice": {"type": "auto", "disable_parallel_tool_use": not value}
}
- if param == "thinking" and not self._is_openai_gpt_reasoning_model(model):
+ if param == "thinking" and drop_thinking_param:
+ verbose_logger.debug(
+ "Dropping unsupported `thinking` param for Bedrock model=%s; it reasons natively.",
+ model,
+ )
- elif param == "thinking" and "openai.gpt-5" not in model:
++ elif param == "thinking" and not self._is_openai_gpt_reasoning_model(model):
if (
isinstance(value, dict)
and value.get("type") == "adaptive"