Skip to content

Not clear how to use it with azure #360

Closed

Description

@da1z

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.

Activity

  1. self-assigned this
    on Jun 24, 2025
  2. thdxr commented on Jun 24, 2025

    @thdxr
    Member

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

    provider: { azure: { options: { .... } } }
    
  3. da1z commented on Jun 24, 2025

    @da1z
    Author
    Image

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

  4. andrii-k6a commented on Jul 2, 2025

    @andrii-k6a

    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
  5. thdxr commented on Jul 3, 2025

    @thdxr
    Member

    do you need the config?

  6. andrii-k6a commented on Jul 4, 2025

    @andrii-k6a

    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.

  7. rekram1-node commented on Aug 29, 2025

    @rekram1-node
    Contributor

    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

  8. sunqb commented on Jun 4, 2026

    @sunqb

    this is good for me

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