Skip to content

Azure OpenAI Configuration Help #6381

Closed

Description

@landoncrabtree

Question

Hi all,

Found this issue #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?

Activity

  1. github-actions commented on Dec 29, 2025

    @github-actions
    Contributor

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

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

  2. landoncrabtree commented on Dec 29, 2025

    @landoncrabtree
    Author

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

  3. tvdermeerSOG commented on Jan 7, 2026

    @tvdermeerSOG

    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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions