From 5bf45246182d78232efc7d4e79c7a52d7ee5f95c Mon Sep 17 00:00:00 2001 From: Raul Juarez <9117159+rauljua@users.noreply.github.com> Date: Wed, 28 Oct 2026 17:34:52 -0700 Subject: [PATCH] fix(chatgpt): omit temperature from subscription requests (#6498) Co-authored-by: Raul <9117159+raultcj@users.noreply.github.com> --- src/llm_core.py | 5 +++-- tests/test_llm_core_temperature_reasoning.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/llm_core.py b/src/llm_core.py index c56346936..bde17741e 100644 --- a/src/llm_core.py +++ b/src/llm_core.py @@ -1556,8 +1556,9 @@ def _build_chatgpt_responses_payload( "stream": stream, "store": False, } - if not _restricts_temperature(model): - payload["temperature"] = temperature + # ChatGPT plan Responses requests reject temperature for every model. + # The common caller still passes its preset value, but this provider must + # omit the field even for model names outside the known reasoning families. # ChatGPT Subscription Codex API does not support max_output_tokens — # passing it returns HTTP 400 "Unsupported parameter: max_output_tokens". # Do not include it in the payload. diff --git a/tests/test_llm_core_temperature_reasoning.py b/tests/test_llm_core_temperature_reasoning.py index 9c457e324..34d4500b0 100644 --- a/tests/test_llm_core_temperature_reasoning.py +++ b/tests/test_llm_core_temperature_reasoning.py @@ -156,3 +156,18 @@ def test_chatgpt_subscription_payload_omits_max_output_tokens_when_zero(): ) assert "max_output_tokens" not in payload + + +@pytest.mark.parametrize("model", ["gpt-5.6-luna", "gpt-6-luna", "gpt-6-sol", "gpt-6.1-sol", "gpt-4.1"]) +def test_chatgpt_subscription_payload_omits_temperature_for_every_model(model): + payload = llm_core._build_chatgpt_responses_payload( + model, + [{"role": "user", "content": "Say OK"}], + temperature=0.2, + max_tokens=37, + stream=True, + ) + + assert "temperature" not in payload + assert payload["stream"] is True + assert payload["store"] is False