Moonshot AI Utilities API

The Utilities API from Moonshot AI — 2 operation(s) for utilities.

Operations 2

POST /v1/tokenizers/estimate-token-count 估算 Token 数量 #
POST /v1/signatures/verify 校验请求签名 #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/kimi-ai:kimi-ai-utilities-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

kimi-ai-utilities-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Moonshot AI Utilities API
  version: 1.0.0
  description: Moonshot AI / Kimi 大语言模型服务 API
servers:
- url: https://api.moonshot.cn
  description: 生产环境
tags:
- name: Utilities
paths:
  /v1/tokenizers/estimate-token-count:
    post:
      summary: 估算 Token 数量
      description: 估算给定消息和模型所需的 Token 数量。输入结构与聊天补全几乎相同。
      tags:
      - Utilities
      security:
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EstimateTokenRequest'
      responses:
        '200':
          description: Token 数量估算结果
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EstimateTokenResponse'
        '400':
          description: 请求错误 - 参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权 - API 密钥无效或缺失
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: postV1TokenizersEstimateTokenCount
      x-operation-id-source: derived
  /v1/signatures/verify:
    post:
      summary: 校验请求签名
      description: '校验 Chat Completions、Responses 或 Messages API 响应头中返回的请求签名,用于证明该请求确实由 Kimi API 处理且请求的是指定模型,而非被转发到其他服务。提交调用时使用的 nonce、响应头中的 timestamp、请求的 model 以及 signature,签名与这三个属性完全一致时返回 `valid: true`,否则返回 `valid: false`。'
      tags:
      - Utilities
      security:
      - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SignatureVerifyRequest'
      responses:
        '200':
          description: 校验结果
          headers:
            Cache-Control:
              description: 固定为 `no-store`,校验结果不应被缓存。
              schema:
                type: string
                example: no-store
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignatureVerifyResponse'
        '400':
          description: 请求错误 - 参数无效或缺少必填字段
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权 - API 密钥无效或缺失
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求过于频繁
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      operationId: postV1SignaturesVerify
      x-operation-id-source: derived
components:
  schemas:
    Message:
      type: object
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
          example: user
          description: 消息发送者的角色,支持 system、user、assistant、tool
        content:
          oneOf:
          - type: string
          - type: array
            items:
              oneOf:
              - title: text
                type: object
                properties:
                  type:
                    type: string
                    enum:
                    - text
                  text:
                    type: string
                required:
                - type
                - text
              - title: image_url
                type: object
                properties:
                  type:
                    type: string
                    enum:
                    - image_url
                  image_url:
                    oneOf:
                    - type: object
                      properties:
                        url:
                          type: string
                      required:
                      - url
                    - type: string
                required:
                - type
                - image_url
              - title: video_url
                type: object
                properties:
                  type:
                    type: string
                    enum:
                    - video_url
                  video_url:
                    oneOf:
                    - type: object
                      properties:
                        url:
                          type: string
                      required:
                      - url
                    - type: string
                required:
                - type
                - video_url
          example: 你好
          description: 消息内容。可以是纯文本字符串,也可以是包含 text/image_url/video_url 类型的对象数组(用于多模态输入)
        name:
          type: string
          default: null
          description: 消息发送者的名称(可选)
        partial:
          type: boolean
          default: false
          description: 在最后一条 assistant 消息中设置为 true 以启用 Partial Mode
      required:
      - role
      - content
    EstimateTokenRequest:
      type: object
      properties:
        model:
          type: string
          description: 模型 ID
          default: kimi-k3.1-pro
          enum:
          - kimi-k3.1-pro
          - kimi-k3.1-pro-highspeed
          - kimi-k3
          - kimi-k2.7-code
          - kimi-k2.7-code-highspeed
          - kimi-k2.6
        messages:
          type: array
          description: '包含迄今为止对话的消息列表。每个元素格式为 {"role": "user", "content": "你好"}。role 支持 system、user、assistant、tool 其一,content 不得为空'
          items:
            $ref: '#/components/schemas/Message'
      required:
      - model
      - messages
    SignatureVerifyResponse:
      type: object
      properties:
        valid:
          type: boolean
          description: 签名是否有效。`true` 表示该签名由 Kimi API 签发,且与提交的 nonce、timestamp、model 完全匹配;否则为 `false`。
          example: true
      required:
      - valid
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 描述错误原因的错误消息
            type:
              type: string
              description: 错误类型
            code:
              type: string
              description: 错误码
          required:
          - message
      required:
      - error
    SignatureVerifyRequest:
      type: object
      properties:
        nonce:
          type: string
          description: 调用模型接口时通过 `X-Msh-Request-Nonce` 请求头发送的 nonce,需与原值完全一致。
          minLength: 1
          example: 7d929748-0ae6-41c2-ab5d-a186498ad721
        timestamp:
          type: integer
          format: int64
          description: 模型接口响应头 `Msh-Request-Timestamp` 返回的 Unix 毫秒时间戳。
          minimum: 1
          example: 1786338000123
        model:
          type: string
          description: 调用模型接口时请求体中的 `model` 值,需与原值完全一致。
          minLength: 1
          example: kimi-k2.7-code
        signature:
          type: string
          description: 模型接口响应头 `Msh-Request-Signature` 返回的签名 token。
          minLength: 1
          example: reqsigv1_<opaque-token>
      required:
      - nonce
      - timestamp
      - model
      - signature
    EstimateTokenResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            total_tokens:
              type: integer
              description: 估算的总 Token 数量
              example: 80
          required:
          - total_tokens
      required:
      - data
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Authorization 请求头需要一个 Bearer 令牌。使用 MOONSHOT_API_KEY 作为令牌。这是一个服务端密钥,请在 [API 密钥页面](https://platform.kimi.com/console/api-keys) 生成。