Not clear how to use it with azure #258

Closed
opened 2026-02-16 17:25:57 -05:00 by yindo · 6 comments
Owner

Originally created by @da1z on GitHub (Jun 24, 2025).

Originally assigned to: @thdxr on GitHub.

Sorry I really what to try opencode but it is not clear from docs how to make it work with azure. how do i pass resource name, api version and api key? I assume i can do it through env vars that vercel ai sdk respect but i want to do it through config.

Originally created by @da1z on GitHub (Jun 24, 2025). Originally assigned to: @thdxr on GitHub. Sorry I really what to try opencode but it is not clear from docs how to make it work with azure. how do i pass resource name, api version and api key? I assume i can do it through env vars that vercel ai sdk respect but i want to do it through config.
yindo closed this issue 2026-02-16 17:25:57 -05:00
Author
Owner

@thdxr commented on GitHub (Jun 24, 2025):

if you want to do it through config you can add an options field

provider: { azure: { options: { .... } } }
@thdxr commented on GitHub (Jun 24, 2025): if you want to do it through config you can add an `options` field ``` provider: { azure: { options: { .... } } } ```
Author
Owner

@da1z commented on GitHub (Jun 24, 2025):

Image

now i get this. i think it is related to striced openai schema, that does not allow optional params?

@da1z commented on GitHub (Jun 24, 2025): <img width="507" alt="Image" src="https://github.com/user-attachments/assets/0e6cd073-e85d-4040-8f82-ee6647603b87" /> now i get this. i think it is related to striced openai schema, that does not allow optional params?
Author
Owner

@andrii-k6a commented on GitHub (Jul 2, 2025):

I got it working by doing the following:

  1. Run the opencode auth login command and paste in your Azure API key.

  2. Add the following configuration to ~/.config/opencode/config.json:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "azure/gpt-4o",
  "provider": {
    "azure": {
      "options": {
        "resourceName": "your-azure-resource-name"
      },
      "models": {
        "azure/gpt-4o": {
          "name": "GPT-4o"
        }
      }
    }
  }
}
  1. Ensure Go is installed on your machine
@andrii-k6a commented on GitHub (Jul 2, 2025): I got it working by doing the following: 1. Run the `opencode auth login` command and paste in your Azure API key. 2. Add the following configuration to `~/.config/opencode/config.json`: ``` { "$schema": "https://opencode.ai/config.json", "model": "azure/gpt-4o", "provider": { "azure": { "options": { "resourceName": "your-azure-resource-name" }, "models": { "azure/gpt-4o": { "name": "GPT-4o" } } } } } ``` 3. Ensure Go is installed on your machine
Author
Owner

@thdxr commented on GitHub (Jul 3, 2025):

do you need the config?

@thdxr commented on GitHub (Jul 3, 2025): do you need the config?
Author
Owner

@andrii-k6a commented on GitHub (Jul 4, 2025):

I mainly use it to specify the resourceName option - otherwise, I'd need to export the AZURE_RESOURCE_NAME environment variable, which I'd prefer not to do.

What I’m still unclear on is how to specify which deployment to use. I may have multiple deployments of the same model within a single resource, so I’m not sure how the tool determines which one to use by default, or how to override that if needed.

@andrii-k6a commented on GitHub (Jul 4, 2025): I mainly use it to specify the resourceName option - otherwise, I'd need to export the `AZURE_RESOURCE_NAME` environment variable, which I'd prefer not to do. What I’m still unclear on is how to specify which deployment to use. I may have multiple deployments of the same model within a single resource, so I’m not sure how the tool determines which one to use by default, or how to override that if needed.
Author
Owner

@rekram1-node commented on GitHub (Aug 28, 2025):

we have better docs for azure now: https://opencode.ai/docs/providers/#azure-openai

if you get schema issues you likely have an mcp server that your model of choice doesnt like the format of the tools < we may wanna sanitize params for you tho

@rekram1-node commented on GitHub (Aug 28, 2025): we have better docs for azure now: https://opencode.ai/docs/providers/#azure-openai if you get schema issues you likely have an mcp server that your model of choice doesnt like the format of the tools < we may wanna sanitize params for you tho
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#258