Skip to main content
OpenCode is an open-source terminal AI coding agent. It speaks the OpenAI-compatible wire format for chat, so you can point it at routing.run with a dashboard rk_ key, OPENAI_API_BASE, and any model id that starts with route/. Official install and usage guides live at opencode.ai/docs.

Install OpenCode

Pick one install path, then confirm the binary is on your PATH:
curl -fsSL https://opencode.ai/install | bash
On macOS or Linux with Homebrew, the OpenCode tap tracks releases closely:
brew install anomalyco/tap/opencode
With Bun:
bun install -g opencode-ai
Then run opencode --help (or opencode) from a project directory. If you use OpenCode’s own Zen or other hosted auth flows, skip those for routing.run and use the env vars in Connect routing.run below instead.

Connect routing.run

1

Get your API key

Create an API key at app.routing.run. Copy the full secret — it starts with rk_.
2

Apply environment variables

Use the Connection prompt block in the next section. Run the export lines in the same shell where you start opencode, or add them to ~/.zshrc / ~/.bashrc / your CI secret store.
3

Launch OpenCode

From your repo root, run opencode. Chat traffic should go to https://api.routing.run/v1 with your rk_ credential.

Connection prompt

OpenCode reads OPENAI_API_KEY and OPENAI_API_BASE (not OPENAI_BASE_URL). Use Copy on the block below for a complete integration checklist.

OpenCode CLI — connect to routing.run

Manual configuration

If you want to configure OpenCode manually instead of using the prompt above, export these exact values in the same shell where you run opencode:
export ROUTING_RUN_API_KEY='rk_REPLACE_ME'
export OPENAI_API_KEY="$ROUTING_RUN_API_KEY"
export OPENAI_API_BASE="https://api.routing.run/v1"
If you keep multiple CLI backends locally, save these exports in a shell wrapper or env file named routing.run so switching providers is simpler. Use a model id with the route/ prefix, for example route/glm-5.1.
If list calls work but chat fails, confirm the model id includes the route/ prefix and appears in authenticated GET https://api.routing.run/v1/models for your key.

Verify

After exporting, you should see your allowed model ids (not only the public anonymous list):
curl -sS https://api.routing.run/v1/models \
  -H "Authorization: Bearer $ROUTING_RUN_API_KEY" | head -c 800

Troubleshooting

  • Wrong host or 401OPENAI_API_BASE must be exactly https://api.routing.run/v1 with no trailing slash. OPENAI_BASE_URL alone is not what OpenCode reads.
  • Unknown model — Use ids from the models catalog and your authenticated list; typos in route/… ids return INVALID_MODEL from the API.
  • Env not picked up — GUI terminals sometimes launch without your shell profile. Export again in that terminal session, or wrap opencode in a small script that sources the same vars.
Plan tier and access are authoritative on GET https://api.routing.run/v1/models with your rk_ key. The full list is on the models page; common picks:
ModelUse case
route/deepseek-v3.2General-purpose chat (matches most doc examples)
route/glm-5.1Reasoning and coding
route/minimax-m2.7Long-context sessions
route/kimi-k2.5Agentic and tool-heavy flows
route/qwen3.6-plus-previewQwen3.6-class preview
route/qwen3.5-plusQwen3.5 flagship