Repository navigation
fix(providers/openai): correct reasoning detection for deployment aliases and third-party model IDs - #88
Merged
Conversation
…ases and third-party model IDs A Chat Completions model ID that carried a reasoning marker together with gpt-3, gpt-4 or chatgpt- was treated as a non-reasoning model, so an Azure OpenAI deployment named chatgpt-5 or gpt-4o-to-gpt-5 was sent max_tokens. The non-reasoning pattern now applies to the Responses API only. The oss and computer-use markers also matched third-party IDs such as ByteDance-Seed/Seed-OSS-36B-Instruct and google/gemini-2.5-computer-use-preview-10-2025. They now match gpt-oss, and computer-use only at the start of the ID or after a slash.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
ethanndickson
added a commit
to coder/coder
that referenced
this pull request
Dec 2, 2026
…names coder/fantasy#88 lets a reasoning marker win over gpt-3, gpt-4 and chatgpt- on Chat Completions, so Azure OpenAI deployments named like chatgpt-5 get max_completion_tokens. It also narrows the oss and computer-use markers to gpt-oss and a leading computer-use, so they no longer match third-party model IDs.
ethanndickson
added a commit
to coder/coder
that referenced
this pull request
Dec 2, 2026
) Closes #31714 Closes WI-31 Azure OpenAI reasoning models reject `max_tokens`: ``` Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. ``` We pick between `max_tokens` and `max_completion_tokens` from the model name, and that check only knew names up to `gpt-5`, so a `gpt-6-luna` deployment failed on default settings. To fix, the fantasy bump (coder/fantasy#86, coder/fantasy#87 and coder/fantasy#88) extends the check to `gpt-6` through `gpt-9`. That bump is a full sync with upstream, so it also brings the other chatd changes listed there, which is why a few test expectations move here. On Azure that name is the deployment name though, which doesn't have to say what model it serves. So the model form now also shows the existing Reasoning Model setting for Azure models, and we obey it. With it on, we send `max_completion_tokens` and drop `temperature` and `top_p`, whatever the deployment is called. I confirmed against a real Azure `gpt-5.4` deployment that it rejects `max_tokens` and accepts `max_completion_tokens`, but that test resource has since gone, so I haven't run this exact change against Azure. This only fixes the `max_tokens` error. Going by [Microsoft's docs](https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/reasoning), I think GPT-6 chats on Azure will then hit a second error, as on Chat Completions those models only accept tools with the reasoning effort set to `none`, or not at all. The OpenAI and Bedrock providers use the Responses API, so they aren't affected. I can't reproduce that for the same reason, so it's being tracked separately at [CODAGT-1655](https://linear.app/codercom/issue/CODAGT-1655).
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.
Relates to coder/coder#31714
Two problems with the name check on Chat Completions, which I found whilst comparing it against what we had before the sync in #86.
A name with a reasoning marker is still treated as a non-reasoning model if it also contains
gpt-3,gpt-4orchatgpt-. No real model ID I could find matches both patterns, so this only affects made-up names, i.e. Azure deployments. A deployment namedchatgpt-5orgpt-4o-to-gpt-5getsmax_tokens, where before the sync it gotmax_completion_tokens. To fix, Chat Completions now just checks the reasoning pattern. The Responses path is unchanged.The
ossandcomputer-usemarkers also match third-party models, e.g.ByteDance-Seed/Seed-OSS-36B-Instructandgoogle/gemini-2.5-computer-use-preview-10-2025, which then getmax_completion_tokensand losetemperatureandtop_pon an OpenAI-compatible provider. Soossbecomesgpt-oss, andcomputer-usehas to start the name or follow a/.