VS Code Copilot(BYOK)
VS Code 内置的 GitHub Copilot Chat 支持通过 BYOK(Bring Your Own Key,自带 Key) 功能接入任意 OpenAI / Anthropic 兼容端点。您可以将学校的大模型配置为 VS Code 中的聊天模型,无需 GitHub Copilot 订阅也可使用聊天与 Agent 能力。
注意:代码补全(inline suggestions)、语义搜索等依赖 GitHub Copilot 服务的功能仍需 Copilot 订阅,BYOK 仅覆盖聊天与 Agent 会话。
通过界面添加模型
- 在 VS Code 中打开命令面板(
Ctrl+Shift+P/Cmd+Shift+P),运行 Chat: Manage Language Models。 - 在打开的 Language Models 编辑器中点击 Add Models,选择 Custom Endpoint。
- 输入分组名称(如
ChatECNU)与 API Key(您的我的令牌)。API Key 会由 VS Code 保存在本机密钥库中,并在配置中生成${input:xxx}形式的引用。 - 选择 API 类型:Responses(对应
/open/api/v1的 Responses 兼容端点)。 - 保存后 VS Code 会打开
chatLanguageModels.json,按下文配置模型即可。
配置文件示例(chatLanguageModels.json)
json
[
{
"name": "ChatECNU",
"vendor": "customendpoint",
"apiKey": "${input:chatecnu-api-key}",
"apiType": "responses",
"models": [
{
"id": "ecnu-plus",
"name": "ecnu-plus",
"url": "https://chat.ecnu.edu.cn/open/api/v1",
"toolCalling": true,
"vision": true,
"maxInputTokens": 256000,
"maxOutputTokens": 32000
},
{
"id": "ecnu-max",
"name": "ecnu-max",
"url": "https://chat.ecnu.edu.cn/open/api/v1",
"toolCalling": true,
"vision": false,
"streaming": true,
"thinking": true,
"supportsReasoningEffort": [
"none",
"low",
"high",
"max"
],
"reasoningEffortFormat": "responses",
"maxInputTokens": 1000000,
"maxOutputTokens": 384000
}
],
"settings": {
"ecnu-max": {
"reasoningEffort": "low"
}
}
}
]配置说明
| 字段 | 说明 |
|---|---|
vendor | 固定为 customendpoint,表示自定义端点 |
apiType | 接口协议类型。responses 对应平台 Responses 兼容端点;也支持 messages(对应 /open/api/anthropic)或 chat-completions |
url | 端点地址。以 /v1 结尾时,VS Code 会自动按 apiType 附加路径(如 responses → .../v1/responses),无需手写完整路径 |
toolCalling | 模型是否支持工具调用,两个主模型均开启 |
vision | 是否支持图片输入,ecnu-plus 支持、ecnu-max 不支持 |
thinking | 是否支持思考模式,ecnu-max 支持 |
supportsReasoningEffort | 模型可用的思考强度档位。none 关闭思考;low / high / max 对应 ecnu-max 档位,服务端映射规则详见 思考模式 |
reasoningEffortFormat | 思考强度的请求格式。responses 对应 reasoning.effort 嵌套对象;messages 对应 output_config.effort;chat-completions 对应顶层 reasoning_effort |
maxInputTokens / maxOutputTokens | 上下文窗口与最大输出长度,参考 模型介绍 |
settings | 可选,设置默认思考强度(如上例为 ecnu-max 默认 low),也可在模型选择器中随时调整 |
注意:
maxInputTokens与maxOutputTokens之和不应超过模型上下文窗口(ecnu-max为 1M、ecnu-plus为 256K),否则模型选择器中上下文用量显示可能超窗。
配置思考强度
配置完成后,在聊天输入框的模型选择器中:
- 选择
ecnu-max; - 点击模型名旁的箭头(
>)打开 Thinking Effort 子菜单; - 选择思考强度(None 关闭 / Low / High / Max)。
您的请求将按 credits 配额统一处理,详见 配额限制。