From 4b88a813110ba4d844c5f86a6fd3853e44371730 Mon Sep 17 00:00:00 2001 From: Mrunmayee Daware <165297479+Mrun25@users.noreply.github.com> Date: Mon, 12 Oct 2026 10:48:13 +0530 Subject: [PATCH 1/2] fix(openai): match gpt-5 reasoning-series markers against the normalized model name --- litellm/llms/openai/chat/gpt_5_transformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/openai/chat/gpt_5_transformation.py b/litellm/llms/openai/chat/gpt_5_transformation.py index 94c5c5d016d..b6217316662 100644 --- a/litellm/llms/openai/chat/gpt_5_transformation.py +++ b/litellm/llms/openai/chat/gpt_5_transformation.py @@ -71,7 +71,7 @@ GPT_REASONING_SERIES_MARKERS: Final = ("gpt-5", "gpt-6") def is_gpt_reasoning_series_name(model: str) -> bool: normalized: Final = model.split("/")[-1] - return any(marker in model for marker in GPT_REASONING_SERIES_MARKERS) and "gpt-5-chat" not in normalized + return any(marker in normalized for marker in GPT_REASONING_SERIES_MARKERS) and "gpt-5-chat" not in normalized class OpenAIGPT5Config(OpenAIGPTConfig): From 89ffe4bb2863706639c6a2f792bfb6aa24cdf27c Mon Sep 17 00:00:00 2001 From: Mrunmayee Daware <165297479+Mrun25@users.noreply.github.com> Date: Mon, 12 Oct 2026 10:49:45 +0530 Subject: [PATCH 2/2] test(openai): regression cases for routed non-reasoning models --- .../llms/openai/test_is_model_gpt_5_model.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/llms/openai/test_is_model_gpt_5_model.py b/tests/unit/llms/openai/test_is_model_gpt_5_model.py index f6fef92fc6a..98078b63074 100644 --- a/tests/unit/llms/openai/test_is_model_gpt_5_model.py +++ b/tests/unit/llms/openai/test_is_model_gpt_5_model.py @@ -73,6 +73,17 @@ GPT5_MODELS = [ ] # Models that must NOT be classified as GPT-5 (regular chat path) +# Non-reasoning models routed under groups/gateways whose PATH contains a gpt-5/gpt-6 +# marker. Regression: the marker check must run against the normalized model name +# (after the last "/"), not the raw route, or these get reasoning transformations +# (temperature=1 enforcement, max_completion_tokens swap) and 400 from upstream. +ROUTED_NON_REASONING_MODELS = [ + "gpt-5-gateway/claude-3-5-sonnet", + "gpt-5-team/llama-3.3-70b", + "gpt-6-proxy/mistral-large", + "my-gpt-5-org/gemini-2.0-flash", +] + NON_GPT5_MODELS = [ "gpt-5-chat", # gpt-5-chat family — regular chat path "gpt-5-chat-latest", # gpt-5-chat family with alias suffix @@ -109,6 +120,12 @@ class TestOpenAIGPT5ConfigIsModelGpt5Model: model ), f"Expected '{model}' NOT to be classified as a GPT-5 model" + @pytest.mark.parametrize("model", ROUTED_NON_REASONING_MODELS) + def test_routed_non_reasoning_models_are_not_classified_as_gpt5(self, model: str): + assert not OpenAIGPT5Config.is_model_gpt_5_model( + model + ), f"Route prefix in '{model}' must not trigger the GPT-5 reasoning path" + def test_versioned_chat_models_are_not_excluded_by_prefix(self): """Core regression guard: gpt-5-chat prefix must not match versioned models.""" versioned_chat_models = ["gpt-5.1-chat", "gpt-5.2-chat", "gpt-5.3-chat"]