Fix: Azure OpenAI Responses API incorrectly blocking temperature parameter for GPT-5 #16206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Azure OpenAI Responses API was incorrectly blocking the
temperatureparameter for GPT-5 models with the following error:However, according to both OpenAI documentation and Azure AI documentation, the Responses API does support the
temperatureparameter for non-O-series models.Source issue: fix OpenHands/software-agent-sdk#986
Root Cause
The bug occurred because LiteLLM was using
supports_reasoning(model)as a proxy to detect O-series models (o1, o3, o4). This caused GPT-5 to be incorrectly classified:litellm/utils.py(line 7400): Usedsupports_reasoning(model)to determine if a model should useAzureOpenAIOSeriesResponsesAPIConfiglitellm/llms/azure/responses/o_series_transformation.py(line 93): Theis_o_series_model()method also usedsupports_reasoning(model)"supports_reasoning": trueinmodel_prices_and_context_window.json, but GPT-5 is NOT an O-series modelAzureOpenAIOSeriesResponsesAPIConfigwhich blockstemperature, instead ofAzureOpenAIResponsesAPIConfigwhich allows itThe Key Distinction
Solution
Updated the O-series detection logic to check for specific model name patterns instead of using the
supports_reasoningflag:Changes Made
litellm/llms/azure/responses/o_series_transformation.py:is_o_series_model()to check for explicit O-series model names:"o1","o3","o4", or"o_series"in model namesupports_reasoning()supports_reasoningimportlitellm/utils.py:ProviderConfigManager.get_provider_responses_api_config()to use explicit O-series model name checkssupports_reasoning()for determining config selectiontests/test_litellm/llms/azure/response/test_azure_transformation.py:test_o_series_model_detection()to include GPT-5 test casestest_provider_config_manager_o_series_selection()to verify:AzureOpenAIResponsesAPIConfig(not O-series config)temperatureparameterAzureOpenAIOSeriesResponsesAPIConfigVerification
Before Fix
After Fix
Test Results
All 15 tests in
test_azure_transformation.pypass ✅Impact
temperatureparameter on Azure Responses APIFiles Changed
litellm/llms/azure/responses/o_series_transformation.py(+7, -6)litellm/utils.py(+4, -2)tests/test_litellm/llms/azure/response/test_azure_transformation.py(+38, -0)Total: 3 files changed, 48 insertions(+), 9 deletions(-)
@xingyaoww can click here to continue refining the PR