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(openai): drop all reasoning_effort for gpt-5.4 + tools, including 'none'
Chesars690ad4c45b01
diff --git a/docs/my-website/docs/providers/openai.md b/docs/my-website/docs/providers/openai.mdindex 9d557303ef2..80931ad8217 100644--- a/docs/my-website/docs/providers/openai.md+++ b/docs/my-website/docs/providers/openai.md@@ -638,7 +638,9 @@ This is useful when you want to use [Responses API](https://platform.openai.com/:::tip gpt-5.4 + reasoning_effort + function tools-OpenAI does not support `reasoning_effort` with function tools for `gpt-5.4` in `/v1/chat/completions`. Use the responses bridge instead:+LiteLLM drops `reasoning_effort` from `gpt-5.4` requests to `litellm.completion()` that include tools, since that combination is supported in the Responses API.++If you need reasoning **and** tools together, use the responses bridge instead:```pythonresponse = litellm.completion(diff --git a/docs/my-website/docs/reasoning_content.md b/docs/my-website/docs/reasoning_content.mdindex 5dd40122c71..8bf59f66a33 100644--- a/docs/my-website/docs/reasoning_content.md+++ b/docs/my-website/docs/reasoning_content.md@@ -594,7 +594,9 @@ Expected Response:::tip gpt-5.4: reasoning_effort + function tools-OpenAI does not support `reasoning_effort` with function tools for `gpt-5.4` in `/v1/chat/completions`. Use `openai/responses/gpt-5.4` to route through the Responses API instead. See [Responses API Bridge](/docs/providers/openai#openai-chat-completion-to-responses-api-bridge) for details.+LiteLLM drops `reasoning_effort` from `gpt-5.4` requests to `litellm.completion()` that include tools, since that combination is supported in the Responses API.++If you need reasoning **and** tools together, use `openai/responses/gpt-5.4` to route through the Responses API instead. See [Responses API Bridge](/docs/providers/openai#openai-chat-completion-to-responses-api-bridge) for details.:::diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.pyindex 17135ce9574..675242ae684 100644--- a/litellm/llms/openai/chat/gpt_5_transformation.py+++ b/litellm/llms/openai/chat/gpt_5_transformation.py@@ -228,13 +228,13 @@ class OpenAIGPT5Config(OpenAIGPTConfig):"max_tokens")- # gpt-5.4: function calls not supported when reasoning_effort != "none"- # Drop reasoning_effort when tools are present (small minority of volume)+ # gpt-5.4: reasoning_effort + tools is only supported in the Responses API+ # Drop reasoning_effort when tools are present in chat completionsif self.is_model_gpt_5_4_model(model):has_tools = bool(non_default_params.get("tools") or optional_params.get("tools"))- if has_tools and effective_effort not in (None, "none"):+ if has_tools and effective_effort is not None:non_default_params.pop("reasoning_effort", None)optional_params.pop("reasoning_effort", None)diff --git a/tests/test_litellm/llms/openai/chat/test_openai_gpt_transformation.py b/tests/test_litellm/llms/openai/chat/test_openai_gpt_transformation.pyindex 90fdc2d20d6..0f743b1a93b 100644--- a/tests/test_litellm/llms/openai/chat/test_openai_gpt_transformation.py+++ b/tests/test_litellm/llms/openai/chat/test_openai_gpt_transformation.py@@ -460,11 +460,8 @@ class TestGPT5ReasoningEffortPreservation:assert "reasoning_effort" not in non_default_params- def test_reasoning_effort_dict_none_treated_as_none_for_tools(self):- """none-dict: {"effort": "none", "summary": "detailed"} is treated as effort=none.-- Tool-drop guard should NOT fire; reasoning_effort should be kept.- """+ def test_reasoning_effort_dict_none_dropped_for_gpt5_4_with_tools(self):+ """none-dict with tools on gpt-5.4: reasoning_effort is dropped."""tools = [{"type": "function", "function": {"name": "test", "description": "test"}}]non_default_params = {"reasoning_effort": {"effort": "none", "summary": "detailed"}, "tools": tools}optional_params = {}@@ -476,7 +473,7 @@ class TestGPT5ReasoningEffortPreservation:drop_params=False,)- assert non_default_params.get("reasoning_effort") == {"effort": "none", "summary": "detailed"}+ assert "reasoning_effort" not in non_default_paramsassert non_default_params.get("tools") == toolsdef test_reasoning_effort_dict_none_treated_as_none_for_sampling(self):diff --git a/tests/test_litellm/llms/openai/test_gpt5_transformation.py b/tests/test_litellm/llms/openai/test_gpt5_transformation.pyindex 13d2ebab14b..7c731e4e00a 100644--- a/tests/test_litellm/llms/openai/test_gpt5_transformation.py+++ b/tests/test_litellm/llms/openai/test_gpt5_transformation.py@@ -366,10 +366,10 @@ def test_gpt5_xhigh_dict_accepted_for_supported_model(config: OpenAIConfig):def test_gpt5_none_dict_with_tools_no_tool_drop(config: OpenAIConfig):- """Dict with effort='none' and tools: no tool-drop, reasoning_effort preserved.+ """Dict with effort='none' and tools: reasoning_effort dropped for gpt-5.4.- Regression: effective_effort='none' must be used for tool-drop guard so- {"effort": "none", "summary": "detailed"} is not incorrectly treated as non-none.+ gpt-5.4 drops all reasoning_effort when tools are present,+ since that combination is only supported in the Responses API."""tools = [{"type": "function", "function": {"name": "test", "description": "test"}}]params = config.map_openai_params(@@ -378,7 +378,7 @@ def test_gpt5_none_dict_with_tools_no_tool_drop(config: OpenAIConfig):model="gpt-5.4",drop_params=False,)- assert params["reasoning_effort"] == {"effort": "none", "summary": "detailed"}+ assert "reasoning_effort" not in paramsassert params["tools"] == tools@@ -414,7 +414,7 @@ def test_gpt5_preserves_reasoning_effort_dict_with_summary_from_optional_params(assert params["reasoning_effort"] == {"effort": "medium", "summary": "detailed"}-def test_gpt5_4_drops_reasoning_effort_when_tools_present(config: OpenAIConfig):+def test_gpt5_4_drops_reasoning_effort_when_user_sends_reasoning_and_tools(config: OpenAIConfig):"""gpt-5.4: function calls not supported with reasoning_effort != 'none'. Drop reasoning_effort."""tools = [{"type": "function", "function": {"name": "test", "description": "test"}}]params = config.map_openai_params(@@ -438,8 +438,8 @@ def test_gpt5_4_keeps_reasoning_effort_when_no_tools(config: OpenAIConfig):assert params["reasoning_effort"] == "high"-def test_gpt5_4_keeps_reasoning_effort_none_with_tools(config: OpenAIConfig):- """reasoning_effort='none' is kept when tools are present."""+def test_gpt5_4_drops_reasoning_effort_none_with_tools(config: OpenAIConfig):+ """reasoning_effort='none' is also dropped when tools are present for gpt-5.4."""tools = [{"type": "function", "function": {"name": "test", "description": "test"}}]params = config.map_openai_params(non_default_params={"reasoning_effort": "none", "tools": tools},@@ -447,7 +447,7 @@ def test_gpt5_4_keeps_reasoning_effort_none_with_tools(config: OpenAIConfig):model="gpt-5.4",drop_params=False,)- assert params["reasoning_effort"] == "none"+ assert "reasoning_effort" not in paramsassert params["tools"] == tools