diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index 6c954d00e64..60c1d9f8435 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -120,7 +120,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(): """