From dbeee7470be090eda155ad58308f087c9cbae9af Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 7 Mar 2026 03:58:48 +0000 Subject: [PATCH] fix: override _supports_reasoning_effort_level for Azure gpt5_series prefix The Azure GPT-5 config uses 'gpt5_series/' as a routing prefix, but _supports_factory(model='gpt5_series/gpt-5.1') fails to resolve because 'gpt5_series' is not a recognized provider. Override the method to strip the prefix and prepend 'azure/' for correct model info lookup. Co-authored-by: Ishaan Jaff --- litellm/llms/azure/chat/gpt_5_transformation.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/litellm/llms/azure/chat/gpt_5_transformation.py b/litellm/llms/azure/chat/gpt_5_transformation.py index ffdd52c30ab..78d6372d023 100644 --- a/litellm/llms/azure/chat/gpt_5_transformation.py +++ b/litellm/llms/azure/chat/gpt_5_transformation.py @@ -15,6 +15,21 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): GPT5_SERIES_ROUTE = "gpt5_series/" + @classmethod + def _supports_reasoning_effort_level(cls, model: str, level: str) -> bool: + """Override to handle gpt5_series/ prefix used for Azure routing. + + The parent class calls ``_supports_factory(model, custom_llm_provider=None)`` + which fails to resolve ``gpt5_series/gpt-5.1`` to the correct Azure model + entry. Strip the prefix and prepend ``azure/`` so the lookup finds + ``azure/gpt-5.1`` in model_prices_and_context_window.json. + """ + if model.startswith(cls.GPT5_SERIES_ROUTE): + model = "azure/" + model[len(cls.GPT5_SERIES_ROUTE) :] + elif not model.startswith("azure/"): + model = "azure/" + model + return super()._supports_reasoning_effort_level(model, level) + @classmethod def is_model_gpt_5_model(cls, model: str) -> bool: """Check if the Azure model string refers to a gpt-5 variant.