Skip to content

OpenCode ​

OpenCode takes custom providers through opencode.json.

Set it up from a GUI instead

Prefer not to edit config files: use CC-Switch (Claude Code / Codex) or Magpie (one place for every agent).

Install ​

bash
npm i -g opencode-ai

Configure ​

In your project root or ~/.config/opencode/opencode.json:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "leekbox": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LeekBox",
      "options": {
        "baseURL": "https://leekbox.ai/v1",
        "apiKey": "{env:LEEKBOX_API_KEY}"
      },
      "models": {
        "claude-sonnet-5": { "name": "Claude Sonnet 5" },
        "gpt-6.1-sol": { "name": "GPT-6.1 Sol" },
        "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" }
      }
    }
  }
}
bash
export LEEKBOX_API_KEY="sk-..."
opencode

Model keys must match LeekBox model ids exactly — see Models & pricing.

Anthropic protocol variant ​

Swap npm for @ai-sdk/anthropic and use https://leekbox.ai (no /v1).

Troubleshooting ​

SymptomFix
Empty model listKeys in models do not match live ids
401LEEKBOX_API_KEY unset, or {env:…} syntax missing

LeekBox — unified AI gateway