> ## 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 API (All Models) - Chat Completions Full Reference

> Call Kimi models in OpenAI Chat Completions format, with regular JSON or SSE streaming responses. In multi-turn conversations, preserve the complete reasoning_content and tool_calls in assistant messages.

When web search returns tool_calls, send each call’s function.arguments back as the content of a tool message with the same tool_call_id, then continue the request to generate the final answer.

> [!NOTE]
>
> **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.


## OpenAPI

````yaml en/api-manual/language-series/kimi/chat-completions/chat-completions-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Kimi API (All Models) - Chat Completions Full Reference
  description: >-
    Call Kimi text models through the OpenAI Chat Completions protocol. Use
    `model` to select `kimi-k3.1-pro`, `kimi-k3.1-pro-highspeed`, or `kimi-k3`.
    All have a context window of 1,048,576 tokens and support multi-turn
    conversations, streaming, tool calling, web search, structured output, and
    image and video input.


    Reasoning is always enabled for all three models and returned in
    `reasoning_content`. Reasoning effort and cache write TTL vary by model; see
    the `model` field. Preserve complete reasoning and tool-call history in
    multi-turn conversations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (Recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Chat Completions
    description: OpenAI Chat Completions-compatible API
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completions
      summary: Kimi chat API (all models, OpenAI-compatible)
      description: >-
        Call Kimi models in OpenAI Chat Completions format, with regular JSON or
        SSE streaming responses. In multi-turn conversations, preserve the
        complete reasoning_content and tool_calls in assistant messages.


        When web search returns tool_calls, send each call’s function.arguments
        back as the content of a tool message with the same tool_call_id, then
        continue the request to generate the final answer.
      operationId: createChatCompletionKimi
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple:
                summary: Minimal Pro request
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Reply with OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
              highspeed:
                summary: Minimal Highspeed request
                value:
                  model: kimi-k3.1-pro-highspeed
                  messages:
                    - role: user
                      content: Reply with OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
              k3:
                summary: Minimal Kimi K3 request
                value:
                  model: kimi-k3
                  messages:
                    - role: user
                      content: Reply with OK.
                  max_completion_tokens: 1024
              streaming:
                summary: SSE streaming output
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Reply with OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
                  stream: true
              multimodal:
                summary: Image input
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content:
                        - type: image_url
                          image_url:
                            url: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA...
                        - type: text
                          text: Describe this image.
                  reasoning_effort: low
                  max_completion_tokens: 1024
              function_calling:
                summary: Function Calling
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Check today's weather in Beijing.
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get the weather for a specified city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: City name
                          required:
                            - city
                  tool_choice: auto
              web_search:
                summary: Web search (unified syntax)
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Use web search to find the official Kimi homepage URL.
                  reasoning_effort: low
                  max_completion_tokens: 1024
                  tools:
                    - type: web_search
              structured_output:
                summary: Strict JSON Schema
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Return a JSON object with result equal to OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
                  response_format:
                    type: json_schema
                    json_schema:
                      name: result
                      strict: true
                      schema:
                        type: object
                        properties:
                          result:
                            type: string
                        required:
                          - result
                        additionalProperties: false
              cache_1h:
                summary: Automatic 1h cache writes (K3.1 series only)
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Reply with OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
                  prompt_cache_options:
                    mode: implicit
                    ttl: 1h
      responses:
        '200':
          description: >-
            Chat completion response; streaming requests return an SSE event
            stream
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  SSE data in OpenAI Chat Completions format, ending with `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.1-pro
            - kimi-k3.1-pro-highspeed
            - kimi-k3
          default: kimi-k3.1-pro
          description: >-
            Model to call:


            | Model ID | Positioning | Reasoning effort |

            |---|---|---|

            | `kimi-k3.1-pro` | Latest-generation model (recommended) | `low` /
            `high` / `max`, default `max` |

            | `kimi-k3.1-pro-highspeed` | Same parameters as Pro, faster
            generation | Same as `kimi-k3.1-pro` |

            | `kimi-k3` | Previous-generation model | Only `max` |


            All three models have a context window of 1,048,576 tokens and
            always have reasoning enabled.


            Cache write TTL (`prompt_cache_options`) is supported only by the
            K3.1 series; `kimi-k3` does not support this parameter.
        messages:
          type: array
          minItems: 1
          description: >-
            Conversation messages. For multi-turn conversations, include
            complete historical assistant messages.
          items:
            $ref: '#/components/schemas/ChatMessage'
        max_completion_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          default: 131072
          description: >-
            Maximum generated tokens, including reasoning and the final answer.
            Default: 131072; maximum: 1048576, also limited by the remaining
            context.
        reasoning_effort:
          type: string
          enum:
            - low
            - high
            - max
            - medium
            - xhigh
            - minimal
            - none
          default: max
          description: >-
            Reasoning effort. Reasoning is always enabled.


            - `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed`: `low` / `high` /
            `max` are recommended; default `max`. For generic client
            compatibility, `medium` maps to `high`, `xhigh` to `max`, and
            `minimal` / `none` to `low`; `none` does not disable reasoning.

            - `kimi-k3`: only `max` is supported (default).


            Higher effort typically increases reasoning tokens and latency.
            Reasoning tokens count toward output.
        stream:
          type: boolean
          default: false
          description: Whether to return the response as an SSE stream.
        tools:
          type: array
          maxItems: 128
          description: >-
            Function tools or web search. Declare search with
            {"type":"web_search"}.
          items:
            oneOf:
              - $ref: '#/components/schemas/FunctionTool'
              - $ref: '#/components/schemas/WebSearchTool'
        tool_choice:
          oneOf:
            - type: string
              enum:
                - auto
                - none
                - required
            - $ref: '#/components/schemas/NamedToolChoice'
          description: >-
            Controls whether the model calls tools or forces a specific function
            call.
        prompt_cache_options:
          type: object
          description: >-
            Context cache write options, supported only by `kimi-k3.1-pro` /
            `kimi-k3.1-pro-highspeed`; `kimi-k3` does not support this
            parameter. When omitted, a 5m cache is written automatically by
            default. Writes and reads are billed separately.
          properties:
            mode:
              type: string
              enum:
                - implicit
              default: implicit
            ttl:
              type: string
              enum:
                - 5m
                - 1h
              default: 5m
              description: 'Cache TTL: 5m or 1h; default: 5m.'
        response_format:
          type: object
          description: >-
            Output format: text for plain text, json_object for a JSON object,
            or json_schema for structured output following a JSON Schema.
          properties:
            type:
              type: string
              enum:
                - text
                - json_object
                - json_schema
              description: >-
                Output format: text (default) for plain text; json_object for a
                valid JSON object; json_schema for schema-constrained output
                (recommended; supply json_schema).
            json_schema:
              type: object
              description: JSON Schema to follow when type is json_schema.
              properties:
                name:
                  type: string
                  description: Schema name used as an identifier.
                strict:
                  type: boolean
                  default: true
                  description: >-
                    Whether to strictly follow the supplied JSON Schema;
                    default: true.
                schema:
                  type: object
                  description: JSON Schema defining the output structure.
                  additionalProperties: true
              required:
                - name
                - schema
        max_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          deprecated: true
          description: >-
            Legacy output-limit alias. Use max_completion_tokens for new
            requests; avoid setting both.
        temperature:
          type: number
          default: 1
          description: >-
            Sampling temperature, fixed by the model at `1`; omit this field.
            `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed` automatically ignore it;
            `kimi-k3` returns an error for unsupported values.
        top_p:
          type: number
          default: 0.95
          description: >-
            Nucleus sampling threshold, fixed by the model at `0.95`; omit this
            field. `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed` automatically
            ignore it; `kimi-k3` returns an error for unsupported values.
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          example: chat.completion
        created:
          type: integer
        model:
          type: string
          example: kimi-k3.1-pro
        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: 'Message role: system, user, assistant, or tool.'
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          description: >-
            Message content. Pass a string for plain text; pass an array of
            content blocks (text + image + video) for multimodal input.
            Assistant content may be null in tool-call scenarios.
          oneOf:
            - type: string
              description: Plain text message content.
            - type: array
              description: Array of multimodal content blocks.
              items:
                $ref: '#/components/schemas/ContentPart'
            - type: 'null'
        reasoning_content:
          type: string
          description: >-
            The assistant's reasoning content. Return it unchanged as part of
            the complete assistant message in multi-turn conversations.
        tool_calls:
          type: array
          description: >-
            Tool calls returned by the assistant. Return them unchanged in
            subsequent tool-use turns.
          items:
            $ref: '#/components/schemas/ToolCall'
        tool_call_id:
          type: string
          description: ID of the corresponding tool call when `role=tool`.
    FunctionTool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          description: Tool type. Currently fixed to function.
          enum:
            - function
        function:
          type: object
          description: Function definition available to the model.
          required:
            - name
            - parameters
          properties:
            name:
              type: string
              description: Function name.
            description:
              type: string
              description: >-
                Description that helps the model decide when to call the
                function.
            parameters:
              type: object
              additionalProperties: true
              description: Function parameter definition in JSON Schema format.
            strict:
              type: boolean
              description: >-
                Whether function arguments must strictly follow the JSON Schema
                in parameters.
    WebSearchTool:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - web_search
          description: Web search tool.
    NamedToolChoice:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          description: Named tool choice type. Fixed to function.
          enum:
            - function
        function:
          type: object
          description: Function that the model must call.
          required:
            - name
          properties:
            name:
              type: string
              description: Name of the function that the model must call.
    ChatUsage:
      type: object
      properties:
        prompt_tokens:
          type: integer
          description: >-
            Total input tokens, including regular input, cache reads, and cache
            writes. For the K3.1 series, regular input =
            prompt_tokens-cached_tokens-cache_write_tokens; for `kimi-k3`,
            regular input = prompt_tokens-cached_tokens.
        completion_tokens:
          type: integer
          description: Includes reasoning tokens.
        total_tokens:
          type: integer
          description: Total input and output tokens.
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: Input tokens served from cache.
            cache_write_tokens:
              type: integer
              minimum: 0
              description: >-
                Total cache-write tokens for this request, including 5m / 1h
                writes. The K3.1 series bills these separately without charging
                regular input fees again; `kimi-k3` does not separate them and
                bills them as regular input.
        completion_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: Reasoning tokens, already included in completion_tokens.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type:
                - string
                - 'null'
    ContentPart:
      description: Multimodal content block. `type` determines which field is used.
      oneOf:
        - type: object
          required:
            - type
            - text
          properties:
            type:
              type: string
              enum:
                - text
            text:
              type: string
              description: Text content when `type=text`.
        - type: object
          required:
            - type
            - image_url
          properties:
            type:
              type: string
              enum:
                - image_url
            image_url:
              description: >-
                Image when `type=image_url`; a URL string may also be passed
                directly.
              oneOf:
                - type: string
                - type: object
                  required:
                    - url
                  properties:
                    url:
                      type: string
                      description: >-
                        Image content as a Base64 Data URL
                        (data:image/png;base64,...).
        - type: object
          required:
            - type
            - video_url
          properties:
            type:
              type: string
              enum:
                - video_url
            video_url:
              description: >-
                Video when `type=video_url`; a URL string may also be passed
                directly.
              oneOf:
                - type: string
                - type: object
                  required:
                    - url
                  properties:
                    url:
                      type: string
                      description: >-
                        Video content as a Base64 Data URL
                        (data:video/mp4;base64,...).
    ToolCall:
      type: object
      required:
        - id
        - type
        - function
      properties:
        id:
          type: string
          description: >-
            Tool call ID used to associate a subsequent tool message through
            tool_call_id.
        type:
          type: string
          description: >-
            Tool call type: `function` for client functions; `builtin_function`
            for the built-in `$web_search` tool.
          enum:
            - function
            - builtin_function
        function:
          type: object
          description: Function and arguments requested by the model.
          properties:
            name:
              type: string
              description: Function name.
            arguments:
              type: string
              description: Function arguments encoded as a JSON string.
      description: >-
        Preserve complete tool calls across turns, including IDs, types,
        function names, arguments, and reasoning.
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: API key is missing or invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: Rate limit exceeded or insufficient quota
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal service error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##All APIs require Bearer Token authentication##


        **Get API Key:**


        Visit [API Key Management Page](https://evolink.ai/dashboard/keys) to
        get your API Key


        **Add to request header:**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````

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