OpenCode 接入 / OpenCode API platform
OpenCode 接入 Routin
OpenCode on Routin: /connect and opencode.json
OpenCode 支持任意 OpenAI 兼容服务商。用 /connect 或 opencode.json 把 Routin 配成 provider。
OpenCode accepts any OpenAI-compatible provider. Add Routin with /connect or opencode.json.
接入要点 / Setup facts
- 协议 / ProtocolOpenAI-compatible /v1
- Base URL
https://api.routin.ai/v1 - opencode.json 里 options.baseURL 为 https://api.routin.ai/v1,npm 包用 @ai-sdk/openai-compatible。 / Set options.baseURL to https://api.routin.ai/v1 and npm to @ai-sdk/openai-compatible.
步骤 / Steps
- 安装 OpenCode / Install OpenCode
npm install -g opencode,或在 macOS 上 brew install opencode。
Install with npm install -g opencode, or brew install opencode on macOS.
- 连接凭据 / Connect credentials
运行 /connect,选择 Other,provider id 填 routin,再粘贴 Routin API Key。
Run /connect, choose Other, set provider id to routin, then paste the Routin API key.
- 写入 opencode.json / Write opencode.json
在项目或 ~/.config/opencode/opencode.json 声明 Routin provider 与模型列表。
Declare the Routin provider and models in opencode.json (project or ~/.config/opencode/).
opencode.json / opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"routin": {
"npm": "@ai-sdk/openai-compatible",
"name": "Routin API",
"options": {
"baseURL": "https://api.routin.ai/v1"
}
}
}
}下一步 / Next
其他 Agent / Other agents
可选用的聊天模型 / Chat models to try
把目录中的模型 id 填进 OpenCode。价格来自公开目录。 / Use a catalog model id inside OpenCode.
| Model | Provider | Type | Input | Output |
|---|---|---|---|---|
| claude-fable-5 | Anthropic | chat | 10.00 Token / 1M tokens | 50.00 Token / 1M tokens |
| claude-fable-5-1 | Anthropic | chat | 10.00 Token / 1M tokens | 50.00 Token / 1M tokens |
| claude-fable-5-2 | Anthropic | chat | 8.00 Token / 1M tokens | 40.00 Token / 1M tokens |
| claude-haiku-4-5 | Anthropic | chat | 1.00 Token / 1M tokens | 5.00 Token / 1M tokens |
| claude-haiku-4-5-20251001 | Anthropic | chat | 1.00 Token / 1M tokens | 5.00 Token / 1M tokens |
| claude-haiku-5-5 | Anthropic | chat | 0.1000 Token / 1M tokens | 0.5000 Token / 1M tokens |
| claude-opus-4-1-20250805 | Anthropic | chat | 3.00 Token / 1M tokens | 15.00 Token / 1M tokens |
| claude-opus-4-5-20251101 | Anthropic | chat | 5.00 Token / 1M tokens | 25.00 Token / 1M tokens |
模型目录 / Models套餐 / Plans费用计算器 / Cost calculatorCoding Agents文档 / Docs
常见问题 / FAQ
- OpenCode 能用 Routin 吗? / Does OpenCode work with Routin?
- Yes. Use /connect or opencode.json with baseURL https://api.routin.ai/v1. 可以。