Skip to content

@ai-sdk/azure provider does not work with /chat/completions since v1.3.4 #20287

@chunglam2525

Description

@chunglam2525

Description

@ai-sdk/azure provider does not work since v1.3.4

here is my opencode.json config

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "foundary": {
      "npm": "@ai-sdk/azure",
      "options": {
        "baseURL": "https://custom-domain/openai",
        "apiKey": "xxxxxxxx",
        "apiVersion": "2025-04-01-preview",
        "useDeploymentBasedUrls": true,
        "useCompletionUrls": true
      },
      "models": {
        "gpt-5.4": {
          "name": "GPT-5.4"
        }
      }
    }
  },
  "autoupdate": false
}

I have looked up a lot of similar issue regarding azure openai api, seems like everyone is confuse about azure multiple supporting API format.

Expect:
POST: https://custom-domain/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}

{
  "model": "gpt-5.4",
  "messages": [
    ...
  ],
  ...
}

Actual:
POST: https://custom-domain/openai/deployments/{deployment-id}/responses?api-version={api-version}

{
  "model": "gpt-5.4",
  "input": [
    ...
  ],
  ...
}

This line of code sdk.chat(modelID) should direct me to the chat completion method with useCompletionUrls options based on the logic

changing @ai-sdk/azure version to 3.0.49 in opencode v1.3.4 might cause this issue to appear

Plugins

No response

OpenCode version

v1.3.4

Steps to reproduce

  1. prepare a azure api that have (only) this API format available - https://custom-domain/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}
  2. use opencode version v1.3.3 with this config - it works
  3. use opencode version v1.3.4 with same config - it does not works

Screenshot and/or share link

No response

Operating System

macOS

Terminal

WezTerm

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions