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. Install OpenCode if you do not have it yet. macOS and Linux:

curl -fsSL https://opencode.ai/install | bash

Windows: install Node.js, then run in PowerShell:

npm install -g opencode-ai

2. Add the provider. Create opencode.json in the project folder with this content. To use it in every project, put it in ~/.config/opencode/opencode.json instead (Windows: %USERPROFILE%\.config\opencode\opencode.json, for example C:\Users\you\.config\opencode\opencode.json):

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "dahl": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Dahl",
      "options": {
        "baseURL": "https://inference.dahl.global/v1"
      },
      "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. Add the key. Run opencode in the project folder, type /connect, scroll down to Other, enter dahl as the provider id (it must match the name in the config) and paste your key. Copy the key in /account → API keys; a new key starts at 0, so Allocate tokens to it from the pool first.

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

5. Give it a task, for example “create hello.py that prints Hello”. OpenCode reads and edits the files itself.

Key from an environment variable

For scripts and CI, add "apiKey": "{env:DAHL_API_KEY}" to options in the config instead of /connect, and export the key in the shell where you run opencode:

export DAHL_API_KEY="dahl_…"

Common errors

MessageCauseFix
No active credentials for provider: dahlThe provider is configured but has no keyRun /connect → Other → dahl and paste the key; the id must match the config
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 offered (404)Wrong or stale model IDPick an id from the error or GET /v1/models and update models in the config
unsupported value "image_url" (400)An image in the chat history is resent with every request; current models do not accept imagesStart a new session (/new) without the image
This model is at concurrency capacity (429)The model is full at peak hoursOpenCode retries on its own; or switch model. See Errors
Provider request failed with HTTP 502Temporary error on our sideNot related to your key; OpenCode retries on its own