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

# Kimi K3 - OpenAI 兼容接口

> 使用 OpenAI Chat Completions 协议调用 `kimi-k3`。支持非流式 JSON 与流式 SSE 响应。K3 始终进行推理，`reasoning_effort` 当前仅支持 `max`。

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


## OpenAPI

````yaml cn/api-manual/language-series/kimi-k3/kimi-k3-chat.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Kimi K3 OpenAI 兼容接口
  description: >-
    通过 OpenAI Chat Completions 协议调用 Kimi K3。


    **首版已确认能力**：

    - 模型 ID：`kimi-k3`

    - 上下文窗口：1,048,576 tokens

    - K3 始终进行推理，推理内容通过 `reasoning_content` 返回

    - `reasoning_effort` 当前仅支持 `max`

    - 支持多轮对话、SSE 流式输出和 Function Calling


    多轮对话时，请将上一轮完整 assistant message 原样放回 `messages`，包括可能出现的 `reasoning_content`
    和 `tool_calls`。
  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 K3 对话接口（OpenAI 兼容）
      description: >-
        使用 OpenAI Chat Completions 协议调用 `kimi-k3`。支持非流式 JSON 与流式 SSE 响应。K3
        始终进行推理，`reasoning_effort` 当前仅支持 `max`。
      operationId: createChatCompletionKimiK3
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple:
                summary: 最小请求
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: 请用三句话介绍 Kimi K3。
              streaming:
                summary: 流式输出并返回 usage
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: 写一首关于夏夜的短诗。
                  stream: true
                  stream_options:
                    include_usage: true
              tool_calling:
                summary: Function Calling
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: 查询北京今天的天气。
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: 查询指定城市的天气
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: 城市名称
                          required:
                            - city
                  tool_choice: auto
      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:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          enum:
            - kimi-k3
          description: 模型 ID。
        messages:
          type: array
          minItems: 1
          description: 对话消息。多轮对话需完整回传历史 assistant message。
          items:
            $ref: '#/components/schemas/ChatMessage'
        max_completion_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          default: 131072
          description: 生成内容的最大 Token 数。Kimi K3 默认 131,072，最大 1,048,576；推理 Token 也计入该上限。
        reasoning_effort:
          type: string
          enum:
            - max
          default: max
          description: 推理力度。Kimi K3 始终进行推理，当前仅支持 `max`。
        stream:
          type: boolean
          default: false
          description: 是否使用 SSE 流式返回。
        stream_options:
          $ref: '#/components/schemas/StreamOptions'
          description: 流式响应选项，仅在 `stream=true` 时生效。该参数不会改变 Token 单价或生成量。
        tools:
          type: array
          maxItems: 128
          description: 模型可调用的函数工具列表。
          items:
            $ref: '#/components/schemas/FunctionTool'
        tool_choice:
          oneOf:
            - type: string
              enum:
                - auto
                - none
                - required
            - $ref: '#/components/schemas/NamedToolChoice'
          description: 控制模型是否调用工具，或强制调用指定函数。
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: chat.completion
        created:
          type: integer
        model:
          type: string
          example: kimi-k3
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                $ref: '#/components/schemas/ChatMessage'
              finish_reason:
                type: string
                enum:
                  - stop
                  - length
                  - tool_calls
        usage:
          $ref: '#/components/schemas/ChatUsage'
    ChatMessage:
      type: object
      required:
        - role
      properties:
        role:
          type: string
          description: 消息角色：system、user、assistant 或 tool。
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          type:
            - string
            - 'null'
          description: 消息文本。工具调用场景下 assistant content 可以为空。
        reasoning_content:
          type: string
          description: assistant 的推理内容。多轮对话时应与完整 assistant message 一起原样回传。
        tool_calls:
          type: array
          description: assistant 返回的工具调用列表；多轮工具调用时需原样回传。
          items:
            $ref: '#/components/schemas/ToolCall'
        tool_call_id:
          type: string
          description: '`role=tool` 时对应的工具调用 ID。'
    StreamOptions:
      type: object
      properties:
        include_usage:
          type: boolean
          default: false
          description: >-
            设为 true 时，在 `[DONE]` 前向调用方返回带 usage 的尾块。此选项只控制调用方是否看到该尾块，不会增加计费
            Token 或改变单价。
    FunctionTool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          description: 工具类型，当前固定为 function。
          enum:
            - function
        function:
          type: object
          description: 可供模型调用的函数定义。
          required:
            - name
            - parameters
          properties:
            name:
              type: string
              description: 函数名称。
            description:
              type: string
              description: 函数用途说明，帮助模型判断何时调用。
            parameters:
              type: object
              additionalProperties: true
              description: JSON Schema 格式的函数参数定义。
            strict:
              type: boolean
              description: 是否要求工具参数严格遵循 parameters 中的 JSON Schema。
    NamedToolChoice:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          description: 指定工具选择类型，固定为 function。
          enum:
            - function
        function:
          type: object
          description: 要强制调用的函数。
          required:
            - name
          properties:
            name:
              type: string
              description: 要强制调用的函数名称。
    ChatUsage:
      type: object
      properties:
        prompt_tokens:
          type: integer
          description: 输入 Token 总数，包含缓存命中部分。
        completion_tokens:
          type: integer
          description: 包含推理 Token。
        total_tokens:
          type: integer
          description: 输入与输出 Token 总数。
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: 缓存命中的输入 Token。
        completion_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: 推理 Token，已包含在 completion_tokens 中。
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type:
                - string
                - 'null'
    ToolCall:
      type: object
      required:
        - id
        - type
        - function
      properties:
        id:
          type: string
          description: 工具调用 ID，提交 tool 消息时通过 tool_call_id 关联。
        type:
          type: string
          description: 工具调用类型，固定为 function。
          enum:
            - function
        function:
          type: object
          description: 模型请求调用的函数及参数。
          properties:
            name:
              type: string
              description: 函数名称。
            arguments:
              type: string
              description: JSON 字符串形式的函数参数。
  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
        ```

````