OpenCode setup

OpenCode

Dahl as an OpenAI-compatible provider in OpenCode

OpenCode talks to Dahl as an OpenAI-compatible provider. It needs three things: the base URL with /v1, a key with tokens on it, and a model ID.

Setup

  1. Get a key with tokens — in /account create a key and Allocate tokens to it from the pool (a new key starts at 0).
  2. Add the provider — put this into ~/.config/opencode/opencode.json (or opencode.json in the project):
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "dahl": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Dahl",
      "options": {
        "baseURL": "https://inference.dahl.global/v1",
        "apiKey": "{env:DAHL_API_KEY}"
      },
      "models": {
        "MiniMaxAI/MiniMax-M2.7": { "name": "MiniMax M2.7" },
        "deepseek-ai/DeepSeek-V4-Flash-0731": { "name": "DeepSeek V4 Flash" },
        "zai-org/GLM-5.3-Flash": { "name": "GLM 5.3 Flash" }
      }
    }
  }
}

3. Give OpenCode the key. Either export it in the shell where you run opencode:

export DAHL_API_KEY="dahl_…"

or store it in OpenCode instead of an env var:

opencode auth login
# → Other → provider id: dahl → paste your dahl_… key

4. Pick the model — run opencode, type /models, choose a Dahl model. Start with MiniMaxAI/MiniMax-M2.7; current IDs are in GET /v1/models.

Common errors

MessageCauseFix
No active credentials for provider: dahlThe provider is configured but has no keyExport DAHL_API_KEY in the same shell, or run opencode auth login
Method Not Allowed (405)baseURL without /v1Use https://inference.dahl.global/v1
available tokens exhausted (402)The key has 0 tokensAllocate from the pool in /account
This model is not currently offeredStale model IDPick an id from GET /v1/models and update models in the config