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

Open
opened 2026-02-16 18:10:15 -05:00 by yindo · 2 comments
Owner

Originally created by @KnowhereFern on GitHub (Feb 4, 2026).

Originally assigned to: @thdxr on GitHub.

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 #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

Originally created by @KnowhereFern on GitHub (Feb 4, 2026). Originally assigned to: @thdxr on GitHub. ### Description Environment: - OpenCode version: 1.1.50 - OS: macOS Darwin 25.2.0 - Platform: darwin (Apple Silicon) Azure Setup: - Resource: <REDACTED> - 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 #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_
yindo added the bug label 2026-02-16 18:10:15 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 4, 2026):

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

  • #6381: Azure OpenAI Configuration Help - User reports "Resource not found" error with similar baseURL and resourceName configuration attempts
  • #5211: Cant use Azure OpenAI - User unable to use Azure OpenAI setup, getting errors
  • #12102: Bug: Unable to connect Azure AI Foundry Serverless Models (DeepSeek) - Describes similar issues with Azure Foundry endpoints and API version configuration
  • #1508: Azure OpenAi generated URL is wrong? - Related issue with Azure URL path construction adding extra /v1/ segments

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.

@github-actions[bot] commented on GitHub (Feb 4, 2026): This issue might be a duplicate of existing issues. Please check: - #6381: Azure OpenAI Configuration Help - User reports "Resource not found" error with similar baseURL and resourceName configuration attempts - #5211: Cant use Azure OpenAI - User unable to use Azure OpenAI setup, getting errors - #12102: Bug: Unable to connect Azure AI Foundry Serverless Models (DeepSeek) - Describes similar issues with Azure Foundry endpoints and API version configuration - #1508: Azure OpenAi generated URL is wrong? - Related issue with Azure URL path construction adding extra /v1/ segments 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.
Author
Owner

@R44VC0RP commented on GitHub (Feb 4, 2026):

Can you try running opencode models --refresh

@R44VC0RP commented on GitHub (Feb 4, 2026): Can you try running `opencode models --refresh`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8548