← 返回 Skills 市场
jack-yang-ai

Kimi Code API

作者 Jack-Yang-ai · GitHub ↗ · v2.0.0 · MIT-0
cross-platform ✓ 安全检测通过
197
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install kimi-code-api
功能描述
One-click setup to use Kimi K2.5 (Kimi Code) as your coding model in OpenClaw and Claude Code CLI. Kimi Code is Anthropic Messages API compatible — swap the...
使用说明 (SKILL.md)

Kimi Code API — OpenClaw + Claude Code Integration

Kimi Code (K2.5) is Anthropic Messages API compatible. One config change and your OpenClaw runs Claude Code on Kimi's backend.

Quick Start: Get Your API Key

  1. Open Kimi Code Console
  2. Create an API Key → format: sk-kimi-...

Setup 1: OpenClaw — Add Kimi as a Provider + Model

Add to your openclaw.json under providers and models:

// In providers:
{
  "id": "kimi",
  "type": "anthropic",          // Kimi speaks Anthropic protocol
  "baseUrl": "https://api.kimi.com/coding",
  "apiKey": "sk-kimi-..."
}

// In models (or agents.defaults.models):
{
  "kimi/kimi-k2.5": {
    "alias": "Kimi K2.5",
    "params": {}
  }
}

Then use it anywhere in OpenClaw:

  • Set as agent model: "model": "kimi/kimi-k2.5"
  • Switch in chat: /model kimi/kimi-k2.5
  • Use as default for a specific agent

Setup 2: Claude Code CLI — Direct

export ANTHROPIC_BASE_URL="https://api.kimi.com/coding"
export ANTHROPIC_API_KEY="sk-kimi-..."

# Interactive
claude

# One-shot
claude --print "Refactor this function to use async/await"

Claude Code auto-appends /v1/messages to the base URL. No other changes needed.

Setup 3: OpenClaw Spawns Claude Code with Kimi

In OpenClaw, spawn a Claude Code (ACP) session that uses Kimi as the backend:

# In your agent config or via sessions_spawn:
sessions_spawn(
    runtime="acp",
    task="Your coding task here",
    env={
        "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding",
        "ANTHROPIC_API_KEY": "sk-kimi-..."
    }
)

Or configure it globally in openclaw.json so every ACP spawn uses Kimi by default.

API Reference

Property Value
Base URL https://api.kimi.com/coding
Messages endpoint https://api.kimi.com/coding/v1/messages
Auth header x-api-key: sk-kimi-...
Version header anthropic-version: 2023-06-01
Model (request) kimi-k2.5
Model (response) kimi-for-coding
Protocol Anthropic Messages API
Streaming "stream": true → SSE

Raw Call Examples

curl

curl -s https://api.kimi.com/coding/v1/messages \
  -H "x-api-key: sk-kimi-..." \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"kimi-k2.5","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'

Python (no dependencies)

import json, urllib.request

req = urllib.request.Request(
    "https://api.kimi.com/coding/v1/messages",
    data=json.dumps({
        "model": "kimi-k2.5",
        "max_tokens": 4096,
        "messages": [{"role": "user", "content": "Hello"}]
    }).encode(),
    headers={
        "Content-Type": "application/json",
        "x-api-key": "sk-kimi-...",
        "anthropic-version": "2023-06-01",
    },
)
with urllib.request.urlopen(req, timeout=120) as resp:
    print(json.loads(resp.read())["content"][0]["text"])

Gotchas

  • Model name mismatch: Request sends kimi-k2.5, response returns kimi-for-coding. Don't assert on the response model field.
  • Anthropic format only: /v1/messages works. /v1/chat/completions (OpenAI format) returns 404.
  • api.moonshot.cn ≠ Kimi Code: That's the general Moonshot API — different product, different auth.
  • Timeout: Set ≥120s for complex prompts.
  • Provider type: Always "type": "anthropic" in OpenClaw config — Kimi speaks Anthropic, not OpenAI.
安全使用建议
This skill is an integration guide — it won't install code. Before using: (1) verify the domain (https://api.kimi.com/coding) is the official Kimi endpoint and that the service is trusted; (2) create and use a dedicated Kimi API key (do not reuse other provider keys), limit its scope if possible, and rotate/revoke it when not needed; (3) prefer exporting the key as an environment variable or using a secrets manager rather than embedding it in openclaw.json (which may store secrets in plaintext); (4) test with non-sensitive prompts first and confirm responses come from the expected service; and (5) if anything in your environment already assumes Anthropic endpoints, double-check you are not unintentionally routing other workloads to the Kimi endpoint.
功能分析
Type: OpenClaw Skill Name: kimi-code-api Version: 2.0.0 The skill bundle is a configuration guide and integration helper for using the Kimi K2.5 (Kimi Code) API within OpenClaw and Claude Code CLI. It contains only documentation, configuration examples, and standard API call snippets (Python/curl) pointing to legitimate endpoints (api.kimi.com). No malicious code, data exfiltration, or harmful prompt injection instructions were found in SKILL.md or references/SKILL_CN.md.
能力评估
Purpose & Capability
The name/description match the instructions (how to configure OpenClaw and Claude Code to point at a Kimi Anthropic-compatible endpoint). Minor mismatch: marketing text says "one-click setup" but the SKILL.md provides manual config snippets and environment-variable examples rather than an automated installer.
Instruction Scope
SKILL.md only instructs the agent/user to set base URL and API key fields in OpenClaw config or export ANTHROPIC_* env vars and to call the Kimi API endpoints; it does not instruct reading unrelated system files, exfiltrating data, or contacting unexpected endpoints.
Install Mechanism
This is instruction-only (no install spec, no downloads, no code files). There is nothing written to disk or installed by the skill itself.
Credentials
The skill declares no required environment variables, which is consistent for an instruction-only guide. The runtime examples do ask users to provide ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY — expected and proportionate for an API integration. One thing to note: examples show placing the API key in openclaw.json (config file) which may persist secrets in plaintext; using environment variables or a secrets manager is safer.
Persistence & Privilege
The skill is not always-enabled, does not request elevated privileges, and contains no installation steps that modify other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install kimi-code-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /kimi-code-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.0
v2.0: Complete rewrite. Core focus: one-click OpenClaw + Claude Code integration with Kimi K2.5. Three setup paths: OpenClaw provider config, Claude Code CLI env vars, ACP spawn with Kimi backend. CN + EN dual docs.
v1.1.0
v1.1: Credentials link updated to kimi.com/code/console. Removed fallback from config pattern (#5), now generic LLM config. Added Chinese version (references/SKILL_CN.md).
v1.0.0
Initial release: Kimi K2.5 as Anthropic Messages API drop-in backend. Includes Claude Code CLI, Python, curl, and OpenClaw integration patterns.
元数据
Slug kimi-code-api
版本 2.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Kimi Code API 是什么?

One-click setup to use Kimi K2.5 (Kimi Code) as your coding model in OpenClaw and Claude Code CLI. Kimi Code is Anthropic Messages API compatible — swap the... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 197 次。

如何安装 Kimi Code API?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install kimi-code-api」即可一键安装,无需额外配置。

Kimi Code API 是免费的吗?

是的,Kimi Code API 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Kimi Code API 支持哪些平台?

Kimi Code API 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Kimi Code API?

由 Jack-Yang-ai(@jack-yang-ai)开发并维护,当前版本 v2.0.0。

💬 留言讨论