From ce3ff5df0fd034ad2f4e291079a960dd0413ccbd Mon Sep 17 00:00:00 2001 From: Harshvardhan Date: Tue, 14 Jul 2026 22:36:51 +0530 Subject: [PATCH] fix(openai): bridge gpt-5.6+ with tools to /v1/responses even without reasoning_effort gpt-5.6 family models fail on /v1/chat/completions when function tools are present because OpenAI applies a default reasoning_effort server-side. Bridge to /v1/responses unconditionally for is_model_gpt_5_4_plus_model with tools. Fixes: #33221 --- litellm/main.py | 6 ++++-- tests/test_litellm/test_gpt56_bridge.py | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/test_litellm/test_gpt56_bridge.py diff --git a/litellm/main.py b/litellm/main.py index 7d457d9cdd1..ee76f6eb190 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1014,8 +1014,10 @@ def responses_api_bridge_check( and model_info.get("mode") != "responses" and OpenAIGPT5Config.is_model_gpt_5_model(model) and not OpenAIGPT5Config.is_model_gpt_5_search_model(model) - and reasoning_effort is not None - and (reasoning_summary is not None or (OpenAIGPT5Config.is_model_gpt_5_4_plus_model(model) and tools)) + and ( + (reasoning_effort is not None and reasoning_summary is not None) + or (OpenAIGPT5Config.is_model_gpt_5_4_plus_model(model) and tools) + ) ): model_info["mode"] = "responses" model = model.replace("responses/", "") diff --git a/tests/test_litellm/test_gpt56_bridge.py b/tests/test_litellm/test_gpt56_bridge.py new file mode 100644 index 00000000000..bd1ac136593 --- /dev/null +++ b/tests/test_litellm/test_gpt56_bridge.py @@ -0,0 +1,9 @@ +"""Regression test for https://github.com/BerriAI/litellm/issues/33221""" +from litellm.main import responses_api_bridge_check + + +def test_gpt56_tools_bridged_to_responses_without_reasoning_effort(): + tools = [{"type": "function", "function": {"name": "get_weather", "description": "Get weather", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}}] + for model in ["gpt-5.6-sol", "gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6"]: + model_info, _ = responses_api_bridge_check(model=model, custom_llm_provider="openai", tools=tools, reasoning_effort=None) + assert model_info.get("mode") == "responses", f"{model} with tools should bridge to responses even without reasoning_effort"