From 99d54ff085c125d22cbb29ab3a6aaedf96fe0e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fiere?= <220731063+ClemDNL@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:58:55 +0100 Subject: [PATCH] fix(azure): strip the gpt5_series/ selector from Responses deployment names A deployment configured as azure/gpt5_series/ sent gpt5_series/ as the model of Azure Responses requests, which Azure rejects because no such deployment exists. Chat completions already strip the selector, so Responses now does the same. --- litellm/llms/azure/responses/transformation.py | 3 ++- .../azure/response/test_azure_transformation.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index 2b757bb10d9..c458277ab56 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -110,7 +110,8 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): return BaseAzureLLM.base_validate_azure_environment(headers=headers, litellm_params=litellm_params) def get_stripped_model_name(self, model: str) -> str: - return model.replace("responses/", "").replace("o_series/", "").replace("azure_ai/", "") + stripped: Final = model.replace("responses/", "").replace("o_series/", "").replace("azure_ai/", "") + return stripped.removeprefix(AzureOpenAIGPT5Config.GPT5_SERIES_ROUTE) def _handle_reasoning_item(self, item: dict[str, Any]) -> Mapping[str, object]: """ diff --git a/tests/unit/llms/azure/response/test_azure_transformation.py b/tests/unit/llms/azure/response/test_azure_transformation.py index 29006901877..540e8a907a5 100644 --- a/tests/unit/llms/azure/response/test_azure_transformation.py +++ b/tests/unit/llms/azure/response/test_azure_transformation.py @@ -1297,6 +1297,23 @@ def test_azure_responses_sends_the_deployment_name_when_azure_ai_prefix_survives assert request["model"] == "gpt-5.4-nano" +def test_gpt5_series_selector_is_not_sent_as_part_of_the_deployment_name(respx_mock: respx.MockRouter) -> None: + route: Final = respx_mock.post(host="example-resource.openai.azure.com").mock( + return_value=httpx.Response(200, json=_COMPLETED_RESPONSE) + ) + + response: Final = litellm.responses( + model="azure/gpt5_series/my-gpt-5-deployment", + input="hi", + api_base=_AZURE_RESOURCE, + api_key="azure-test-key", + ) + + assert response.output[0].content[0].text == "Done." + assert route.call_count == 1 + assert json.loads(route.calls[0].request.content)["model"] == "my-gpt-5-deployment" + + @pytest.mark.asyncio async def test_azure_responses_api_status_error(): """