Repository navigation
fix(providers/openai): stop treating -chat names as non-reasoning models - #87
Conversation
Every model with -chat in its ID that was not a reasoning model has been shut down: gpt-5-chat-latest on OpenAI, and gpt-5-chat on Azure, where deployments were upgraded in place to gpt-chat-latest, which rejects max_tokens. Treating such names as non-reasoning on Chat Completions sends max_tokens to Azure deployments named like gpt-5.1-chat.
|
@codex review |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12097724db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
chat-latest, deployed on Azure as gpt-chat-latest, is the replacement for the retired -chat models and rejects max_tokens, but no rule recognised the name on Chat Completions.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd94339bb6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
|
@codex review re: Suppress reasoning effort for gpt-chat-latest |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. 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". |
coder/fantasy#87 stops treating model IDs that contain -chat as non-reasoning models and recognizes chat-latest, so Azure OpenAI deployments named like gpt-5.1-chat or gpt-chat-latest get max_completion_tokens.
) 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).
Relates to coder/coder#31714
The sync in #86 brought in upstream's rule that a model name containing
-chatisn't a reasoning model. Before charmbracelet#386 only the Responses path excludedgpt-5-chat, and the wider rule came out of a refactor there that merged the two checks.I don't think that rule protects anything anymore. OpenAI has shut down
gpt-5-chat-latestand the later-chat-latestsnapshots, and Azure has retired everygpt-5*-chatversion in favour ofgpt-chat-latest, which is a reasoning model. What it does do is sendmax_tokensto an Azure deployment with-chatin its name, e.g.gpt-5.1-chat. That worked before the sync, and Azure's reasoning models rejectmax_tokens:To fix, we'll just drop
-chatfrom the pattern. Whilst here,chat-latestjoins the names we do recognise, as otherwise a deployment namedgpt-chat-latestmatches nothing and still getsmax_tokens. I'll send the same change upstream.