Kimi(Moonshot AI) (Archive)
Archived original-language source from the legacy CrabClaw docs. This page is intentionally not machine-translated.
Moonshot AI 是 Kimi 系列模型的开发者,提供长上下文对话和代码生成能力。Kimi K2 是最新旗舰模型,基于 MoE 架构,在代码、推理和多语言任务上表现优秀。
模型概览
| 模型 | 类型 | 上下文窗口 | 特点 |
|---|---|---|---|
moonshot-v1-8k | 通用对话 | 8K | 快速响应,日常任务 |
moonshot-v1-32k | 长上下文 | 32K | 文档分析、长文理解 |
moonshot-v1-128k | 超长上下文 | 128K | 超长文本处理 |
kimi-k2 | 旗舰 | 128K | MoE 架构,最强综合能力 |
方式 A:Moonshot API Key
适用场景: 直接 API 访问,按量计费。
从 Moonshot 开放平台 获取 API Key。
CLI 设置
crabclaw onboard --auth-choice moonshot-api-key
# 或非交互模式
crabclaw onboard --moonshot-api-key "$MOONSHOT_API_KEY"crabclaw onboard --auth-choice moonshot-api-key
# 或非交互模式
crabclaw onboard --moonshot-api-key "$MOONSHOT_API_KEY"配置示例
{
env: { MOONSHOT_API_KEY: "sk-..." },
agents: { defaults: { model: { primary: "moonshot/kimi-k2" } } },
models: {
mode: "merge",
providers: {
moonshot: {
baseUrl: "https://api.moonshot.cn/v1",
apiKey: "${MOONSHOT_API_KEY}",
api: "openai-completions",
models: [
{
id: "kimi-k2",
name: "Kimi K2",
reasoning: true,
input: ["text"],
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "moonshot-v1-128k",
name: "Moonshot V1 128K",
reasoning: false,
input: ["text"],
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "moonshot-v1-32k",
name: "Moonshot V1 32K",
reasoning: false,
input: ["text"],
contextWindow: 32768,
maxTokens: 8192,
},
{
id: "moonshot-v1-8k",
name: "Moonshot V1 8K",
reasoning: false,
input: ["text"],
contextWindow: 8192,
maxTokens: 4096,
},
],
},
},
},
}{
env: { MOONSHOT_API_KEY: "sk-..." },
agents: { defaults: { model: { primary: "moonshot/kimi-k2" } } },
models: {
mode: "merge",
providers: {
moonshot: {
baseUrl: "https://api.moonshot.cn/v1",
apiKey: "${MOONSHOT_API_KEY}",
api: "openai-completions",
models: [
{
id: "kimi-k2",
name: "Kimi K2",
reasoning: true,
input: ["text"],
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "moonshot-v1-128k",
name: "Moonshot V1 128K",
reasoning: false,
input: ["text"],
contextWindow: 131072,
maxTokens: 8192,
},
{
id: "moonshot-v1-32k",
name: "Moonshot V1 32K",
reasoning: false,
input: ["text"],
contextWindow: 32768,
maxTokens: 8192,
},
{
id: "moonshot-v1-8k",
name: "Moonshot V1 8K",
reasoning: false,
input: ["text"],
contextWindow: 8192,
maxTokens: 4096,
},
],
},
},
},
}Kimi 作为回退
{
env: { MOONSHOT_API_KEY: "sk-..." },
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-6": { alias: "opus" },
"moonshot/kimi-k2": { alias: "kimi" },
},
model: {
primary: "anthropic/claude-opus-4-6",
fallbacks: ["moonshot/kimi-k2"],
},
},
},
}{
env: { MOONSHOT_API_KEY: "sk-..." },
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-6": { alias: "opus" },
"moonshot/kimi-k2": { alias: "kimi" },
},
model: {
primary: "anthropic/claude-opus-4-6",
fallbacks: ["moonshot/kimi-k2"],
},
},
},
}注意事项
- 模型引用格式为
moonshot/<model>。 - Moonshot API 兼容 OpenAI 格式,使用
openai-completionsAPI 类型。 - Kimi K2 支持推理模式,设置
reasoning: true。 - 参见 模型供应商概念 了解供应商规则。
- 使用
crabclaw models list和crabclaw models set moonshot/kimi-k2切换模型。