Open Code
安装 OpenCode
npm install -g open_code编辑配置文件
macOS / Linux
~/.config/opencode/opencode.jsonWindows
C:\Users\<YOUR_USERNAME>\.config\opencode\opencode.json{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"name": "Anthropic",
"options": {
"baseURL": "https://gateway.theturbo.ai"
}
},
"openai": {
"options": {
"baseURL": "https://gateway.theturbo.ai"
},
"models": {
"gpt-5.2": {
"options": {
// 重要:
// 必须按如下方式配置 `include` 和 `store` 选项。
// 错误的设置可能会导致模型行为异常。
"include": ["reasoning.encrypted_content"],
"store": false,
// 控制模型执行推理的深度
"reasoningEffort": "high",
// 控制生成文本输出的详细程度
"textVerbosity": "high",
// 自动生成推理摘要
"reasoningSummary": "auto"
}
},
"gpt-5.2-codex": {
"options": {
"include": ["reasoning.encrypted_content"],
"store": false
}
}
}
},
"gateway.theturbo": {
// 第三方 OpenAI 兼容提供方的配置
"npm": "@ai-sdk/openai-compatible",
// 在 UI 中显示的名称
"name": "gateway.theturbo",
"options": {
// AI 网关服务的基础 URL
"baseURL": "https://gateway.theturbo.ai"
},
"models": {
"deepseek-v3.2": {
// 模型 ID,可根据需要进行修改
// 可用模型 ID 请参考 AI 网关的模型列表
"name": "DeepSeek V3.2"
}
}
}
}
}添加认证凭据
步骤 1:添加 OpenAI 凭据
步骤 2:添加 Anthropic 凭据
步骤 3:将 AI 网关添加为自定义提供方
CLI 交互示例
使用 OpenCode
启动 OpenCode
首次使用初始化
切换模型
Plan 与 Build 模式
安装 Oh My OpenCode
配置 Oh My OpenCode
最后更新于