> ## Documentation Index
> Fetch the complete documentation index at: https://evolink.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Kimi 全模型接口 - Chat Completions 快速开始

> - 使用 OpenAI Chat Completions 协议调用 Kimi 系列模型，通过 `model` 参数选择具体型号
- 最少只需 `model` 与 `messages` 两个参数
- 三个模型的上下文窗口均为 1,048,576 tokens，默认最大输出 131,072 tokens
- 三个模型始终开启思考，推理内容通过 `reasoning_content` 返回，思考 Token 计入输出
- 需要工具调用、联网搜索、结构化输出、图片输入或缓存设置，请查看[完整参数](/cn/api-manual/language-series/kimi/chat-completions/chat-completions-reference)页

> [!NOTE]
>
> **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，对文本模型作为备用地址使用。

> [!NOTE]
>
> **Kimi 系列始终开启思考**，推理内容通过 `reasoning_content` 返回，思考 Token 计入输出。手动设置 `max_completion_tokens` 时不宜过小，否则思考阶段可能耗尽输出预算，导致响应中没有正文。


## OpenAPI

````yaml cn/api-manual/language-series/kimi/chat-completions/chat-completions-quickstart.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Kimi 全模型接口 - Chat Completions 快速开始
  description: >-
    通过 OpenAI 兼容的 Chat Completions 接口调用 Kimi 系列文本模型的快速开始示例。最少只需 `model` 与
    `messages` 两个参数即可发起对话；工具调用、联网搜索、结构化输出、图片输入等请查看「完整参数」页。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: Chat Completions
    description: OpenAI Chat Completions 兼容接口
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completions
      summary: Kimi 快速对话（全模型）
      description: >-
        - 使用 OpenAI Chat Completions 协议调用 Kimi 系列模型，通过 `model` 参数选择具体型号

        - 最少只需 `model` 与 `messages` 两个参数

        - 三个模型的上下文窗口均为 1,048,576 tokens，默认最大输出 131,072 tokens

        - 三个模型始终开启思考，推理内容通过 `reasoning_content` 返回，思考 Token 计入输出

        -
        需要工具调用、联网搜索、结构化输出、图片输入或缓存设置，请查看[完整参数](/cn/api-manual/language-series/kimi/chat-completions/chat-completions-reference)页
      operationId: kimiChatCompletionsQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
            examples:
              simple:
                summary: Pro 最小请求
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: 用一句话解释什么是上下文缓存。
              highspeed:
                summary: Highspeed 低思考强度
                value:
                  model: kimi-k3.1-pro-highspeed
                  messages:
                    - role: user
                      content: 用一句话解释什么是上下文缓存。
                  reasoning_effort: low
              k3:
                summary: Kimi K3 最小请求
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: 用一句话解释什么是上下文缓存。
              multi_turn:
                summary: 系统提示词与多轮对话
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: system
                      content: 你是一名严谨的中文技术编辑，回答简洁。
                    - role: user
                      content: 什么是上下文缓存？
                    - role: assistant
                      content: 上下文缓存会保存请求中重复出现的前缀内容，后续请求命中时可以更快、更省地处理。
                    - role: user
                      content: 它适合哪些场景？
                  reasoning_effort: low
              streaming:
                summary: SSE 流式输出
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: 写一首关于夏夜的四行短诗。
                  reasoning_effort: low
                  max_completion_tokens: 2048
                  stream: true
      responses:
        '200':
          description: 对话生成成功；流式请求返回 SSE 事件流
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: 'OpenAI Chat Completions 格式的 SSE 数据，以 `data: [DONE]` 结束。'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ChatCompletionQuickRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          enum:
            - kimi-k3.1-pro
            - kimi-k3.1-pro-highspeed
            - kimi-k3
          default: kimi-k3.1-pro
          description: |-
            要调用的模型：

            | 模型 ID | 定位 |
            |---|---|
            | `kimi-k3.1-pro` | 最新一代模型（推荐） |
            | `kimi-k3.1-pro-highspeed` | 与 Pro 参数相同，生成速度更快 |
            | `kimi-k3` | 上一代模型 |

            三个模型的上下文窗口均为 1,048,576 tokens，均始终开启思考。
        messages:
          type: array
          minItems: 1
          description: 对话消息。多轮对话时按顺序放入历史消息；回传思考与工具调用历史的方法见完整参数页。
          items:
            $ref: '#/components/schemas/MessageSimple'
        reasoning_effort:
          type: string
          enum:
            - low
            - high
            - max
          default: max
          description: 思考强度，默认 `max`。`kimi-k3` 仅支持 `max`；其他兼容取值见完整参数页。
        max_completion_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          default: 131072
          description: 最大生成 Token 数，包含思考与最终回答；默认 131072，最大 1048576。
        stream:
          type: boolean
          default: false
          description: 是否使用 SSE 流式返回。
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: 响应 ID。
          example: chatcmpl-6adc72a2823cc13b156bf863
        object:
          type: string
          enum:
            - chat.completion
          example: chat.completion
        created:
          type: integer
          description: 创建时间，Unix 时间戳（秒）。
          example: 1792832163
        model:
          type: string
          description: 本次调用的模型。
          example: kimi-k3.1-pro
        choices:
          type: array
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    MessageSimple:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          description: 消息角色：`system` 为系统提示词，`user` 为用户输入，`assistant` 为历史回复。
        content:
          type: string
          description: 消息内容（纯文本）。
          example: 用一句话解释什么是上下文缓存。
    Choice:
      type: object
      properties:
        index:
          type: integer
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
          description: 结束原因：`stop` 为自然结束，`length` 为达到输出上限，`tool_calls` 为模型请求调用工具。
          example: stop
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
          description: 总输入 Token，包含缓存命中部分。
          example: 24
        completion_tokens:
          type: integer
          description: 输出 Token，包含推理 Token。
          example: 96
        total_tokens:
          type: integer
          description: 输入与输出 Token 总数。
          example: 120
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: 缓存命中的输入 Token。
              example: 0
        completion_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: 推理 Token，已包含在 completion_tokens 中。
              example: 62
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type:
                - string
                - 'null'
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
          example: assistant
        content:
          type:
            - string
            - 'null'
          description: 最终回答。
          example: 上下文缓存会保存请求中重复出现的前缀内容，后续请求命中时可以更快、更省地处理。
        reasoning_content:
          type: string
          description: 推理内容。多轮对话时应与完整 assistant 消息一起回传。
          example: 用户想用一句话了解上下文缓存，需要说明它保存什么、带来什么好处。
  responses:
    BadRequest:
      description: 请求参数错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: API Key 无效或缺失
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: 请求过于频繁或额度不足
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: 服务内部错误
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需要使用 Bearer Token 进行认证##

        **获取 API Key**：

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取您的 API Key

        **使用时在请求头中添加**：
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.