API Unlimit
/Docs/OpenCode
Setup Guide

OpenCode Setup

Route OpenCode through API Unlimit using ~/.config/opencode/opencode.json.

1

Install OpenCode

bash
npm install -g opencode-ai
2

Create opencode.json

Create ~/.config/opencode/opencode.json:

~/.config/opencode/opencode.json
{
  "provider": {
    "9router": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://apiunlimit.com/v1",
        "apiKey": "sk-YOUR_KEY_HERE"
      },
      "models": {
        "claude-sonnet-4-6": { "name": "claude-sonnet-4-6" },
        "claude-opus-4-8":   { "name": "claude-opus-4-8" },
        "claude-opus-4-7":   { "name": "claude-opus-4-7" }
      }
    }
  },
  "model": "9router/claude-sonnet-4-6",
  "agent": {
    "explorer": {
      "description": "Fast explorer subagent for codebase exploration",
      "mode": "subagent",
      "model": "9router/claude-sonnet-4-6"
    }
  }
}

Replace sk-YOUR_KEY_HERE with your API key. Add more model IDs under models as needed.

info
OpenCode uses the @ai-sdk/openai-compatible adapter — the gateway must expose an OpenAI-compatible endpoint, which API Unlimit does at /v1.
3

Test it

bash
opencode "hello"
check_circle
If OpenCode responds without errors, you're connected.

Don't have an API key yet?

Contact us on Zalo or Telegram — key activated within minutes after payment.

shopping_cartView Pricing