From 141582c3d3f35f2524ca353587e8bc4414ae3af7 Mon Sep 17 00:00:00 2001 From: okxint Date: Thu, 10 Sep 2026 11:46:42 +0530 Subject: [PATCH] fix(gpt5): enforce supports_none_reasoning_effort=false gate for reasoning_effort=none The model map carries supports_none_reasoning_effort for gpt-5 and gpt-5-mini (both false), but the gating block in map_openai_params had branches for xhigh (opt-in) and minimal/low (opt-out) with no branch for none. The missing gate meant none was forwarded to the provider regardless of the map, producing a provider 400 that litellm had all the information to prevent. Add an elif effective_effort == "none" branch that mirrors the minimal/low opt-out pattern: pass through when the map is silent, raise UnsupportedParamsError (400) or drop the param when the map explicitly sets supports_none_reasoning_effort=false. This makes the three opt-out effort levels (minimal, low, none) consistent: all three now gate on the explicit-false map entry rather than having none silently ignored. Fixes #40472. Co-Authored-By: Claude Sonnet 4.6 --- litellm/llms/openai/chat/gpt_5_transformation.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.py index b02f953425d..cfd51cc7d3c 100644 --- a/litellm/llms/openai/chat/gpt_5_transformation.py +++ b/litellm/llms/openai/chat/gpt_5_transformation.py @@ -300,6 +300,20 @@ class OpenAIGPT5Config(OpenAIGPTConfig): message=(f"reasoning_effort={effective_effort} is not supported for this model."), status_code=400, ) + elif effective_effort == "none": + # none is opt-out: unknown models pass through; only block when + # the model map explicitly sets supports_none_reasoning_effort=false. + # gpt-5 and gpt-5-mini are both marked supports_none_reasoning_effort=false + # and OpenAI returns 400 for none on those models. + if self._is_reasoning_effort_level_explicitly_disabled(model, effective_effort): + if litellm.drop_params or drop_params: + non_default_params.pop("reasoning_effort", None) + optional_params.pop("reasoning_effort", None) + else: + raise litellm.utils.UnsupportedParamsError( + message=(f"reasoning_effort={effective_effort} is not supported for this model."), + status_code=400, + ) ################################################################ # max_tokens is not supported for gpt-5 models on OpenAI API