Azure OpenAI Configuration Help #3972

Closed
opened 2026-02-16 17:42:08 -05:00 by yindo · 3 comments
Owner

Originally created by @landoncrabtree on GitHub (Dec 29, 2025).

Originally assigned to: @thdxr on GitHub.

Question

Hi all,

Found this issue https://github.com/sst/opencode/issues/4136 and seems related, but the OP said the issue was fixed without details :(

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "azure": {
      "options": {
        "apiKey": "",
        "baseURL": "https://EXAMPLE.openai.azure.com/",
        "resourceName": "EXAMPLE",
      },
      "models": {
        "gpt-4.1": {
          "name": "gpt-4.1",
        },
      },
    },
  },
  "agent": {
    "codeql-validator": {
      "mode": "primary",
      "model": "azure/gpt-4.1",
      "prompt": "{file:./prompts/CODEQL_VALIDATOR.md}",
      "tools": {
        "write": true,
        "edit": true,
        "bash": true,
        "webfetch": false
      },
      "permission": {
        "edit": "allow",
        "bash": "allow",
        "webfetch": "deny"
      }
    }
  }
}

I have this configuration (with the API key, base URL, and resource name properly filled out). Additionally, I have an Azure OpenAI deployment called gpt-4.1 (case sensitive) created. However, when running opencode, I get the error: Resource not found.

Is there something wrong with the way I have the provider created?

Originally created by @landoncrabtree on GitHub (Dec 29, 2025). Originally assigned to: @thdxr on GitHub. ### Question Hi all, Found this issue https://github.com/sst/opencode/issues/4136 and seems related, but the OP said the issue was fixed without details :( ```json { "$schema": "https://opencode.ai/config.json", "provider": { "azure": { "options": { "apiKey": "", "baseURL": "https://EXAMPLE.openai.azure.com/", "resourceName": "EXAMPLE", }, "models": { "gpt-4.1": { "name": "gpt-4.1", }, }, }, }, "agent": { "codeql-validator": { "mode": "primary", "model": "azure/gpt-4.1", "prompt": "{file:./prompts/CODEQL_VALIDATOR.md}", "tools": { "write": true, "edit": true, "bash": true, "webfetch": false }, "permission": { "edit": "allow", "bash": "allow", "webfetch": "deny" } } } } ``` I have this configuration (with the API key, base URL, and resource name properly filled out). Additionally, I have an Azure OpenAI deployment called `gpt-4.1` (case sensitive) created. However, when running `opencode`, I get the error: `Resource not found`. Is there something wrong with the way I have the provider created?
yindo closed this issue 2026-02-16 17:42:08 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2025):

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

  • #4136: Setting up opencode with azure ai foundry (openai) project issue - Very similar Azure OpenAI configuration question with comparable setup issues
  • #5211: Cant use Azure OpenAI - Azure OpenAI configuration issues and "I'm sorry, but I cannot assist" errors
  • #1508: Azure OpenAi generated URL is wrong? - Includes exact "Resource not found" error message, potentially related to baseURL configuration

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

@github-actions[bot] commented on GitHub (Dec 29, 2025): This issue might be a duplicate of existing issues. Please check: - #4136: Setting up opencode with azure ai foundry (openai) project issue - Very similar Azure OpenAI configuration question with comparable setup issues - #5211: Cant use Azure OpenAI - Azure OpenAI configuration issues and "I'm sorry, but I cannot assist" errors - #1508: Azure OpenAi generated URL is wrong? - Includes exact "Resource not found" error message, potentially related to baseURL configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@landoncrabtree commented on GitHub (Dec 29, 2025):

You need to just use resourceName, as per AI SDK https://ai-sdk.dev/providers/ai-sdk-providers/azure, baseURL is generated from resourceName.

@landoncrabtree commented on GitHub (Dec 29, 2025): You need to just use `resourceName`, as per AI SDK https://ai-sdk.dev/providers/ai-sdk-providers/azure, baseURL is generated from resourceName.
Author
Owner

@tvdermeerSOG commented on GitHub (Jan 7, 2026):

do NOT set the baseurl. this should be enough:

      "options": {
        "apiKey": "",
        "resourceName": "EXAMPLE",
      },

where resourceName is indeed "https://EXAMPLE.openai.azure.com/" from your baseurl

@tvdermeerSOG commented on GitHub (Jan 7, 2026): do NOT set the baseurl. this should be enough: ``` "options": { "apiKey": "", "resourceName": "EXAMPLE", }, ``` where resourceName is indeed "https://EXAMPLE.openai.azure.com/" from your baseurl
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3972