fix(openai): stop removing temperature/top_p for gpt-5.1 and gpt-5.2 - #2122
Merged
Archit-Kumar-16 merged 1 commit intoAug 12, 2026
Merged
Conversation
These models support temperature, top_p and logprobs when reasoning effort is none, which is their default. Unconditional removeParams silently changes sampling behavior for default-effort callers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ColinSidberry
marked this pull request as ready for review
August 11, 2026 19:56
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ad2cdd1. Configure here.
Archit-Kumar-16
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

What
Removes
temperatureandtop_pfromremoveParamsfor gpt-5.1 and gpt-5.2. Keepsnandmax_tokensremoved (see "What this PR deliberately does not change").Why
The
removeParamslist on these two files appears to have been carried forward fromgpt-5.yaml, where it was correct: the original gpt-5 rejects any non-defaulttemperature/top_punconditionally. That contract changed with gpt-5.1.OpenAI's current GPT-5.2 guide, "GPT-5.2 parameter compatibility" states verbatim:
And
noneis the default reasoning effort for both models, per their model pages (gpt-5.1: "Reasoning.effort supports: none (default), low, medium, and high"; gpt-5.2: "none (default), low, medium, high and xhigh") — consistent with these files' ownparamsentry (reasoning_effort,defaultValue: none).So for the default-configuration request — the common case — OpenAI accepts
temperatureandtop_p, and the gateway strips them anyway.Impact of the current behavior
The strip is silent: a caller sending
temperature: 0to gpt-5.2 gets HTTP 200 and is actually served the model defaults (temperature: 1, and gpt-5.2's internaltop_pdefault of0.98— see this OpenAI forum thread). Nothing in the response indicates the parameter was discarded except the echoed values.We hit this in production: a pipeline that pinned
temperature: 0for deterministic output was migrated from a Claude target (where the gateway forwards temperature untouched) toopenai/gpt-5.2, and began sampling at temperature 1 with no error anywhere — the regression surfaced as nondeterministic output quality and took an incident investigation to trace back to the registry entry.Note that OpenAI itself never silently ignores these params — unsupported combinations get an explicit 400 (
"Unsupported value: 'temperature' does not support 0.5 with this model."). After this change, a caller that combinestemperature/top_pwithreasoning_effort≥lowwill receive that 400 instead of a silent drop. We'd argue that's the better contract: it matches the raw OpenAI API, and it's an actionable client error rather than an invisible behavior change. (This is the same fix direction LiteLLM took for the equivalent issue — see BerriAI/litellm#21911 / #27351, where sampling params are now gated on per-modelsupports_none_reasoning_effortflags rather than dropped across the board.)What this PR deliberately does not change
max_tokensstays removed — gpt-5.x still rejects it; callers must usemax_completion_tokens/max_output_tokens.nstays removed — we found no official OpenAI statement that gpt-5.x acceptsn, so we left it alone.medium, so removing the strip there would 400 default-effort callers who send temperature. The removal is still protective for those models.gpt-5.2-chat-latest(if/where present) should keep rejecting/removing temperature — OpenAI returns 400 for non-1 temperature on that variant regardless of effort.Sources
Note
Medium Risk
Changes request parameter forwarding for production gpt-5.1/5.2 traffic. Callers combining temperature/top_p with non-default reasoning effort may start receiving OpenAI 400s instead of silent param drops.
Overview
Stops silently stripping
temperatureandtop_pfrom requests to gpt-5.1 and gpt-5.2. Those params are now forwarded to OpenAI, matching the models' documented support whenreasoning_effortisnone(the default).nandmax_tokensremain inremoveParams. Callers that sendtemperature/top_pwith non-nonereasoning effort will now get OpenAI's explicit 400 instead of a silent drop.Reviewed by Cursor Bugbot for commit ad2cdd1. Bugbot is set up for automated code reviews on this repo. Configure here.