返回文档列表Back to docs

Cursor 接入 Kimi 长上下文 APIConnecting Cursor to the Kimi Long-Context API

利用 Kimi 200K+ 上下文窗口,在 Cursor 中实现大代码库全局理解和跨文件分析。Leverage Kimi's 200K+ context window for whole-codebase understanding and cross-file analysis in Cursor.

CursorKimi / 月之暗面中等Medium超过 128 天未复核,建议重新确认

关键配置(点击复制)

Base URL
https://api.moonshot.cn/v1
Model
moonshot-v1-128k
认证方式
Bearer <API_KEY>

Cursor 接入 Kimi 长上下文 API

适合谁

  • 需要在大型代码库中进行全局理解和跨文件分析
  • 希望保留 Cursor 编辑体验同时利用超长上下文
  • 经常需要一次性处理大量代码上下文

准备内容

  • 已注册 Cursor 账号
  • 已注册月之暗面开放平台并获取 API Key
  • 了解 Kimi API 的模型 ID

关键配置

  • Base URL:https://api.moonshot.cn/v1
  • Model:moonshot-v1-128k(根据需求选择 8k/32k/128k 版本)
  • 认证方式:Bearer <API_KEY>

配置步骤

  1. 打开 Cursor 设置中的 OpenAI-compatible 配置入口。
  2. 把 Base URL 指向月之暗面 API 接口。
  3. 填入 API Key,并把默认模型设为 moonshot-v1-128k。
  4. 用一个中等规模的仓库测试跨文件问答和代码理解能力。

常见问题

  • 如果响应较慢,尝试使用更短上下文版本(moonshot-v1-32k)降低成本。
  • 如果提示 token 超限,检查是否发送了过大的代码上下文。
  • 如果兼容性报错,确认 Cursor 版本支持自定义 OpenAI-compatible 端点。

成本提醒

Kimi API 因上下文长度较长,单次调用成本略高于普通 API。建议优先在需要全局理解的大代码库场景使用,日常补全可配合其他低成本方案。月成本通常在 ¥80-150/月。

CreditsPlan 是 AI 服务的智能选型与购买决策引擎。CreditsPlan helps you choose AI services, compare tools, plans, prices and purchase options, and find the right solution for your needs.

Find the right AI. Pick the right plan. Pay the right price.