> ## 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 K3.1 Pro / Highspeed - OpenAI-Compatible API

> Call either model using the OpenAI Chat Completions format, with JSON or SSE streaming responses. Preserve the assistant's complete reasoning_content and tool_calls across turns.

When web search returns tool_calls, send each call's function.arguments as the content of a tool message with the matching tool_call_id, then request 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-k3.1-pro/kimi-k3.1-pro-chat.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Kimi K3.1 Pro / Highspeed - OpenAI-Compatible API
  description: >-
    Call Kimi K3.1 Pro / Highspeed through OpenAI Chat Completions using
    `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed`. Both models offer a
    1,048,576-token context and support multi-turn conversations, streaming,
    tool calls, web search, structured output, and context caching.


    Reasoning is always enabled. Set `reasoning_effort` to `low` / `high` /
    `max`; the default is `max`. Preserve complete reasoning and tool-call
    history across turns.
  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 K3.1 Pro / Highspeed Chat API (OpenAI-compatible)
      description: >-
        Call either model using the OpenAI Chat Completions format, with JSON or
        SSE streaming responses. Preserve the assistant's complete
        reasoning_content and tool_calls across turns.


        When web search returns tool_calls, send each call's function.arguments
        as the content of a tool message with the matching tool_call_id, then
        request the final answer.
      operationId: createChatCompletionKimiK31Pro
      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
              streaming:
                summary: SSE streaming
                value:
                  model: kimi-k3.1-pro
                  messages:
                    - role: user
                      content: Reply with OK.
                  reasoning_effort: low
                  max_completion_tokens: 1024
                  stream: true
              cache_1h:
                summary: Automatic 1h cache write
                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
              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
              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: Query the weather for a specified city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: City name
                          required:
                            - city
                  tool_choice: auto
      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
          default: kimi-k3.1-pro
          description: >-
            Use `kimi-k3.1-pro` or `kimi-k3.1-pro-highspeed`; Highspeed offers
            faster generation.
        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: low / high / max are recommended; default: max.
            Reasoning is always enabled. Client aliases: medium maps to high,
            xhigh to max, minimal / none to low. none does not disable
            reasoning. Higher effort usually increases reasoning tokens and
            latency. Reasoning tokens count as 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. If omitted, automatically writes to the
            5m cache. 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.
    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 ordinary input, cache reads, and cache
            writes. Ordinary input = prompt_tokens - cached_tokens -
            cache_write_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 tokens written to cache, including 5m / 1h writes. Do not
                charge these again as ordinary 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 the [API Key Management Page](https://evolink.ai/dashboard/keys)
        to obtain 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.