When to Use
User needs Kimi to work reliably for chat, coding, long-context research, structured outputs, or agent workflows. Agent handles live model verification, request shaping, migration from other OpenAI-compatible providers, and failure recovery before the workflow is trusted.
Architecture
Memory lives in ~/kimi/. If ~/kimi/ does not exist, run setup.md. See memory-template.md for structure.
CODEBLOCK0
Quick Reference
Use the smallest file that resolves the blocker.
| Topic | File |
|---|
| Setup process | INLINECODE4 |
| Memory template |
memory-template.md |
| Minimal request patterns |
api-patterns.md |
| Workload routing choices |
routing-matrix.md |
| OpenAI-compatible migration |
migration-playbook.md |
| Trust and redaction workflows |
safety-workflows.md |
| Fast diagnosis and recovery |
troubleshooting.md |
Requirements
- -
curl and jq for minimal endpoint checks - INLINECODE13 kept in environment variables only
- Kimi access through the official Moonshot API base URL
- User approval before persisting local notes or sanitized logs
Core Rules
1. Verify Auth and Live Models Before Naming Any Route
- - Start with
https://api.moonshot.ai/v1/models and copy live model IDs from the response. - Never trust remembered Kimi model names, screenshots, or stale blog examples when a workflow is failing now.
2. Lock the Job to One Workload Before Tuning Prompts
- - Classify the request as one of: fast chat, coding agent, long-context research, deterministic JSON, or migration debugging.
- Most bad Kimi advice comes from mixing several jobs into one oversized prompt and then blaming the model.
3. Treat Structured Output as a Separate Reliability Path
- - If output feeds tools, code execution, or downstream writes, use strict schemas or a second normalization pass.
- Do not ask one response to do open-ended reasoning and perfect machine-readable output at the same time.
4. Keep Sensitive Data Out Unless the User Explicitly Approves It
- - Redact secrets, customer identifiers, internal hostnames, and raw tokens before sending prompts externally.
- If the user wants repeatable Kimi workflows, save the redaction rule and approval boundary in
~/kimi/approvals.md after confirming the first write.
5. Route by Deadline and Cost, Not Brand Habit
- - Use the smallest Kimi route that can finish the current job reliably.
- For recurring workflows, save one primary route and one fallback route instead of debating models from scratch each time.
6. Separate Provider Migration Problems From Model Problems
- - When moving from OpenAI-compatible code to Kimi, isolate the variable: base URL, auth env var, model ID, parser, or retry policy.
- Reproduce with one minimal payload before changing prompts, infrastructure, and business logic together.
7. Ask Before Creating Persistent State
- - Work statelessly by default.
- Only create
~/kimi/ notes, approvals, or debug logs after the user wants continuity across Kimi tasks.
Common Traps
- - Hardcoding a remembered model ID -> fetch
/models and use the live ID instead. - Treating Kimi as one generic route -> split coding, reasoning, JSON, and migration work.
- Sending raw internal logs to the API -> redact first and preview what leaves the machine.
- Combining creative reasoning with strict JSON output -> use a second deterministic pass.
- Blaming the model for every failure -> verify auth, base URL, retries, and parser behavior first.
External Endpoints
Use only the official Moonshot API surface required for the current task.
| Endpoint | Data Sent | Purpose |
|---|
| https://api.moonshot.ai/v1/models | Auth header only | Discover live Kimi models |
| https://api.moonshot.ai/v1/chat/completions |
Prompt messages and options | Kimi chat, reasoning, coding, and structured-output requests |
No other data is sent externally.
Security & Privacy
Data that leaves your machine:
- - Prompt content sent to the Moonshot API when the user asks for Kimi inference
- Optional sanitized excerpts of code, logs, or documents sent for analysis after approval
Data that stays local:
- - Activation preferences, route defaults, and approval boundaries in
~/kimi/ after user approval - Optional sanitized repro payloads and troubleshooting notes saved for recurring workflows
This skill does NOT:
- - Store
MOONSHOT_API_KEY in markdown or project files - Send data to undeclared endpoints
- Persist raw secrets or sensitive prompts without explicit user approval
- Modify its own skill files
Scope
This skill ONLY:
- - designs and debugs Kimi API workflows
- routes Kimi usage across coding, reasoning, research, and deterministic-output jobs
- hardens retries, validation, and migration from other OpenAI-compatible providers
- stores lightweight local notes only after user approval
This skill NEVER:
- - invent live model availability without checking
- persist secrets in INLINECODE20
- execute destructive downstream automation from unvalidated output
- treat cost-sensitive or sensitive-send boundaries as implicit
Trust
Using this skill sends prompt data to Moonshot's Kimi API.
Only install if you trust Moonshot with that data, or keep sensitive preprocessing local and sanitized.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
api — debug auth, payloads, retries, and OpenAI-compatible request shapes - INLINECODE23 — compare model families and cost tiers before locking Kimi into production
- INLINECODE24 — tighten coding-agent behavior after the Kimi route itself is stable
- INLINECODE25 — connect Kimi workflows to services, jobs, and API boundaries
- INLINECODE26 — expose Kimi-backed endpoints with request validation and safer deployment defaults
Feedback
- - If useful: INLINECODE27
- Stay updated: INLINECODE28
使用时机
当用户需要Kimi可靠地处理聊天、编程、长上下文研究、结构化输出或智能体工作流时使用。在工作流被信任之前,智能体会负责实时模型验证、请求整形、从其他兼容OpenAI的提供商迁移以及故障恢复。
架构
记忆存储在~/kimi/目录中。如果~/kimi/不存在,请运行setup.md。结构请参考memory-template.md。
text
~/kimi/
├── memory.md # 状态、激活规则和稳定默认配置
├── routes.md # 每种工作负载的首选路由
├── approvals.md # 敏感发送边界和脱敏偏好
├── experiments.md # 提示词、解析器和回退方案记录
└── logs/ # 可选的脱敏复现载荷
快速参考
使用能解决问题的最小文件。
memory-template.md |
| 最小请求模式 | api-patterns.md |
| 工作负载路由选择 | routing-matrix.md |
| 兼容OpenAI的迁移 | migration-playbook.md |
| 信任与脱敏工作流 | safety-workflows.md |
| 快速诊断与恢复 | troubleshooting.md |
要求
- - 使用curl和jq进行最小端点检查
- MOONSHOTAPIKEY仅保存在环境变量中
- 通过官方Moonshot API基础URL访问Kimi
- 在持久化本地记录或脱敏日志前需获得用户批准
核心规则
1. 在指定任何路由前先验证认证和实时模型
- - 从https://api.moonshot.ai/v1/models开始,从响应中复制实时模型ID。
- 当工作流当前失败时,绝不信任记忆中的Kimi模型名称、截图或过时的博客示例。
2. 在调整提示词前将任务锁定到单一工作负载
- - 将请求分类为:快速聊天、编程智能体、长上下文研究、确定性JSON或迁移调试。
- 大多数糟糕的Kimi建议来自于将多个任务混合到一个过大的提示词中,然后归咎于模型。
3. 将结构化输出视为独立的可靠性路径
- - 如果输出用于工具、代码执行或下游写入,请使用严格模式或二次规范化处理。
- 不要要求同一个响应同时进行开放式推理和完美的机器可读输出。
4. 除非用户明确批准,否则不发送敏感数据
- - 在外部发送提示词之前,对机密信息、客户标识符、内部主机名和原始令牌进行脱敏处理。
- 如果用户希望实现可重复的Kimi工作流,在确认首次写入后,将脱敏规则和批准边界保存到~/kimi/approvals.md中。
5. 根据截止日期和成本而非品牌习惯选择路由
- - 使用能可靠完成当前任务的最小Kimi路由。
- 对于重复性工作流,保存一个主要路由和一个备用路由,而不是每次都重新讨论模型选择。
6. 将提供商迁移问题与模型问题分开处理
- - 从兼容OpenAI的代码迁移到Kimi时,隔离变量:基础URL、认证环境变量、模型ID、解析器或重试策略。
- 在同时更改提示词、基础设施和业务逻辑之前,先用一个最小载荷进行复现。
7. 在创建持久化状态前先询问
- - 默认以无状态方式工作。
- 只有在用户希望跨Kimi任务保持连续性时,才创建~/kimi/记录、批准或调试日志。
常见陷阱
- - 硬编码记忆中的模型ID -> 改为从/models获取并使用实时ID
- 将Kimi视为单一通用路由 -> 将编程、推理、JSON和迁移工作分开处理
- 将原始内部日志发送到API -> 先脱敏并预览离开机器的内容
- 将创造性推理与严格JSON输出结合 -> 使用二次确定性处理
- 将所有失败归咎于模型 -> 先验证认证、基础URL、重试和解析器行为
外部端点
仅使用当前任务所需的官方Moonshot API接口。
| 端点 | 发送的数据 | 用途 |
|---|
| https://api.moonshot.ai/v1/models | 仅认证头 | 发现实时Kimi模型 |
| https://api.moonshot.ai/v1/chat/completions |
提示消息和选项 | Kimi聊天、推理、编程和结构化输出请求 |
不发送其他外部数据。
安全与隐私
离开您机器的数据:
- - 当用户请求Kimi推理时发送到Moonshot API的提示内容
- 经批准后发送用于分析的可选脱敏代码、日志或文档摘录
保留在本地数据:
- - 经用户批准后保存在~/kimi/中的激活偏好、路由默认值和批准边界
- 为重复性工作流保存的可选脱敏复现载荷和故障排除记录
此技能不会:
- - 将MOONSHOTAPIKEY存储在markdown或项目文件中
- 向未声明的端点发送数据
- 未经用户明确批准持久化原始机密或敏感提示词
- 修改自身的技能文件
范围
此技能仅:
- - 设计和调试Kimi API工作流
- 在编程、推理、研究和确定性输出任务之间路由Kimi使用
- 强化重试、验证以及从其他兼容OpenAI的提供商迁移
- 仅在用户批准后存储轻量级本地记录
此技能绝不:
- - 未经检查就虚构实时模型可用性
- 在~/kimi/中持久化机密信息
- 基于未验证的输出执行破坏性下游自动化
- 将成本敏感或敏感发送边界视为隐式默认
信任
使用此技能会将提示数据发送到Moonshot的Kimi API。
仅当您信任Moonshot处理这些数据时才安装,或者将敏感预处理保留在本地并进行脱敏处理。
相关技能
如果用户确认,使用clawhub install
安装:
- - api — 调试认证、载荷、重试和兼容OpenAI的请求格式
- models — 在将Kimi锁定到生产环境前比较模型系列和成本层级
- coding — 在Kimi路由本身稳定后收紧编程智能体行为
- backend — 将Kimi工作流连接到服务、作业和API边界
- fastapi — 通过请求验证和更安全的部署默认值暴露Kimi后端端点
反馈
- - 如果有用:clawhub star kimi
- 保持更新:clawhub sync