Skip to content

Bug: Azure GPT-5 fails due to hardcoded temperature in responses_options.py #986

Closed
BerriAI/litellm
#16246

Description

@Shimada666

Environment

  • Model: azure/gpt-5
  • SDK Version: latest (main branch)
  • Error:
litellm.exceptions.UnsupportedParamsError: LlmProviders.AZURE does not support 
parameters: {'temperature': 1.0}, for model=gpt-5

Reproduction Steps

from openhands.sdk import LLM, Conversation
from pydantic import SecretStr

llm = LLM(
    model="azure/gpt-5",
    api_key=SecretStr("YOUR_KEY"),
    base_url="https://xxx.cognitiveservices.azure.com",
    api_version="2025-04-01-preview",
    drop_params=True,  # This doesn't help
    usage_id="agent",
)

conversation = Conversation(agent=agent, workspace=cwd)
conversation.send_message("Hello")
conversation.run()  # Fails with UnsupportedParamsError

Root Cause

GPT-5 uses the Responses API (`model_features.py:130`), but `responses_options.py:25` hardcodes `temperature=1.0`:

```python

responses_options.py:25

out["temperature"] = 1.0 # ❌ Hardcoded
```

Azure GPT-5, as a reasoning model, doesn't support the temperature parameter (it uses `reasoning_effort` instead).

Setting `drop_params=True` doesn't help because it only drops default parameters, not explicitly set ones.

Proposed Solution

Following the same pattern as `chat_options.py`, skip temperature for reasoning models:

```python

responses_options.py

from openhands.sdk.llm.utils.model_features import get_features

def select_responses_options(...):
# ...

# Enforce sampling/tool behavior for Responses path
# Reasoning models (e.g., GPT-5, o1) don't support temperature
if not get_features(llm.model).supports_reasoning_effort:
    out["temperature"] = 1.0
out["tool_choice"] = "auto"

# ...

```

Testing

After applying this fix, Azure GPT-5 works correctly.

Activity

  1. Shimada666 commented on Nov 1, 2025

    @Shimada666
    ContributorAuthor
    ╭───────────────────────────────────────────── Message to User ─────────────────────────────────────────────╮
    │                                                                                                           │
    │ Write 3 facts about the current project into FACTS.txt.                                                   │
    │                                                                                                           │
    ╰───────────────────────── Tokens: ↑ input 0 • cache hit N/A • ↓ output 0 • $ 0.00 ─────────────────────────╯
    
    Traceback (most recent call last):
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py", line 269, in run
        self.agent.step(self, on_event=self._on_event)
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/agent/agent.py", line 186, in step
        raise e
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/agent/agent.py", line 145, in step
        llm_response = self.llm.responses(
                       ^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/llm/llm.py", line 615, in responses
        resp: ResponsesAPIResponse = _one_attempt()
                                     ^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
        return copy(f, *args, **kw)
               ^^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
        do = self.iter(retry_state=retry_state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
        result = action(retry_state)
                 ^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
        self._add_action_func(lambda rs: rs.outcome.result())
                                         ^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 449, in result
        return self.__get_result()
               ^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
        raise self._exception
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
        result = fn(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/llm/llm.py", line 591, in _one_attempt
        ret = litellm_responses(
              ^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1365, in wrapper
        raise e
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/utils.py", line 1238, in wrapper
        result = original_function(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/responses/main.py", line 665, in responses
        raise litellm.exception_type(
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/responses/main.py", line 615, in responses
        ResponsesAPIRequestUtils.get_optional_params_responses_api(
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/responses/utils.py", line 85, in get_optional_params_responses_api
        ResponsesAPIRequestUtils._check_valid_arg(
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/responses/utils.py", line 52, in _check_valid_arg
        raise litellm.UnsupportedParamsError(
    litellm.exceptions.UnsupportedParamsError: litellm.UnsupportedParamsError: LlmProviders.AZURE does not support parameters: {'temperature': 1.0}, for model=gpt-5. To drop these, set `litellm.drop_params=True` or for proxy:
    
    `litellm_settings:
     drop_params: true`
    
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/examples/01_standalone_sdk/01_hello_world.py", line 26, in <module>
        conversation.run()
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py", line 288, in run
        raise ConversationRunError(self._state.id, e) from e
    openhands.sdk.conversation.exceptions.ConversationRunError: Conversation run failed for id=5d7f241e-9ed0-47a2-8fb4-2ad6f04c9fc6: litellm.UnsupportedParamsError: LlmProviders.AZURE does not support parameters: {'temperature': 1.0}, for model=gpt-5. To drop these, set `litellm.drop_params=True` or for proxy:
    
    `litellm_settings:
     drop_params: true`
    
    /Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/llms/custom_httpx/async_client_cleanup.py:66: DeprecationWarning: There is no current event loop
      loop = asyncio.get_event_loop()
    
  2. added a commit that references this issue on Nov 2, 2025
    d25d9e5
  3. xingyaoww commented on Nov 2, 2025

    @xingyaoww
    Contributor

    @OpenHands please fix this issue by stop hard code temperature for reasoning models

  4. openhands-ai commented on Nov 2, 2025

    @openhands-ai

    Uh oh! There was an unexpected error starting the job :(

  5. xingyaoww commented on Nov 2, 2025

    @xingyaoww
    Contributor

    @OpenHands please fix this issue by stop hard code temperature for reasoning models

  6. openhands-ai commented on Nov 2, 2025

    @openhands-ai

    I'm on it! xingyaoww can track my progress at all-hands.dev

  7. added a commit that references this issue on Nov 2, 2025
    a76e11e
  8. openhands-ai commented on Nov 2, 2025

    @openhands-ai

    ✅ Successfully Fixed Issue #986

    I've successfully resolved the hardcoded temperature issue for reasoning models in the Responses API. Here's what was accomplished:

    Changes Made

    1. Fixed responses_options.py (openhands-sdk/openhands/sdk/llm/options/responses_options.py)

    • Added import for get_features from model_features
    • Modified select_responses_options() to conditionally handle temperature:
      • For reasoning models (GPT-5, o1, o3): Temperature is explicitly removed
      • For non-reasoning models: Temperature is set to 1.0 (preserving existing behavior)
    • Follows the same pattern as chat_options.py

    2. Updated Tests (tests/sdk/llm/test_responses_parsing_and_kwargs.py)

    • Updated existing test to verify temperature is NOT set for reasoning models (gpt-5-mini)
    • Added new test to verify temperature IS set for non-reasoning models (codex-mini-latest)
    • Ensures comprehensive coverage for both model types

    Verification

    ✅ All 337 tests in tests/sdk/llm/ pass
    ✅ Pre-commit hooks pass (ruff, pyright, pycodestyle)
    ✅ Changes are minimal and focused on the issue

    Pull Request Created

    PR #992: #992

    The fix ensures that Azure GPT-5 and other reasoning models (o1, o3) no longer fail with UnsupportedParamsError when using the Responses API, while preserving the existing behavior for non-reasoning models.

    View full conversation

  9. xingyaoww commented on Nov 2, 2025

    @xingyaoww
    Contributor

    I think openai's responses API does support temperature: https://platform.openai.com/docs/api-reference/responses/create#responses_create-temperature

    Also it seems azure does support it too: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference-preview-latest#request-body-14

    Can you try new api version to api-version=preview to check if that works

  10. enyst commented on Nov 2, 2025

    @enyst
    Member

    Yes, I think so. 🤔 My recollection is that there was a model which ONLY accepted temperature = 1, I believe that’s why we hardcoded it. I have the agent try a few, to see if we get one to fail the PR. 🤔

  11. enyst commented on Nov 2, 2025

    @enyst
    Member

    The agent posted its tests in the PR, from here:
    #992 (comment)

    => With and without proxy, for 4 OpenAI models, it looks like temperature=1 or no temperature specified work, while other values in range 0..2 nope. 😅

    I think there was somewhere in OpenAI docs that only "1" works, but I can't find it for the life of me. 😂

    1 is also the default.

    Can you try new api version to api-version=preview to check if that works

    I'd love to know the result of this.

  12. Shimada666 commented on Nov 3, 2025

    @Shimada666
    ContributorAuthor

    I think openai's responses API does support temperature: https://platform.openai.com/docs/api-reference/responses/create#responses_create-temperature

    Also it seems azure does support it too: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference-preview-latest#request-body-14

    Can you try new api version to api-version=preview to check if that works

    Same Problem😥 @enyst @xingyaoww
    I’m not sure if LiteLLM has compatibility issues with Azure support.
    By the way, Claude on Amazon (via boto3) works well.

    import os
    
    from pydantic import SecretStr
    
    from openhands.sdk import LLM, Conversation
    from openhands.tools.preset.default import get_default_agent
    
    # Configure LLM and agent for Azure OpenAI GPT-5
    model = "azure/gpt-5"
    
    llm = LLM(
        model=model,
        api_key=SecretStr("xxxxxxx"),
        base_url="https://xxxxx.azure.com",
        api_version="preview",
        usage_id="agent",
    )
    agent = get_default_agent(llm=llm, cli_mode=True)
    
    
    litellm.exceptions.UnsupportedParamsError: litellm.UnsupportedParamsError: LlmProviders.AZURE does not support parameters: {'temperature': 1.0}, for model=gpt-5. To drop these, set `litellm.drop_params=True` or for proxy:
    
    `litellm_settings:
     drop_params: true`
    
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/examples/01_standalone_sdk/01_hello_world.py", line 26, in <module>
        conversation.run()
      File "/Users/zhengmingzhang/PycharmProjects/software-agent-sdk/openhands-sdk/openhands/sdk/conversation/impl/local_conversation.py", line 288, in run
        raise ConversationRunError(self._state.id, e) from e
    openhands.sdk.conversation.exceptions.ConversationRunError: Conversation run failed for id=4a6bb668-0ef2-46b3-adcf-ddbd975a5411: litellm.UnsupportedParamsError: LlmProviders.AZURE does not support parameters: {'temperature': 1.0}, for model=gpt-5. To drop these, set `litellm.drop_params=True` or for proxy:
    
    `litellm_settings:
     drop_params: true`
    
    /Users/zhengmingzhang/PycharmProjects/software-agent-sdk/.venv/lib/python3.12/site-packages/litellm/llms/custom_httpx/async_client_cleanup.py:66: DeprecationWarning: There is no current event loop
      loop = asyncio.get_event_loop()
    (software-agent-sdk) ➜  software-agent-sdk git:(main) ✗ 
    
  13. xingyaoww commented on Nov 3, 2025

    @xingyaoww
    Contributor

    I had OpenHands look into the litellm repo, and it seems the root issue comes from litellm. Will be fixed here:
    BerriAI/litellm#16206

  14. all-hands-bot commented on Dec 29, 2025

    @all-hands-bot
    Collaborator

    This issue is stale because it has been open for 40 days with no activity. Remove the stale label or leave a comment, otherwise it will be closed in 10 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions