跳转到主要内容
GitHub Copilot Chat 支持通过 Custom Endpoint 添加自定义模型。接入 LLMEasy 时,请使用 GPT 分组 API Key,并选择 Chat Completions
本文配置的是 VS Code 中 GitHub Copilot Chat 的自定义语言模型。它不会替换 GitHub Copilot 的行内代码补全服务。

前置条件

  • 已安装最新版 VS Code
  • 已安装并登录 GitHub Copilot / Copilot Chat
  • 已获取 LLMEasy API Key(注册并获取
  • API Key 属于 GPT 分组
  • 已确认要使用的模型 ID,例如 gpt-5.5
不要把真实 API Key 手动写进 chatLanguageModels.json。请在 VS Code 弹出的 API Key 输入框中粘贴 Key,VS Code 会自动生成 ${input:chat.lm.secret...} 这种本机密钥引用。

配置步骤

1

打开模型管理入口

在 Copilot Chat 输入框下方,点击模型选择器,然后选择 Manage Models…
在 Copilot Chat 模型选择器中点击 Manage Models。
2

添加 Custom Endpoint

Language Models 界面中,点击 Add Models,然后选择 Custom Endpoint
在 Language Models 界面中点击 Add Models 并选择 Custom Endpoint。
3

输入名称

Group Name 输入框中填写:
然后按 Enter
在 Group Name 输入框中填写 LLMEasy。
4

输入 API Key

接下来 VS Code 会要求输入 API Key。粘贴你的 LLMEasy API Key,然后按 Enter这一步不会显示在配置文件里。VS Code 会把 API Key 保存成本机 secret,并在 JSON 中生成类似下面的引用:
不要把 ${input:chat.lm.secret...} 改成真实 API Key。保持 VS Code 自动生成的 secret 引用即可。
5

选择 API 类型

Custom Endpoint: API Type 中选择 Chat Completions
在 Custom Endpoint API Type 中选择 Chat Completions。
6

编辑 JSON 配置

VS Code 会打开 chatLanguageModels.json。确认或修改配置为下面结构:
在 chatLanguageModels.json 中配置 LLMEasy 模型 URL、toolCalling、vision 和 token 上限。
你需要重点确认:
字段推荐值
nameLLMEasy
apiTypechat-completions
idgpt-5.5模型广场中的 GPT 分组模型 ID
name与模型 ID 保持一致
urlhttps://www.llmeasy.ru/v1/chat/completions
toolCallingtrue
visiontrue
maxInputTokens1000000
maxOutputTokens64000
7

保存并重新加载 VS Code

保存 chatLanguageModels.json 后,执行:
重新加载后,回到 Copilot Chat 的模型选择器,选择 gpt-5.5
8

发送测试消息

在 Copilot Chat 中发送一条简单消息,例如:
如果能够正常回复,说明 LLMEasy Custom Endpoint 已配置成功。

常见问题

为什么必须在弹窗里输入 API Key?

VS Code 会把 API Key 保存到本机 secret 存储中,并在 JSON 里使用 ${input:chat.lm.secret...} 引用它。这样比把真实 API Key 写进 JSON 更安全。

为什么选择 Chat Completions?

本次验证成功的配置使用的是 Chat Completions。对应 URL 是:
不要把它写成 /v1/responses,也不要只写到 /v1

这个配置会影响 GitHub Copilot 自动补全吗?

不会。这个 Custom Endpoint 主要用于 Copilot Chat 的语言模型调用。GitHub Copilot 的行内自动补全仍由 GitHub Copilot 自身服务提供。

报 Invalid token 怎么办?

如果出现 Invalid token,按顺序检查:
  1. API Key 是否是在 VS Code 弹窗中输入的
  2. JSON 里是否保留 ${input:chat.lm.secret...}
  3. API Key 是否属于 GPT 分组
  4. url 是否为 https://www.llmeasy.ru/v1/chat/completions
  5. apiType 是否为 chat-completions
  6. 模型 ID 是否为模型广场中的 GPT 分组模型