tencent cloud

OpenCode

Download
聚焦模式
字号
最后更新时间: 2026-07-23 15:08:38
OpenCode 是一款开源的 AI 编程代理工具,提供终端界面、桌面应用和 IDE 扩展等多种使用方式。本文介绍如何在 OpenCode 中配置与使用腾讯云大模型 Token Plan 企业版。

前置条件

在开始配置前,请确保您已完成以下准备工作:

配置 Token Plan 企业版

您需要按照下面的示例修改 OpenCode 的配置文件,配置文件路径如下,配置文件不存在时新建即可。
macOS / Linux:~/.config/opencode/opencode.json
Windows:C:\\Users\\<用户名>\\.config\\opencode\\opencode.json
说明:
请您将代码中 <USER_API_KEY> 替换为您的 API Key。下方配置已按套餐和地域预填模型列表,请选择与您购买套餐及开通地域对应的配置。
不同套餐和地域的模型接入地址请参见 接入地址
专业套餐(广州)
专业套餐(新加坡)
轻享套餐(广州)
轻享套餐(新加坡)
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tencent Cloud",
"options": {
"baseURL": "https://tokenhub.tencentcloudmaas.com/plan/v3",
"apiKey": "<USER_API_KEY>"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"glm-5.2": {
"name": "GLM-5.2",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"minimax-m3": {
"name": "MiniMax-M3",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"kimi-k2.7-code": {
"name": "Kimi K2.7 Code",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"kimi-k2.7-code-highspeed": {
"name": "Kimi K2.7 Code HighSpeed",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-flash": {
"name": "DeepSeek-V4-Flash",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-pro": {
"name": "DeepSeek-V4-Pro",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-flash-202605": {
"name": "DeepSeek-V4-Flash 原厂直供",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-pro-202606": {
"name": "DeepSeek-V4-Pro 原厂直供",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
}
}
}
}
}
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tencent Cloud",
"options": {
"baseURL": "https://tokenhub-intl.tencentcloudmaas.com/plan/v3",
"apiKey": "<USER_API_KEY>"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"glm-5.2": {
"name": "GLM-5.2",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"minimax-m3": {
"name": "MiniMax-M3",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"kimi-k2.7-code": {
"name": "Kimi K2.7 Code",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"kimi-k2.7-code-highspeed": {
"name": "Kimi K2.7 Code HighSpeed",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-flash": {
"name": "DeepSeek-V4-Flash",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-pro": {
"name": "DeepSeek-V4-Pro",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-flash-202605": {
"name": "DeepSeek-V4-Flash 原厂直供",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
},
"deepseek-v4-pro-202606": {
"name": "DeepSeek-V4-Pro 原厂直供",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
}
}
}
}
}
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tencent Cloud",
"options": {
"baseURL": "https://tokenhub.tencentcloudmaas.com/plan/v3",
"apiKey": "<USER_API_KEY>"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
}
}
}
}
}
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"myprovider": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tencent Cloud",
"options": {
"baseURL": "https://tokenhub-intl.tencentcloudmaas.com/plan/v3",
"apiKey": "<USER_API_KEY>"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"options": {
"thinking": {
"type": "enabled"
}
}
}
}
}
}
}

使用 OpenCode

执行如下命令启动 OpenCode:
opencode
输入/models,选择配置的模型并在 OpenCode 中使用。



帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈