Skip to content

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

Closed

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

Activity

  1. github-actions commented on Feb 4, 2026

    @github-actions
    Contributor

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

    The core issue appears to be related to how OpenCode constructs Azure API URLs and validates API versions. These issues share the common symptoms of "API version not supported" or "Resource not found" errors despite valid Azure endpoints.

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

  2. R44VC0RP commented on Feb 4, 2026

    @R44VC0RP
    Contributor

    Can you try running opencode models --refresh

  3. github-actions commented on Apr 6, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  4. rodrigorodriguez commented on Apr 17, 2026

    @rodrigorodriguez

    OpenAI resource name setting is missing. Pass it using the 'resourceName' parameter or the AZURE_RESOURCE_NAME environment variable.

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