Skip to content

fix(llm): omit temperature for gpt-6 models - #852

Merged
akitaonrails merged 2 commits into
akitaonrails:mainfrom
everton-dgn:fix/gpt6-default-temperature
Sep 23, 2026
Merged

akitaonrails merged 2 commits into
akitaonrails:mainfrom
everton-dgn:fix/gpt6-default-temperature

Conversation

@everton-dgn

@everton-dgn everton-dgn commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The codex, openai-oauth, copilot and openai providers now leave temperature out of gpt-6-* requests. Codex answers a GPT-6 request that carries temperature with 400 Unsupported parameter: temperature. Consolidation, lint and bootstrap all set it, so they failed on a provider or fallback configured with gpt-6-luna, gpt-6-sol or gpt-6-astra.

  • openai-oauth, codex and copilot: model_uses_default_temperature now matches gpt-6 as well as gpt-5 and o. The function had two identical copies, in openai_oauth.rs and copilot.rs; copilot.rs now imports the one from openai_oauth.rs.
  • openai: model_requires_max_completion_tokens now matches gpt-6. The same check decides when temperature is dropped and whether the local 16,384-token output cap applies, so GPT-6 requests now send max_completion_tokens, no temperature, and the caller's token limit unchanged, same as gpt-5.

Why

Closes #851.

Test plan

  • cargo fmt --all -- --check
  • git diff --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings
  • cargo test --workspace --all-targets: 3,524 passed, 0 failed, 14 ignored on macOS arm64
  • scripts/check-changelog-sections.sh and scripts/check-changelog-frozen.sh upstream/main
  • cargo build --locked --release --bin ai-memory
  • Manual test with real Codex credentials: ai-memory llm-test --provider codex --model gpt-6-luna returned OK, and the --structured variant returned valid JSON. The 2.4.0 release binary still returns the 400 for the same command.

Four new unit tests build a request with temperature: Some(0.2) for a GPT-6 model and check that the field is gone: codex_request_omits_gpt6_temperature, chat_request_omits_gpt6_temperature and responses_request_omits_gpt6_temperature (the two Copilot endpoints), and build_request_omits_temperature_for_gpt6. The last one asks for 64,000 tokens and checks that max_completion_tokens keeps that value.

I couldn't run the openai provider against the live API because my OpenAI account has no active billing. That part is covered only by the unit test.

Commit attribution

  • I verified the name and email on every commit in this PR and corrected
    any unintended identity before requesting merge. See
    commit attribution guidance.

Release impact

  • Patch — bug fix, no new surface
  • Minor — additive: new flag/subcommand/MCP tool/config key,
    new agent harness or provider
  • Major (breaking) — on-disk format, removed/renamed surface,
    breaking MCP schema change — called out in "What changed" above

CHANGELOG (merge gate)

  • I added a CHANGELOG.md [Unreleased] entry.
  • No default changed.

Notes for reviewers

The openai provider keeps its own, narrower check (o1/o3/o4 instead of any o prefix). I left it alone because widening it would change what the official API receives for other models, which is outside this fix.

opencode sends only the exact id gpt-5.6-luna to the Responses endpoint. I didn't extend that to GPT-6 because I couldn't confirm which route OpenCode Go uses for it.

Codex rejects temperature on gpt-6-* with a 400, so providers and
fallbacks configured with gpt-6-luna failed on every call.

Closes akitaonrails#851
Give GPT-6 the same reasoning-model handling as gpt-5 on the official
openai provider: omit temperature, send max_completion_tokens and skip
the local 16,384-token cap.

Also drop the duplicate model_uses_default_temperature from copilot and
import the identical one from openai_oauth.
@akitaonrails
akitaonrails merged commit f7ec2ed into akitaonrails:main Sep 23, 2026
20 checks passed
@everton-dgn
everton-dgn deleted the fix/gpt6-default-temperature branch October 1, 2026 23:05
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.

codex provider sends temperature to gpt-6 models and gets a 400

3 participants