Run OpenCode on OAIRoute

OpenCode reads providers from opencode.json. Register OAIRoute as an OpenAI-compatible provider and every model it lists shows up in the model switcher.

Terminal agent

Configuration

~/.config/opencode/opencode.json
{
  "provider": {
    "oairoute": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.oairoute.com/v1",
        "apiKey": "YOUR_OAIROUTE_KEY"
      },
      "models": {
        "claude-opus-5": { "name": "Claude Opus 5" },
        "gpt-5.6": { "name": "GPT-5.6" }
      }
    }
  }
}
Run opencode and pick the provider with the model switcher.

Full step-by-step guide

Why route it through OAIRoute

Terminal-native, no GUI to maintain

The whole setup is a JSON block. Copy it, swap the key, switch models with one keystroke.

Any vendor from the same picker

Claude, GPT, Gemini and DeepSeek are all one model string apart in the switcher.

Works with the AI SDK provider

Underneath it uses @ai-sdk/openai-compatible, so streaming and tool calls behave as expected.

Setup

  1. 1

    Create a key

    Register at api.oairoute.com and create a key on the token page.

  2. 2

    Write the config

    Save the JSON below to ~/.config/opencode/opencode.json.

  3. 3

    Verify

    Run `opencode` and pick the provider with the model switcher.

Models worth trying

Model IDNameUse it forUSD per 1M in / out
claude-opus-5-5Claude Opus 5.5Default for hard terminal tasks.$0.20 / $1.00
gpt-6.1-solGPT-6.1 SolGood general-purpose default.$0.10 / $0.50
kimi-k3Kimi K3Strong on Chinese-language tasks.$0.90 / $4.50

Prices are per million tokens, input / output, at the rates published in the model catalogue.

Questions

Where does OpenCode look for config?

~/.config/opencode/opencode.json on macOS and Linux. On Windows it follows your XDG config directory.

Do I need to list every model?

No. You can add just the ones you plan to use; the provider will still pass other model IDs through.

Streaming or tool calls break?

Check that the npm package is @ai-sdk/openai-compatible and that baseURL ends in /v1.

Other guides