Mallard AI

OpenCode

Add the Mallard AI API to OpenCode as a custom provider.

  1. 1 Set your API key

    Export it in the shell you start OpenCode from:

    export MALLARD_API_KEY="your key"
  2. 2 Add the provider

    Add this to ~/.config/opencode/opencode.json for every project, or to opencode.json in a project's folder for that project alone. OpenCode merges the two.

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "mallard": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Mallard AI",
          "options": {
            "baseURL": "https://api.mallardai.co.uk/v1",
            "apiKey": "{env:MALLARD_API_KEY}"
          },
          "models": {
            "qwen/qwen3.6-35b-a3b": {
              "name": "Qwen3.6 35B A3B",
              "limit": { "context": 262144, "output": 32000 }
            }
          }
        }
      }
    }

    This config caps output at 32,000 tokens, leaving the rest of the 262,144-token context window for the prompt.

  3. 3 Choose the model

    Run /models in OpenCode and choose Qwen3.6 35B A3B. Or set "model": "mallard/qwen/qwen3.6-35b-a3b" in opencode.json.

    To check the provider loaded:

    opencode models mallard

OpenCode's docs