Integrations

Opencode

Point opencode's terminal agent at Roteo and run open-weight models from your wallet.

opencode is a terminal coding agent. It speaks the Chat Completions wire through an OpenAI-compatible provider, so it connects to Roteo with a provider block and an API key. Two minutes, no proxy.

Install

Pick whichever you already have:

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

# node package managers
npm install -g opencode-ai
bun install -g opencode-ai
pnpm install -g opencode-ai

# macOS / Linux
brew install anomalyco/tap/opencode

# arch
paru -S opencode-bin
bash · 13 lines

Connect

Run opencode, then /connect. Scroll to Other, enter roteo as the provider id, and paste your Roteo key.

/connect only stores the id and the key. The endpoint and the model list live in the config file, which is the second half of the setup.

Configure

Add the provider to ~/.config/opencode/opencode.json (opencode.jsonc works too, and a project-level opencode.json overrides it).

This block carries the five open-weight models verified for opencode, each with its real context window, so /models shows the full list instead of the two you happened to type:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "roteo": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "roteo",
      "options": {
        "baseURL": "https://api.roteo.ai/v1"
      },
      "models": {
        "glm-5.3-flash": {
          "name": "GLM 5.3 Flash",
          "limit": { "context": 1048576, "output": 131072 }
        },
        "glm-5.3": {
          "name": "GLM 5.3",
          "limit": { "context": 262144, "output": 131072 }
        },
        "deepseek-v4-flash-0731": {
          "name": "DeepSeek V4 Flash",
          "limit": { "context": 1048576, "output": 32000 }
        },
        "kimi-k3": {
          "name": "Kimi K3",
          "limit": { "context": 1048576, "output": 32000 }
        },
        "qwen3.8-max": {
          "name": "Qwen 3.8 Max",
          "limit": { "context": 1000000, "output": 32000 }
        }
      }
    }
  }
}

All five are verified to run real tool calls through opencode. glm-5.3-flash is the cheapest and has the largest window of the group; see Pricing for the rates.

Use roteo, lowercase, both for the key under provider and for name. It must match exactly what you typed at the /connect prompt, because that string is the only link between your stored key and this block.

After editing the file, quit and relaunch opencode, then pick the model again with /models. opencode reads the file at startup, so a running session keeps the old list and the old model.

Point the small model somewhere cheap

Add this at the top level of the same file, beside provider:

"small_model": "roteo/glm-5.3-flash"
json · 1 lines

opencode makes side calls you never see, such as naming and summarising the session, and when small_model is unset they fall back to your main model. The title call also carries its own internal retries, so a two or three word title can mean several extra calls against your chosen model, running at the same time as your real request.

Sending those to glm-5.3-flash is strictly better: it is the cheapest model on the endpoint, and it keeps your main model's budget for actual work. The format is provider/model-id, so the roteo/ prefix matters.

Keep the key out of the file

/connect already holds the key, and a literal key in a config is a key that gets committed by accident.

If you would rather skip /connect and keep everything in the file, opencode interpolates secrets instead of storing them in plain text: add "apiKey": "{env:ROTEO_API_KEY}" next to baseURL (a {file:~/.secrets/roteo} form works too). Use one or the other, not both.

Switch models

The block above already lists everything usable, so /models has them all. To add a new id later, put it in the models map, restart, and pick it again.

The open-weight ids from Models are the set we recommend and verify for opencode. GPT ids also work but are not yet verified with opencode. Claude ids are refused, because agent frameworks cannot be served on Claude models; for Claude, use Claude Code. The full support matrix is in Agents & OpenAI-compatible clients.

If the key reads as missing

  • Capitals in the provider id. A Roteo in the config will not match the roteo that /connect stored.
  • A renamed provider. Change roteo to roteo-local and the stored key stays filed under the old name. Run /connect again with the new id.
  • A second provider. A block for a different base URL does not inherit the first block's key. Run /connect again and type the new id.
Opencode | Roteo