Skip to content

Azure OpenAI configuration returns "API version not supported" / "Resource not found" despite valid endpoint #12186

Description

@KnowhereFern

Description

Environment:

  • OpenCode version: 1.1.50
  • OS: macOS Darwin 25.2.0
  • Platform: darwin (Apple Silicon)

Azure Setup:

  • Resource:
  • Endpoint: https://<RESOURCE_NAME>.cognitiveservices.azure.com
  • Deployments tested: Kimi-K2-Thinking, gpt-5.2
  • API versions tested: 2024-10-21, 2024-05-01-preview

Problem:
Azure endpoints work perfectly via curl but fail in OpenCode with "API version not supported" or "Resource not found" errors.

Curl test (works):
curl -s "https://<RESOURCE_NAME>.cognitiveservices.azure.com/openai/deployments/gpt-5.2/chat/completions?api-version=2024-10-21"
-H "api-key: <API_KEY>"
-H "Content-Type: application/json"
-d '{"messages":[{"role":"user","content":"hi"}],"max_completion_tokens":10}'

Returns HTTP 200 with valid response

Configs tried:

  1. Using baseURL:
    {
    "model": "azure/gpt-5.2",
    "provider": {
    "azure": {
    "options": {
    "apiKey": "<API_KEY>",
    "baseURL": "https://<RESOURCE_NAME>.cognitiveservices.azure.com",
    "apiVersion": "2024-10-21"
    }
    }
    }
    }

  2. Using resourceName (per issue Azure OpenAI Configuration Help #6381):
    {
    "model": "azure/gpt-5.2",
    "provider": {
    "azure": {
    "options": {
    "apiKey": "<API_KEY>",
    "resourceName": "<RESOURCE_NAME>",
    "apiVersion": "2024-10-21"
    }
    }
    }
    }

Result: Both return "API version not supported" in OpenCode UI.

Expected: OpenCode should connect successfully since the underlying API works.

Notes:

  • The .cognitiveservices.azure.com domain is used for Azure AI Foundry model catalog deployments (non-native OpenAI models)
  • OpenCode may be defaulting to .openai.azure.com or ignoring the apiVersion config

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

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