From a1f3903c70d249fc05f42a854bcb821bbc0b1966 Mon Sep 17 00:00:00 2001 From: Rodrigoue9 Date: Tue, 18 Aug 2026 19:11:53 -0300 Subject: [PATCH 1/2] fix(openai/reasoning): support reasoning_effort in get_supported_openai_params and add missing ModelInfo fields (#37359) --- .../llms/openai/chat/gpt_transformation.py | 3 ++ litellm/types/utils.py | 2 + litellm/utils.py | 14 ++++++ tests/litellm/test_reasoning_effort_config.py | 47 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 tests/litellm/test_reasoning_effort_config.py diff --git a/litellm/llms/openai/chat/gpt_transformation.py b/litellm/llms/openai/chat/gpt_transformation.py index 16fd042cb2f..7b2249c0168 100644 --- a/litellm/llms/openai/chat/gpt_transformation.py +++ b/litellm/llms/openai/chat/gpt_transformation.py @@ -175,6 +175,9 @@ class OpenAIGPTConfig(BaseLLMModelInfo, BaseConfig): model_specific_params.append( "user" ) # user is not a param supported by all openai-compatible endpoints - e.g. azure ai + + if litellm.utils.supports_reasoning(model=model, custom_llm_provider="openai"): + model_specific_params.append("reasoning_effort") return base_params + model_specific_params def _map_openai_params( diff --git a/litellm/types/utils.py b/litellm/types/utils.py index ae9395fc851..a75a20926e6 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -158,6 +158,8 @@ class ProviderSpecificModelInfo(TypedDict, total=False): supports_none_reasoning_effort: bool | None supports_minimal_reasoning_effort: bool | None supports_low_reasoning_effort: bool | None + supports_medium_reasoning_effort: bool | None + supports_high_reasoning_effort: bool | None supports_xhigh_reasoning_effort: bool | None supports_max_reasoning_effort: bool | None supports_output_config: bool | None diff --git a/litellm/utils.py b/litellm/utils.py index 73099eb47f4..42177c550e5 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2605,6 +2605,20 @@ def supports_reasoning(model: str, custom_llm_provider: str | None = None) -> bo return _supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_reasoning") +def supports_medium_reasoning_effort(model: str, custom_llm_provider: str | None = None) -> bool: + """ + Check if the given model supports medium reasoning effort and return a boolean value. + """ + return _supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_medium_reasoning_effort") + + +def supports_high_reasoning_effort(model: str, custom_llm_provider: str | None = None) -> bool: + """ + Check if the given model supports high reasoning effort and return a boolean value. + """ + return _supports_factory(model=model, custom_llm_provider=custom_llm_provider, key="supports_high_reasoning_effort") + + def supports_native_structured_output(model: str, custom_llm_provider: str | None = None) -> bool: """ Check if the given model supports native structured outputs and return a boolean value. diff --git a/tests/litellm/test_reasoning_effort_config.py b/tests/litellm/test_reasoning_effort_config.py new file mode 100644 index 00000000000..db1009868bf --- /dev/null +++ b/tests/litellm/test_reasoning_effort_config.py @@ -0,0 +1,47 @@ +import pytest +import litellm +from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig +from litellm.utils import ( + supports_reasoning, + supports_medium_reasoning_effort, + supports_high_reasoning_effort, +) + + +def test_openai_gpt_config_supported_params_includes_reasoning_effort_when_supported(): + config = OpenAIGPTConfig() + + litellm.register_model({ + "custom-reasoning-model": { + "max_tokens": 4096, + "input_cost_per_token": 0.00001, + "output_cost_per_token": 0.00002, + "litellm_provider": "openai", + "mode": "chat", + "supports_reasoning": True, + "supports_medium_reasoning_effort": True, + "supports_high_reasoning_effort": True, + } + }) + + supported_params = config.get_supported_openai_params(model="custom-reasoning-model") + assert "reasoning_effort" in supported_params + assert supports_reasoning("custom-reasoning-model", custom_llm_provider="openai") is True + assert supports_medium_reasoning_effort("custom-reasoning-model", custom_llm_provider="openai") is True + assert supports_high_reasoning_effort("custom-reasoning-model", custom_llm_provider="openai") is True + + +def test_supports_medium_and_high_reasoning_effort_helpers(): + litellm.register_model({ + "plain-chat-model": { + "max_tokens": 4096, + "input_cost_per_token": 0.00001, + "output_cost_per_token": 0.00002, + "litellm_provider": "openai", + "mode": "chat", + "supports_reasoning": False, + } + }) + + assert supports_medium_reasoning_effort("plain-chat-model", custom_llm_provider="openai") is False + assert supports_high_reasoning_effort("plain-chat-model", custom_llm_provider="openai") is False From 7cd5d46c3651dff7a1bb66c5246ffc17395e547a Mon Sep 17 00:00:00 2001 From: Rodrigoue9 Date: Tue, 18 Aug 2026 19:37:32 -0300 Subject: [PATCH 2/2] fix(openai/reasoning): support reasoning_effort in get_supported_openai_params (#37359) --- litellm/llms/openai/chat/gpt_transformation.py | 2 +- tests/{litellm => test_litellm}/test_reasoning_effort_config.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/{litellm => test_litellm}/test_reasoning_effort_config.py (100%) diff --git a/litellm/llms/openai/chat/gpt_transformation.py b/litellm/llms/openai/chat/gpt_transformation.py index 7b2249c0168..d116e749e9a 100644 --- a/litellm/llms/openai/chat/gpt_transformation.py +++ b/litellm/llms/openai/chat/gpt_transformation.py @@ -176,7 +176,7 @@ class OpenAIGPTConfig(BaseLLMModelInfo, BaseConfig): "user" ) # user is not a param supported by all openai-compatible endpoints - e.g. azure ai - if litellm.utils.supports_reasoning(model=model, custom_llm_provider="openai"): + if litellm.utils.supports_reasoning(model=model, custom_llm_provider="openai") and not model.startswith("gpt-5-chat"): model_specific_params.append("reasoning_effort") return base_params + model_specific_params diff --git a/tests/litellm/test_reasoning_effort_config.py b/tests/test_litellm/test_reasoning_effort_config.py similarity index 100% rename from tests/litellm/test_reasoning_effort_config.py rename to tests/test_litellm/test_reasoning_effort_config.py