@ai-sdk/azure defaults to completions api instead of responses #6567

Closed
opened 2026-02-16 18:04:36 -05:00 by yindo · 4 comments
Owner

Originally created by @OmarMcAdam on GitHub (Jan 17, 2026).

Originally assigned to: @thdxr on GitHub.

Description

Using gpt-5.2-codex via azure gives error:

The chatCompletion operation does not work with the specified model, gpt-5.2-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.

model gpt-5.2 works fine

used opencode, to fetch opencode source, add debug, identify issue and fix

issue is
`@ai-sdk/azure does support the Responses API. The issue is in opencode’s routing: your custom azure-openai provider goes through the generic path, which defaults to chat-completions unless useCompletionUrls is set. That’s why it’s hitting /chat/completions even though the model supports responses'

Plugins

nada

OpenCode version

latest - dev branch

Steps to reproduce

  1. use custom provider via @ai-sdk/azure
  2. set model to gpt-5.2-codex
  3. launch opencode
    💀
The chatCompletion operation does not work with the specified model, gpt-5.2-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.

Screenshot and/or share link

No response

Operating System

max

Terminal

🤷‍♂️

Originally created by @OmarMcAdam on GitHub (Jan 17, 2026). Originally assigned to: @thdxr on GitHub. ### Description Using `gpt-5.2-codex` via `azure` gives error: ``` The chatCompletion operation does not work with the specified model, gpt-5.2-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993. ``` model `gpt-5.2` works fine used opencode, to fetch opencode source, add debug, identify issue and fix issue is `@ai-sdk/azure does support the Responses API. The issue is in opencode’s routing: your custom azure-openai provider goes through the generic path, which defaults to chat-completions unless useCompletionUrls is set. That’s why it’s hitting /chat/completions even though the model supports responses' ### Plugins nada ### OpenCode version latest - dev branch ### Steps to reproduce 1. use custom provider via @ai-sdk/azure 2. set model to gpt-5.2-codex 3. launch opencode 💀 ``` The chatCompletion operation does not work with the specified model, gpt-5.2-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993. ``` ### Screenshot and/or share link _No response_ ### Operating System max ### Terminal 🤷‍♂️
yindo added the bug label 2026-02-16 18:04:36 -05:00
yindo closed this issue 2026-02-16 18:04:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 17, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #8622: gpt-5.2-codex TypeError: sdk.responses is not a function - Same model with similar API routing issue manifesting as a different error
  • #7180: Azure OpenAI need to change completions -> responses - Exact same root cause (Azure endpoint routing) and same fix needed
  • #5866: [BUG]: GitHub Copilot Responses API routing for GPT-5+ - Related Responses API routing issue affecting similar models

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 17, 2026): This issue might be a duplicate of existing issues. Please check: - #8622: gpt-5.2-codex TypeError: sdk.responses is not a function - Same model with similar API routing issue manifesting as a different error - #7180: Azure OpenAI need to change completions -> responses - Exact same root cause (Azure endpoint routing) and same fix needed - #5866: [BUG]: GitHub Copilot Responses API routing for GPT-5+ - Related Responses API routing issue affecting similar models Feel free to ignore if none of these address your specific case.
Author
Owner

@OmarMcAdam commented on GitHub (Jan 17, 2026):

using azure as providerId instead of azure-openai resolves the issue

@OmarMcAdam commented on GitHub (Jan 17, 2026): using `azure` as providerId instead of `azure-openai` resolves the issue
Author
Owner

@JoaoCP13 commented on GitHub (Jan 20, 2026):

I'm having the same problem. I'm trying to use gpt-5.1-codex and it works when I run opencode on my local machine, but when I try to run it on a gitlab ci pipeline with the same configurations (same opencode.jsonc and variables) it always fails with the error The chatCompletion operation does not work with the specified model, gpt-5.1-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993. I tried with opencode versions 1.1.23 and 1.1.26. This is the opencode.jsonc I am using

{
  "$schema": "https://opencode.ai/config.json",
  "model": "azure/gpt-5.1-codex",
  "provider": {
    "azure": {
      "options": {
        "apiKey": "{env:AZURE_OPENAI_API_KEY}",
        "resourceName": "{env:AZURE_OPENAI_RESOURCE_NAME}",
      },
      "models": {
        "gpt-5.1-codex": {
          "name": "gpt-5.1-codex",
          "id": "{env:AZURE_OPENAI_DEPLOYMENT_NAME}"
        }
      }
    }
  }
}

I also added the useCompletionUrls option to false but didn't make any difference, it always resolve to the chatCompletion.

Can you please help me? Thank you in advance

@JoaoCP13 commented on GitHub (Jan 20, 2026): I'm having the same problem. I'm trying to use gpt-5.1-codex and it works when I run opencode on my local machine, but when I try to run it on a gitlab ci pipeline with the same configurations (same opencode.jsonc and variables) it always fails with the error ```The chatCompletion operation does not work with the specified model, gpt-5.1-codex. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.``` I tried with opencode versions 1.1.23 and 1.1.26. This is the opencode.jsonc I am using ``` { "$schema": "https://opencode.ai/config.json", "model": "azure/gpt-5.1-codex", "provider": { "azure": { "options": { "apiKey": "{env:AZURE_OPENAI_API_KEY}", "resourceName": "{env:AZURE_OPENAI_RESOURCE_NAME}", }, "models": { "gpt-5.1-codex": { "name": "gpt-5.1-codex", "id": "{env:AZURE_OPENAI_DEPLOYMENT_NAME}" } } } } } ``` I also added the useCompletionUrls option to false but didn't make any difference, it always resolve to the chatCompletion. Can you please help me? Thank you in advance
Author
Owner

@CezaryKlus commented on GitHub (Jan 27, 2026):

I experience the same behavior when running from VS Code devcontainer

@CezaryKlus commented on GitHub (Jan 27, 2026): I experience the same behavior when running from VS Code devcontainer
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6567