From 0a9789249ee07c5acd5fa5ec11c23d2b1a11e388 Mon Sep 17 00:00:00 2001 From: Yiyang Liu <37043548+ianliuy@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:16:53 -0700 Subject: [PATCH] fix: add fallback for Azure deployment names in _supports_reasoning_effort_level (fixes #25850) When Azure deployment names (e.g. gpt-5.1-DataZoneStandard) are used, the registry lookup in _supports_reasoning_effort_level fails because these user-defined names don't exist in model_prices_and_context_window. This caused reasoning_effort='none' to be incorrectly rejected. Add a string-based fallback that checks known model prefixes (gpt-5.1, gpt-5.2) when the direct registry lookup returns False, restoring the 1.81.x behaviour for custom deployment names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Yiyang Liu <37043548+ianliuy@users.noreply.github.com> --- litellm/llms/azure/chat/gpt_5_transformation.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/litellm/llms/azure/chat/gpt_5_transformation.py b/litellm/llms/azure/chat/gpt_5_transformation.py index bc7483bf64d..92c5981c8c1 100644 --- a/litellm/llms/azure/chat/gpt_5_transformation.py +++ b/litellm/llms/azure/chat/gpt_5_transformation.py @@ -31,7 +31,20 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): model = "azure/" + model[len(cls.GPT5_SERIES_ROUTE) :] elif not model.startswith("azure/"): model = "azure/" + model - return super()._supports_reasoning_effort_level(model, level) + + if super()._supports_reasoning_effort_level(model, level): + return True + + # Fallback: registry lookup fails for Azure deployment names + # (e.g. "gpt-5.1-DataZoneStandard") that are not in + # model_prices_and_context_window.json. Use string matching as a + # safe fallback, consistent with the behaviour in litellm 1.81.x. + model_name = model.split("/")[-1] + if level == "none": + return model_name.startswith("gpt-5.1") or model_name.startswith( + "gpt-5.2" + ) + return False @classmethod def is_model_gpt_5_model(cls, model: str) -> bool: