Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Kimi for Copilot Chat

在 GitHub Copilot Chat 中直接使用 Kimi(月之暗面 Moonshot AI) 作为底层模型。保留 Copilot 全部工具能力(文件读写、终端命令、代码搜索等),底层大脑替换为 Kimi API。

🎯 核心特性

  • 原生集成:Kimi 模型直接出现在 Copilot Chat 的模型选择器中,无需额外命令
  • 保留全部工具:Copilot 的 Agent 工具(文件操作、终端、搜索、代码补全等)全部可用
  • 流式输出:实时 SSE 流式响应,打字机效果
  • 多模型支持:8K / 32K / 128K 上下文三档可选
  • BYOK:自带 API Key,密钥优先存储在 VS Code SecretStorage
  • 视觉代理:图片附件可先由 VS Code 视觉模型描述,再转为文本发给 Kimi
  • 请求分类:区分主聊天、Agent、标题生成、进度文案、终端通知等 Copilot 辅助请求
  • 请求诊断:可开启 debug dump 查看最终发送给 Kimi API 的 JSON

📦 安装

方式一:VSIX 文件安装

  1. 从 Releases 下载最新 .vsix 文件
  2. 打开 VS Code → 扩展面板(Cmd+Shift+X)
  3. 点击右上角 ... → 从 VSIX 安装...
  4. 选择下载的 .vsix 文件

方式二:源码编译

git clone https://github.com/binhanchen25-arch/vscode-copilot-kimi-plugin.git
cd vscode-copilot-kimi-plugin
npm install
npm run compile
# 按 F5 启动调试

🔑 配置 Kimi API Key

1. 获取 API Key

前往 Moonshot AI 开放平台 注册并获取 API Key。

2. 设置 API Key(任选一种)

方式 操作
命令面板 Cmd+Shift+P → 搜索 Kimi: 设置 API Key
设置页面 Cmd+, → 搜索 copilotKimi.apiKey(仅作为 fallback)
settings.json 添加 "copilotKimi.apiKey": "sk-xxx..."(不推荐,可能明文落盘)

推荐使用命令面板设置 API Key。插件会保存到 VS Code SecretStorage;旧的 settings.json 配置仍会作为兼容 fallback 读取。

🚀 使用方式

1. 打开 Copilot Chat

Cmd+Shift+I(Mac)/ Ctrl+Shift+I(Windows)

2. 选择 Kimi 模型

点击 Chat 面板底部的模型选择器,在下拉菜单中即可看到:

┌─────────────────────────┐
│  ○ GPT-4o              │
│  ○ Claude 3.5 Sonnet   │
│  ○ Kimi K3             │
│  ○ Kimi K2.7 Code      │
│  ○ Moonshot v1 32K     │
└─────────────────────────┘

3. 开始对话

就像使用 Copilot 一样正常对话,Kimi 会:

  • 回答技术问题
  • 阅读你的代码文件
  • 执行终端命令
  • 搜索工作区
  • 帮你写代码、改 bug、重构

💡 提示:所有 Copilot 的 Agent 工具(#file、@workspace、/fix、/explain 等)都能正常使用,它们会被自动转发给 Kimi API。

插件会对 Copilot 的内部请求做分类处理。普通主聊天和 Agent 请求会保留工具/视觉能力,并在用户询问模型名称或版本时注入当前 modelInfo.id 的窄提示;标题生成、进度文案、设置解析等后台辅助请求不会注入身份提示,避免污染 Copilot 内部流程。

⚙️ 配置选项

设置项 默认值 说明
copilotKimi.apiKey - Kimi API Key
copilotKimi.baseUrl https://api.moonshot.cn/v1 API 地址(支持代理)
copilotKimi.temperature 1 生成温度固定为 1(当前 Kimi/Moonshot 模型要求)
copilotKimi.maxTokens 0 最大输出 token 数,0 表示使用 API 默认值
copilotKimi.modelIdOverrides {} 将 VS Code 模型 ID 映射到实际 API 模型 ID
copilotKimi.visionModel - 用于图片描述的 VS Code 视觉模型,留空则自动选择
copilotKimi.visionPrompt 内置提示词 视觉代理描述图片附件时使用
copilotKimi.debugMode minimal metadata 输出概要日志,verbose 写完整请求 dump

🧰 调试与视觉

  • 运行 Kimi: 显示日志 查看扩展输出。
  • 将 copilotKimi.debugMode 设为 verbose 后,可运行 Kimi: 打开请求 Dump 目录 查看 provider 输入和最终 Kimi 请求 JSON。
  • 图片附件不会直接发送给 Kimi;插件会调用本机可用的 VS Code 视觉模型生成描述,再把描述文本放入 Kimi 请求。
  • 如果没有可用视觉模型,插件会插入明确的图片不可解析标记,避免静默丢图。

🤖 可用模型

模型 上下文 说明
Kimi K3 128K K3,插件对该模型发送 reasoning_effort=max
Kimi K2.7 Code 128K 代码任务模型
Kimi K2.7 Code (高速) 128K 高速代码任务模型
Kimi K2.6 128K K2.6 通用模型
Moonshot v1 8K 8K 经典 v1 小上下文模型
Moonshot v1 32K 32K 经典 v1 中上下文模型
Moonshot v1 128K 128K 经典 v1 长上下文模型

💰 费用

本插件免费开源。Kimi API 按用量收费,具体参考 Moonshot 官方定价。

🛠️ 开发

# 安装依赖
npm install

# 编译
npm run compile

# 监听模式(开发时推荐)
npm run watch

# 打包 .vsix
npx vsce package

📄 许可

MIT License

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages