Kimi AI 与 Kimi Code 集成指南 - Openclaw Skills
作者:互联网
2026-03-21
什么是 Kimi AI 与 Kimi Code 集成?
Kimi 集成技能允许开发者将 Moonshot AI 和 Kimi Code 模型无缝整合到其本地 AI 代理生态系统中。通过利用此集成,用户可以访问以 200,000 标记的大规模上下文窗口和在编程任务中表现卓越而闻名的强大 LLM。此 Openclaw Skills 设置通过弥合 Moonshot 基础设施与本地工作区之间的差距,确保您的编码代理能够轻松处理大规模文件分析和复杂的重构。
下载入口:https://github.com/openclaw/skills/tree/main/skills/evgyur/kimi-integration
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install kimi-integration
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 kimi-integration。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Kimi AI 与 Kimi Code 集成 应用场景
- 分析需要 200K 标记上下文窗口的大规模代码库。
- 利用专业的 Kimi Code 模型进行高精度的代码生成和调试。
- 在单一的 Openclaw Skills 管理界面下整合多个 LLM 供应商。
- 通过简单的别名在通用推理(Kimi K2.5)和专业编码模型之间切换。
- 从 Moonshot AI 平台和专用的 Kimi Code 门户获取 API 密钥。
- 配置本地环境变量以安全地存储身份验证凭据。
- 在配置文件中定义供应商设置,指定基础 URL 和模型 ID。
- 重启代理网关以初始化与 Moonshot OpenAI 兼容端点的连接。
- 验证模型可用性并设置别名,以便在活动开发阶段进行快速切换。
Kimi AI 与 Kimi Code 集成 配置指南
首先,将您的 API 密钥导出为环境变量:
export MOONSHOT_API_KEY="sk-your-moonshot-key"
export KIMICODE_API_KEY="sk-your-kimicode-key"
更新您的 clawdbot.json 配置以包含 Kimi 供应商:
{
"models": {
"providers": {
"moonshot": {
"baseUrl": "https://api.moonshot.cn/v1",
"apiKey": "${MOONSHOT_API_KEY}",
"api": "openai-completions",
"models": [{ "id": "kimi-k2.5", "name": "Kimi K2.5", "contextWindow": 200000 }]
}
}
}
}
最后,重启网关以在 Openclaw Skills 框架内应用更改:
clawdbot gateway restart
clawdbot models list
Kimi AI 与 Kimi Code 集成 数据架构与分类体系
| 元素 | 属性 | 描述 |
|---|---|---|
| 供应商 | baseUrl |
特定的 API 端点(Moonshot 或 Kimi Code) |
| 模型 | id |
模型版本的唯一标识符(例如 kimi-k2.5) |
| 模型 | contextWindow |
模型支持的标记限制(最高 200,000) |
| 代理 | alias |
用于快速切换模型的简短名称(例如 'kimi') |
name: kimi-integration
description: Step-by-step guide for integrating Moonshot AI (Kimi) and Kimi Code models into Clawdbot. Use when someone asks how to add Kimi models, configure Moonshot AI, or set up Kimi for Coding in Clawdbot.
Kimi Model Integration
Complete guide for adding Moonshot AI (Kimi) and Kimi Code models to Clawdbot.
Overview
Kimi offers two separate model families:
- Moonshot AI (Kimi K2) - General-purpose models via OpenAI-compatible API
- Kimi Code - Specialized coding model with dedicated endpoint
Both require API keys from different sources.
Prerequisites
- Clawdbot installed and configured
- API keys (see Getting API Keys section)
Getting API Keys
Moonshot AI (Kimi K2)
- Visit https://platform.moonshot.cn
- Register an account
- Navigate to API Keys section
- Create a new API key
- Copy the key (starts with
sk-...)
Kimi Code
- Visit https://api.kimi.com/coding
- Register an account
- Navigate to API Keys section
- Create a new API key
- Copy the key (starts with
sk-...)
Note: Moonshot and Kimi Code use separate keys and endpoints.
Integration Steps
Option 1: Moonshot AI (Kimi K2 models)
Step 1: Set environment variable
export MOONSHOT_API_KEY="sk-your-moonshot-key-here"
Or add to .env file:
echo 'MOONSHOT_API_KEY="sk-your-moonshot-key-here"' >> ~/.env
Step 2: Add provider configuration
Edit your clawdbot.json config:
{
"agents": {
"defaults": {
"model": {
"primary": "moonshot/kimi-k2.5"
}
}
},
"models": {
"mode": "merge",
"providers": {
"moonshot": {
"baseUrl": "https://api.moonshot.cn/v1",
"apiKey": "${MOONSHOT_API_KEY}",
"api": "openai-completions",
"models": [
{
"id": "moonlight-v1-32k",
"name": "Moonlight V1 32K",
"contextWindow": 32768
},
{
"id": "moonshot-v1-8k",
"name": "Moonshot V1 8K",
"contextWindow": 8192
},
{
"id": "moonshot-v1-32k",
"name": "Moonshot V1 32K",
"contextWindow": 32768
},
{
"id": "moonshot-v1-128k",
"name": "Moonshot V1 128K",
"contextWindow": 131072
},
{
"id": "kimi-k2.5",
"name": "Kimi K2.5",
"contextWindow": 200000
}
]
}
}
}
}
Step 3: Restart Clawdbot
clawdbot gateway restart
Step 4: Verify integration
clawdbot models list
You should see Moonshot models in the list.
Step 5: Use the model
Set as default:
clawdbot models set moonshot/kimi-k2.5
Or use model aliases in chat:
/model moonshot/kimi-k2.5
Option 2: Kimi Code (specialized coding model)
Step 1: Set environment variable
export KIMICODE_API_KEY="sk-your-kimicode-key-here"
Or add to .env:
echo 'KIMICODE_API_KEY="sk-your-kimicode-key-here"' >> ~/.env
Step 2: Add provider configuration
Edit your clawdbot.json config:
{
"agents": {
"defaults": {
"model": {
"primary": "kimicode/kimi-for-coding"
},
"models": {
"kimicode/kimi-for-coding": {
"alias": "kimi"
}
}
}
},
"models": {
"mode": "merge",
"providers": {
"kimicode": {
"baseUrl": "https://api.kimi.com/coding/v1",
"apiKey": "${KIMICODE_API_KEY}",
"api": "openai-completions",
"models": [
{
"id": "kimi-for-coding",
"name": "Kimi For Coding",
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
}
Step 3: Restart Clawdbot
clawdbot gateway restart
Step 4: Verify integration
clawdbot models list
You should see kimicode/kimi-for-coding in the list.
Step 5: Use the model
Set as default:
clawdbot models set kimicode/kimi-for-coding
Or use model alias in chat:
/model kimi
Using Both Providers
You can configure both Moonshot and Kimi Code simultaneously:
{
"agents": {
"defaults": {
"model": {
"primary": "moonshot/kimi-k2.5"
},
"models": {
"kimicode/kimi-for-coding": {
"alias": "kimi"
},
"moonshot/kimi-k2.5": {
"alias": "k25"
}
}
}
},
"models": {
"mode": "merge",
"providers": {
"moonshot": {
"baseUrl": "https://api.moonshot.cn/v1",
"apiKey": "${MOONSHOT_API_KEY}",
"api": "openai-completions",
"models": [
{ "id": "kimi-k2.5", "name": "Kimi K2.5", "contextWindow": 200000 }
]
},
"kimicode": {
"baseUrl": "https://api.kimi.com/coding/v1",
"apiKey": "${KIMICODE_API_KEY}",
"api": "openai-completions",
"models": [
{ "id": "kimi-for-coding", "name": "Kimi For Coding", "contextWindow": 200000 }
]
}
}
}
}
Switch between models using aliases:
/model k25- Kimi K2.5 (general)/model kimi- Kimi for Coding (specialized)
Troubleshooting
Model not appearing in list
Check config syntax:
clawdbot gateway config.get | grep -A 20 moonshot
Verify API key is set:
echo $MOONSHOT_API_KEY
echo $KIMICODE_API_KEY
Authentication errors
- Verify API key starts with
sk- - Check key is valid on provider dashboard
- Ensure correct base URL for each provider
Connection issues
Test API endpoint directly:
curl -X POST "https://api.moonshot.cn/v1/chat/completions" r
-H "Authorization: Bearer $MOONSHOT_API_KEY" r
-H "Content-Type: application/json" r
-d '{"model": "kimi-k2.5", "messages": [{"role": "user", "content": "test"}]}'
Model Recommendations
- Kimi K2.5 (
moonshot/kimi-k2.5) - Best for general tasks, 200K context - Kimi for Coding (
kimicode/kimi-for-coding) - Specialized for code generation - Moonshot V1 128K (
moonshot/moonshot-v1-128k) - Legacy model, 128K context
References
- Moonshot AI Docs: https://platform.moonshot.cn/docs
- Kimi Code API: https://api.kimi.com/coding/docs
- Clawdbot Model Providers: /home/eyurc/clawdbot/docs/concepts/model-providers.md
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
