Integrations

Opencode

Run Claude, open-weight and GPT models in opencode through Roteo.

opencode is a terminal coding agent. It reaches Roteo two ways:

You wantUseModels
Claudeopencode's Claude Agent mode, which runs Claude Code underneathclaude-agent/opus, claude-agent/sonnet, claude-agent/haiku, claude-agent/fable
Open-weight or GPTan OpenAI-compatible providerglm-5.3, deepseek-v4-flash-0731, kimi-k3 and more

Claude models

opencode's Claude Agent mode drives the official Claude Code CLI as its model client, and Claude Code sends each request to Roteo with your key. No Claude login is needed.

1. Install

  • opencode 2.2.3 or newer. Download it from opencode's releases and check with opencode --version. The opencode-ai npm package is still on 1.x, which has no Claude Agent mode.
  • Claude Code, installed but not logged in: see Claude Code.

2. Point Claude Agent at Roteo

Add this to ~/.config/opencode/opencode.json, next to anything already there:

{
  "provider": {
    "claude-agent": {
      "options": {
        "baseURL": "https://api.roteo.ai",
        "authToken": "{env:ROTEO_API_KEY}"
      }
    }
  }
}
json · 10 lines

The key is options. A settings block looks similar but is ignored, and the first request then fails with "Not logged in".

The Roteo setup stays inside opencode: your own Claude Code keeps its usual login. A Roteo setup in Claude Code's ~/.claude/settings.json does not carry over either, because opencode starts Claude Code with its settings file off.

3. Set your key and turn telemetry off

Set your Roteo key, and switch off Claude Code's own telemetry and error reports. The two telemetry lines are required: Roteo keeps your identity away from the model provider, and they stop Claude Code reporting from your machine. They also make your own Claude Code quieter; its auto-updates keep working.

export ROTEO_API_KEY="sk_your_key"
export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1
opencode
bash · 4 lines

That sets them for the current terminal. To keep them, add the export lines to your shell profile (~/.zshrc, ~/.bashrc), or on Windows run setx ROTEO_API_KEY "sk_your_key", setx DISABLE_TELEMETRY 1 and setx DISABLE_ERROR_REPORTING 1 once, then open a new terminal.

4. Connect and pick a model

In opencode, run /connect and choose Claude Agent. Within a minute /models lists the Claude Agent models:

ModelRuns
claude-agent/opusClaude Opus 5.5
claude-agent/sonnetClaude Sonnet 5.5
claude-agent/haikuClaude Haiku 5.5
claude-agent/fableClaude Fable 5.1

Pick one and work as usual: tool calls and file edits go through Claude Code, and every request is billed to your Roteo balance. All four are supported, Fable 5.1 included. As everywhere else, Fable's own safeguards turn down cybersecurity-related requests, so use another model for those (see below).

After you change anything

opencode 2 keeps a background service that holds the environment it started with. After setting or changing the key, the telemetry lines or opencode.json, run:

opencode service restart
bash · 1 lines

from a terminal that has the new values.

If it fails

You seeDo this
"Not logged in · Run claude auth login"The background service started before the key was set: run opencode service restart. Also check that the block says options, not settings
"Failed to authenticate. API Error: 401 Invalid API key"The key is wrong or revoked. Check it in your dashboard
"API Error: 402 Insufficient balance..."Top up your balance in the dashboard. The message says how much is needed
It keeps thinking and never answersThe background service started before ROTEO_API_KEY was set, so Claude Code has no Roteo key. Run opencode service restart from a terminal that has the key, or restart your computer
"Model unavailable: anthropic/..."You picked opencode's plain Anthropic provider. Pick a claude-agent/... model
"Fable 5.1's safeguards flagged this message"Fable turns down cybersecurity-related requests, in every tool. Use claude-agent/opus or claude-agent/sonnet for that task

Without opencode.json

You can skip step 2 and set Claude Code's two variables instead, in the same place as step 3:

export ANTHROPIC_BASE_URL="https://api.roteo.ai"
export ANTHROPIC_AUTH_TOKEN="sk_your_key"
bash · 2 lines

Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY: in this mode an API key reads as "Not logged in". Set for your whole account (setx, a shell profile), these two send your own Claude Code through Roteo as well, which is why the opencode.json setup above comes first.

Open-weight and GPT models

opencode also 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. This works on opencode 1.x and 2.x.

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. deepseek-v4-flash-0731 and glm-5.3-flash are the cheapest 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 one of the cheapest models 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 on this provider; for Claude, use the Claude Agent mode above. 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