Skip to content

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

Closed

Description

@OmarMcAdam

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

🤷‍♂️

Activity

  1. github-actions commented on Jan 17, 2026

    @github-actions
    Contributor

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

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

  2. OmarMcAdam commented on Jan 17, 2026

    @OmarMcAdam
    Author

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

  3. JoaoCP13 commented on Jan 20, 2026

    @JoaoCP13

    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

  4. CezaryKlus commented on Jan 27, 2026

    @CezaryKlus

    I experience the same behavior when running from VS Code devcontainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions