OpenCode 配置
如有需要,请创建 OpenCode 配置文件。API 密钥可以直接保存在配置中,也可以使用 /connect 命令配置。
默认模型为 openai/gpt-5.6-sol。
配置文件路径
Section titled “配置文件路径”~/.config/opencode/opencode.jsonopencode.json
Section titled “opencode.json”将 sk-your-rex-key 替换为你的 API Key:
{ "model": "openai/gpt-5.6-sol", "provider": { "openai": { "options": { "baseURL": "https://ai.j1ao.vip/v1", "apiKey": "sk-your-rex-key" }, "models": { "gpt-5.6-sol": { "name": "gpt-5.6-sol", "options": { "store": false }, "variants": { "low": {}, "medium": {}, "high": {}, "xhigh": {}, "max": {} } } } } }, "agent": { "build": { "options": { "store": false } }, "plan": { "options": { "store": false } } }, "$schema": "https://opencode.ai/config.json"}其他模型可按 gpt-5.6-sol 的结构继续添加,省略为 ...。
baseURL必须包含/v1。- 如果使用
/connect保存密钥,请删除配置中的apiKey字段,避免保留两份凭据。 - 不要将包含真实 API Key 的
opencode.json提交到 Git 仓库。

