Kimi API

Kimi by Moonshot AI provides OpenAI-compatible APIs/SDKs for chat completions, tool calls, JSON Mode, Partial Mode, long context, and vision (via kimi-latest). The primary endpoint is POST /v1/chat/completions with streaming and context caching support.

基础 URL
https://api.moonshot.cn/v1
认证
Bearer / Authorization: Bearer
官方 SDK
Python, Node.js
🔑 API Key 获取
前置要求:Requires a Kimi account login; real-name verification and top-up may be needed for higher quotas.
入口:https://platform.moonshot.cn/console/api-keys
说明:Sign in to Kimi Open Platform, open 'API Key Management' and click 'Create' to generate a key (shown only once).

支持模型

API 接口列表

POST /v1/chat/completions Docs

Chat completions (OpenAI-compatible). Supports streaming, tool calls, JSON Mode, Partial Mode, and context caching.

认证Yes
频率限制3/min
计费模式按量计费 / Pay-per-token (CNY per 1M tokens; input/output billed; cache hits discounted)
{
  "model": "kimi-k2-turbo-preview",
  "messages": [
    {
      "role": "system",
      "content": "你是 Kimi,由 Moonshot AI 提供的助手。"
    },
    {
      "role": "user",
      "content": "给我一个 Kimi API 的示例。"
    }
  ],
  "temperature": 0.6,
  "stream": true
}
GET https://api.moonshot.cn/v1/users/me/balance Docs

Query current account balance (available, voucher, and cash balances).

认证Yes
频率限制3/min
计费模式
{}
POST https://api.moonshot.cn/v1/tokenizers/estimate-token-count Docs

Estimate token count for request messages to predict usage and rate limit checks.

认证Yes
频率限制3/min
计费模式
{
  "model": "kimi-k2-turbo-preview",
  "messages": [
    {
      "role": "system",
      "content": "你是 Kimi,由 Moonshot AI 提供的人工智能助手。"
    },
    {
      "role": "user",
      "content": "你好,我叫李雷,1+1等于多少?"
    }
  ]
}