OpenCode
通过 ~/.config/opencode/opencode.json 使用 GetVibe API 配置 OpenCode:一个兼容 OpenAI 的提供商,baseURL 为 getvibeapi.com/v1。
OpenCode 是一个在终端中运行智能代理编码的 npm 包。提供商配置位于 ~/.config/opencode/opencode.json中。
包含所有模型的现成配置
OpenCode 不会从 /v1/models读取上下文大小:手动添加的模型会显示上下文为 0,历史记录也不会及时压缩。不要手动输入这些数字,而应下载生成的配置文件,它基于我们的目录构建:其中包含每个已发布模型的名称、上下文大小、输出限制以及 image / reasoning / tool 标志。配置文件不包含密钥,只有 {env:GETVIBE_API_KEY}引用。
# macOS / Linux — a fresh config with every model and its context
mkdir -p ~/.config/opencode
curl -fsSL https://getvibeapi.com/api/integrations/opencode.json -o ~/.config/opencode/opencode.json# Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.config\opencode" | Out-Null
Invoke-WebRequest https://getvibeapi.com/api/integrations/opencode.json -OutFile "$HOME\.config\opencode\opencode.json"如果你的 opencode.json 已经自定义过,请不要覆盖它,只替换提供商代码块并保留其余内容:
# Already have an opencode.json — replace only the provider block (needs jq)
cd ~/.config/opencode && cp opencode.json opencode.json.bak
curl -fsSL https://getvibeapi.com/api/integrations/opencode.json -o provider.json
jq --slurpfile pv provider.json '.provider = ((.provider // {}) + $pv[0].provider)' opencode.json.bak > opencode.json# Only the models you need (comma-separated IDs); ?variants=1 adds pinned channels too
curl -fsSL "https://getvibeapi.com/api/integrations/opencode.json?models=claude-opus-5.5,openai/gpt-6.1-sol"目录会发生变化:出现新模型时,请再次运行相同的命令。删除您手动输入的所有模型条目,否则选择器会显示重复项,并且上下文长度为 0。
手动编辑 opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"getvibe": {
"npm": "@ai-sdk/openai-compatible",
"name": "GetVibe",
"options": {
"baseURL": "https://getvibeapi.com/v1",
"apiKey": "{env:GETVIBE_API_KEY}"
},
"models": {
"gpt-6.1-sol": {
"name": "GPT-6.1 Sol",
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"claude-opus-5.5": {
"name": "Claude Opus 5.5",
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash",
"attachment": true,
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"kimi-k3.1-pro": {
"name": "Kimi K3.1 Pro",
"attachment": false,
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
}
}
}
}
},
"model": "getvibe/gpt-6.1-sol"
}启动 OpenCode 前设置 GETVIBE_API_KEY,并从同一窗口启动:export GETVIBE_API_KEY="sk-pv-…"(macOS/Linux),或执行 setx GETVIBE_API_KEY "sk-pv-…" 后打开新的 PowerShell 窗口(Windows)。如果没有该变量,OpenCode 会发送空密钥,并收到 401“invalid API key”。不想使用变量?请在 apiKey 字段中用密钥本身替换 {env:GETVIBE_API_KEY}。
图像需要
"attachment": true。OpenCode 从 models.dev 注册表获取模型能力,但该注册表未列出 GetVibe,因此声明为空 {} 的模型会被视为不接受附件,OpenCode 发送请求时会省略图像。随后模型会如实表示自己无法看到图像,即使它具备视觉能力。对于 catalog 中显示支持图像输入的每个模型,都添加 attachment 和 modalities。我们还检查了其他已发布的集成:Cline、Cursor、Roo Code、Kilo Code、Aider 和 Continue 的示例中都没有单独的模型能力映射,因此这些配置中没有遗漏这一项仅适用于 OpenCode 的设置。