Skip to content

Omit temperature for GPT-6 Astra (every request 400s today) - #154

Merged
adambalogh merged 1 commit into
mainfrom
claude/frustration-break-3yd5hx
Sep 4, 2026
Merged

Omit temperature for GPT-6 Astra (every request 400s today)#154
adambalogh merged 1 commit into
mainfrom
claude/frustration-break-3yd5hx

Conversation

@adambalogh

Copy link
Copy Markdown
Contributor

The bug

Every GPT-6 Astra chat fails:

Error code: 400 - {'error': {'message': "Unsupported parameter: 'temperature' is not supported with this model.", 'type': 'invalid_request_error', 'param': 'temperature', 'code': None}}

Astra rejects temperature outright — the API 400s if the field is present at all. Clients always send one (chat-app pins temperature: 0.0, and it is part of the signed request hash), so the model has been unusable since it was registered in #153.

Why it slipped through

The gpt-5.6 family has the same restriction and never showed it, because langchain-openai strips temperature itself — but only for model names starting with gpt-5:

>>> ChatOpenAI(model="gpt-5.6-sol", temperature=0.0)._default_params   # no temperature
>>> ChatOpenAI(model="gpt-6-astra", temperature=0.0)._default_params   # temperature: 0.0  ← 400

gpt-6-astra misses that workaround, so the value went out on the wire.

The fix

supports_temperature=False already existed in ModelConfig (for Anthropic's Opus 4.7+ and Fable 5) but was only honored inside the Anthropic branch of get_chat_model_cached. Moved the check up next to force_temperature so the effective temperature is None for any flagged model regardless of provider — every langchain-<provider> package treats None as "omit the field" rather than "send null" — and flagged Astra in the registry.

This keeps the restriction in the registry rather than depending on langchain's model-name heuristics, and covers both request paths (Chat Completions, and the Responses API used when tools are bound).

Tests

tee_gateway/test/test_tee_core.py::TestTemperatureOmission:

  • Astra omits temperature on the Chat Completions path and on the Responses API path
  • an Anthropic flagged model omits it
  • an unflagged model (gpt-4.1) still sends 0.0
  • force_temperature (o4-mini) is still applied
  • registry-wide sweep: nothing flagged supports_temperature=False can be constructed with a temperature

make lint and the CI test command pass locally (403 passed, 6 skipped, 117 subtests).

Notes

  • No client change needed — the gateway is the single choke point for both chat-app's direct OHTTP path and chat-api's SDK path, both of which always send a temperature.
  • Registry-only change plus one backend line; no dependency or lockfile change, so nothing here alters PCR inputs beyond the source itself.

🤖 Generated with Claude Code

https://claude.ai/code/session_019GiCnGpGxLEusqVUS6zUHw


Generated by Claude Code

GPT-6 Astra rejects `temperature` outright: OpenAI returns

    400 Unsupported parameter: 'temperature' is not supported with this model

when the field is present at all. Clients always send one — chat-app pins
0.0 and it is part of the signed request hash — so every Astra chat has
been failing since the model was registered.

The gpt-5.6 family has the same restriction but never showed it, because
langchain-openai strips `temperature` itself for model names starting
with "gpt-5" (and only those). "gpt-6-astra" misses that workaround, so
the value went out on the wire.

Handle it in the registry instead of relying on langchain internals:
`supports_temperature=False` already existed for Anthropic's Opus 4.7+
and Fable 5, but was only honored in the Anthropic branch of
get_chat_model_cached. Move the check up next to `force_temperature` so
the effective temperature is None for any flagged model, whatever the
provider, and every langchain-<provider> package then omits the field
from the outgoing payload.

Tests cover the Chat Completions and Responses API paths for Astra, an
Anthropic model, an unflagged model (value preserved), `force_temperature`
(still applied), and a registry-wide sweep asserting nothing flagged
`supports_temperature=False` can be built with a temperature.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019GiCnGpGxLEusqVUS6zUHw
@adambalogh
adambalogh marked this pull request as ready for review September 4, 2026 19:18
@adambalogh
adambalogh merged commit 37b27e6 into main Sep 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants