Bug: Unable to connect Azure AI Foundry Serverless Models (DeepSeek) due to strict Provider/Model validation #8504

Open
opened 2026-02-16 18:10:08 -05:00 by yindo · 1 comment
Owner

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

Originally assigned to: @thdxr on GitHub.

CLI cannot connect to Azure AI Foundry Serverless endpoints or OpenAI-compatible APIs

Describe the bug

The CLI (v1.1.51) currently cannot connect to Azure AI Foundry Serverless endpoints or other OpenAI-compatible APIs (like vLLM) because of two restrictive design choices:

  1. Azure Provider: Forces a resourceName and builds a legacy URL path (/openai/deployments/...), which results in Resource not found for Serverless endpoints.
  2. OpenAI Provider: Validates the model name against a hardcoded internal list, rejecting any non-standard model names (like DeepSeek-V3.2) even when a custom baseURL is defined.

Steps to Reproduce

Setup: Azure AI Foundry Serverless Deployment (DeepSeek-V3.2)
Endpoint: https://<id>.services.ai.azure.com/openai/v1

Attempt 1: Using azure provider

{
  "model": "azure/deepseek-v3.2",
  "provider": {
    "azure": {
      "options": {
        "apiKey": "REDACTED",
        "baseURL": "https://<id>.services.ai.azure.com/openai/v1"
      }
    }
  }
}

Error: AI_LoadSettingError: Azure OpenAI resource name setting is missing.

Conflict: Serverless endpoints do not follow the {resourceName}.openai.azure.com pattern. Adding a dummy resourceName causes the CLI to construct an invalid URL.

Attempt 2: Using openai provider (as a proxy)

{
  "model": "openai/DeepSeek-V3.2",
  "provider": {
    "openai": {
      "options": {
        "apiKey": "REDACTED",
        "baseURL": "https://<id>.services.ai.azure.com/openai/v1"
      }
    }
  }
}

Error: ProviderModelNotFoundError (model name is not in the hardcoded list for OpenAI).

Expected Behavior

  • BaseURL Priority: If a baseURL is provided, the CLI should respect it as a full path and stop appending provider-specific path segments (like /deployments/).
  • Flexible Validation: Disable model name validation when a custom baseURL is present to support the growing ecosystem of OpenAI-compatible providers (Foundry, vLLM, Ollama).
  • Optional resourceName: Make resourceName optional for the Azure provider when using Foundry Serverless URLs.

Environment

  • OS: Windows 11
  • OpenCode Version: 1.1.51
  • Model: DeepSeek-V3.2 via Azure AI Foundry Serverless

Additional Context

Azure AI Foundry Serverless endpoints use a different URL structure than traditional Azure OpenAI deployments. The current implementation assumes all Azure endpoints follow the legacy pattern, which breaks compatibility with newer Azure AI services.

Originally created by @JohanensKarlin on GitHub (Feb 4, 2026). Originally assigned to: @thdxr on GitHub. # CLI cannot connect to Azure AI Foundry Serverless endpoints or OpenAI-compatible APIs ## Describe the bug The CLI (v1.1.51) currently cannot connect to **Azure AI Foundry Serverless** endpoints or other OpenAI-compatible APIs (like vLLM) because of two restrictive design choices: 1. **Azure Provider:** Forces a `resourceName` and builds a legacy URL path (`/openai/deployments/...`), which results in `Resource not found` for Serverless endpoints. 2. **OpenAI Provider:** Validates the model name against a hardcoded internal list, rejecting any non-standard model names (like `DeepSeek-V3.2`) even when a custom `baseURL` is defined. ## Steps to Reproduce **Setup:** Azure AI Foundry Serverless Deployment (DeepSeek-V3.2) **Endpoint:** `https://<id>.services.ai.azure.com/openai/v1` ### Attempt 1: Using `azure` provider ```json { "model": "azure/deepseek-v3.2", "provider": { "azure": { "options": { "apiKey": "REDACTED", "baseURL": "https://<id>.services.ai.azure.com/openai/v1" } } } } ``` **Error:** `AI_LoadSettingError: Azure OpenAI resource name setting is missing.` **Conflict:** Serverless endpoints do not follow the `{resourceName}.openai.azure.com` pattern. Adding a dummy `resourceName` causes the CLI to construct an invalid URL. ### Attempt 2: Using `openai` provider (as a proxy) ```json { "model": "openai/DeepSeek-V3.2", "provider": { "openai": { "options": { "apiKey": "REDACTED", "baseURL": "https://<id>.services.ai.azure.com/openai/v1" } } } } ``` **Error:** `ProviderModelNotFoundError` (model name is not in the hardcoded list for OpenAI). ## Expected Behavior - **BaseURL Priority:** If a `baseURL` is provided, the CLI should respect it as a full path and stop appending provider-specific path segments (like `/deployments/`). - **Flexible Validation:** Disable model name validation when a custom `baseURL` is present to support the growing ecosystem of OpenAI-compatible providers (Foundry, vLLM, Ollama). - **Optional resourceName:** Make `resourceName` optional for the Azure provider when using Foundry Serverless URLs. ## Environment - **OS:** Windows 11 - **OpenCode Version:** 1.1.51 - **Model:** DeepSeek-V3.2 via Azure AI Foundry Serverless ## Additional Context Azure AI Foundry Serverless endpoints use a different URL structure than traditional Azure OpenAI deployments. The current implementation assumes all Azure endpoints follow the legacy pattern, which breaks compatibility with newer Azure AI services.
yindo added the bug label 2026-02-16 18:10:08 -05:00
Author
Owner

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

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

  • #6615: Deepseek v3.2 - Azure Foundry - It works partially, tools and todos not. (Same model on Azure Foundry with configuration issues)
  • #12062: Agent model validation fails with trailing slash for custom OpenAI-compatible provider models (Related model validation issues with custom providers)
  • #5674: Custom OpenAI-compatible provider options not being passed to API calls (baseURL configuration not being passed to API)

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: - #6615: Deepseek v3.2 - Azure Foundry - It works partially, tools and todos not. (Same model on Azure Foundry with configuration issues) - #12062: Agent model validation fails with trailing slash for custom OpenAI-compatible provider models (Related model validation issues with custom providers) - #5674: Custom OpenAI-compatible provider options not being passed to API calls (baseURL configuration not being passed to API) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8504