> ## 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 - Anthropic-Compatible API

> Public endpoint: POST /v1/messages. Set reasoning effort in output_config.effort and the 5m/1h write TTL in top-level cache_control. Preserve thinking, signature, tool_use, and server search-result blocks in full.

> [!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-messages.json POST /v1/messages
openapi: 3.1.0
info:
  title: Kimi K3.1 Pro / Highspeed - Anthropic-Compatible API
  description: >-
    Call Kimi K3.1 Pro / Highspeed through Anthropic Messages 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 `output_config.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: Messages
    description: Anthropic Messages-compatible API
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: Kimi K3.1 Pro / Highspeed Messages API
      description: >-
        Public endpoint: POST /v1/messages. Set reasoning effort in
        output_config.effort and the 5m/1h write TTL in top-level cache_control.
        Preserve thinking, signature, tool_use, and server search-result blocks
        in full.
      operationId: createMessageKimiK31Pro
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
            examples:
              simple:
                summary: Minimal Pro request
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
              highspeed:
                summary: Minimal Highspeed request
                value:
                  model: kimi-k3.1-pro-highspeed
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
              streaming:
                summary: Anthropic SSE streaming
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
                  stream: true
              cache_1h:
                summary: Top-level 1h cache
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
                  cache_control:
                    type: ephemeral
                    ttl: 1h
              web_search:
                summary: Server-side web search
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Use web search to find the official Kimi homepage URL.
                  tools:
                    - type: web_search_20250305
                      name: web_search
                      max_uses: 1
              structured_output:
                summary: Strict structured output
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                    format:
                      type: json_schema
                      schema:
                        type: object
                        properties:
                          result:
                            type: string
                        required:
                          - result
                        additionalProperties: false
                  messages:
                    - role: user
                      content: Return a JSON object with result equal to OK.
      responses:
        '200':
          description: >-
            Message response; streaming requests return an Anthropic SSE event
            stream
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  The event sequence typically includes message_start,
                  content_block_*, message_delta, and message_stop.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    CreateMessageRequest:
      type: object
      required:
        - model
        - max_tokens
        - 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.
        max_tokens:
          type: integer
          minimum: 1
          description: >-
            Maximum number of tokens allowed for this generation, including
            thinking and final text.
          maximum: 1048576
        messages:
          type: array
          minItems: 1
          description: >-
            Anthropic Messages message list. For multi-turn conversations,
            return complete assistant content blocks unchanged.
          items:
            $ref: '#/components/schemas/Message'
        system:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/MessagesTextBlockParam'
          description: System prompt as a string or array of text blocks.
        stream:
          type: boolean
          default: false
          description: Whether to return an Anthropic SSE event stream.
        tools:
          type: array
          description: >-
            Custom functions or server-side web search. Built-in search uses
            type=web_search_20250305 and name=web_search; billed per actual
            call.
          items:
            oneOf:
              - $ref: '#/components/schemas/Tool'
              - $ref: '#/components/schemas/WebSearchTool'
        tool_choice:
          $ref: '#/components/schemas/ToolChoice'
        stop_sequences:
          type: array
          items:
            type: string
          maxItems: 5
          description: >-
            Stop sequences: an exact match stops generation and is omitted from
            output. At most 5 sequences, each no longer than 32 bytes.
        cache_control:
          type: object
          description: >-
            Only top-level cache_control controls the write TTL; cache markers
            inside message blocks do not replace it. Default when omitted: 5m.
          properties:
            type:
              type: string
              enum:
                - ephemeral
              description: Cache type; always ephemeral.
            ttl:
              type: string
              enum:
                - 5m
                - 1h
              default: 5m
              description: 'Cache TTL: 5m or 1h; default: 5m.'
          required:
            - type
        output_config:
          type: object
          description: 'Output configuration: reasoning effort and structured output.'
          properties:
            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.
            format:
              type: object
              description: >-
                Structured output. When set, the model returns JSON strictly
                following the supplied JSON Schema.
              properties:
                type:
                  type: string
                  enum:
                    - json_schema
                schema:
                  type: object
                  description: JSON Schema that the output must follow.
                  additionalProperties: true
              required:
                - type
                - schema
    MessageResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - message
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
          example: kimi-k3.1-pro
        content:
          type: array
          items:
            $ref: '#/components/schemas/ContentBlock'
        stop_reason:
          type:
            - string
            - 'null'
          enum:
            - end_turn
            - max_tokens
            - tool_use
            - refusal
            - null
        stop_sequence:
          type:
            - string
            - 'null'
        usage:
          $ref: '#/components/schemas/MessageUsage'
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: Message role. Only user and assistant are supported.
          enum:
            - user
            - assistant
        content:
          description: >-
            Message content as either a plain text string or an array of
            Anthropic content blocks.
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentBlock'
    MessagesTextBlockParam:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
      required:
        - type
        - text
    Tool:
      type: object
      required:
        - name
        - input_schema
      properties:
        name:
          type: string
          description: Tool name.
        description:
          type: string
          description: Description that helps the model decide when to use the tool.
        input_schema:
          type: object
          additionalProperties: true
          description: Tool parameter definition in JSON Schema format.
    WebSearchTool:
      type: object
      required:
        - type
        - name
      properties:
        type:
          type: string
          enum:
            - web_search_20250305
        name:
          type: string
          enum:
            - web_search
        max_uses:
          type: integer
          minimum: 1
          description: Maximum searches allowed for this response.
    ToolChoice:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: >-
            Tool choice: auto lets the model decide, any requires a tool call,
            and none disables tool calls.
          enum:
            - auto
            - any
            - none
          default: auto
    ContentBlock:
      description: >-
        Anthropic content block for text, image, reasoning, tool use, or a tool
        result.
      oneOf:
        - $ref: '#/components/schemas/TextBlock'
        - $ref: '#/components/schemas/ImageBlock'
        - $ref: '#/components/schemas/ThinkingBlock'
        - $ref: '#/components/schemas/ToolUseBlock'
        - $ref: '#/components/schemas/ToolResultBlock'
        - $ref: '#/components/schemas/ServerToolUseBlock'
        - $ref: '#/components/schemas/WebSearchResultBlock'
    MessageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: >-
            Ordinary input tokens, excluding cache reads and cache writes. The
            three input categories are mutually exclusive; do not subtract
            cached tokens again.
        cache_creation_input_tokens:
          type: integer
          description: Input tokens written to cache.
        cache_read_input_tokens:
          type: integer
          description: Input tokens served from cache.
        output_tokens:
          type: integer
          description: Output tokens, including thinking tokens.
        output_tokens_details:
          type: object
          properties:
            thinking_tokens:
              type: integer
        cache_creation:
          type: object
          properties:
            ephemeral_5m_input_tokens:
              type: integer
              minimum: 0
            ephemeral_1h_input_tokens:
              type: integer
              minimum: 0
          description: >-
            The two TTL-specific write categories within
            cache_creation_input_tokens, billed separately by actual TTL.
        server_tool_use:
          type: object
          properties:
            web_search_requests:
              type: integer
              minimum: 0
          description: Search usage for this response.
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
        request_id:
          type: string
    TextBlock:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          description: Content block type. Fixed to text.
          enum:
            - text
        text:
          type: string
          description: Text content.
    ImageBlock:
      type: object
      required:
        - type
        - source
      description: Image content block (multimodal input).
      properties:
        type:
          type: string
          enum:
            - image
          description: Content block type. Fixed to image.
        source:
          type: object
          required:
            - type
          description: Image source.
          properties:
            type:
              type: string
              enum:
                - base64
                - url
              description: 'Image source: base64 for inline data, url for a file reference.'
            media_type:
              type: string
              enum:
                - image/jpeg
                - image/png
                - image/gif
                - image/webp
              description: Image MIME type when `type=base64`.
            data:
              type: string
              description: >-
                Base64 image data when `type=base64` (without the `data:`
                prefix).
            url:
              type: string
              description: Image file reference, used only when type=url.
    ThinkingBlock:
      type: object
      required:
        - type
        - thinking
      properties:
        type:
          type: string
          description: Content block type. Fixed to thinking.
          enum:
            - thinking
        thinking:
          type: string
          description: >-
            Model reasoning content. Return it unchanged together with the
            signature in multi-turn conversations.
        signature:
          type: string
          description: >-
            In multi-turn conversations, return this unchanged together with the
            thinking block.
    ToolUseBlock:
      type: object
      required:
        - type
        - id
        - name
        - input
      properties:
        type:
          type: string
          description: Content block type. Fixed to tool_use.
          enum:
            - tool_use
        id:
          type: string
          description: Tool use ID referenced by tool_use_id when returning the result.
        name:
          type: string
          description: Name of the tool requested by the model.
        input:
          type: object
          additionalProperties: true
          description: Tool input object generated by the model.
    ToolResultBlock:
      type: object
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          description: Content block type. Fixed to tool_result.
          enum:
            - tool_result
        tool_use_id:
          type: string
          description: ID of the corresponding tool_use content block.
        content:
          description: Tool result as a string or an array of text and image blocks.
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/TextBlock'
                  - $ref: '#/components/schemas/ImageBlock'
        is_error:
          type: boolean
          default: false
          description: Whether the tool execution failed.
    ServerToolUseBlock:
      type: object
      required:
        - type
        - id
        - name
        - input
      properties:
        type:
          type: string
          enum:
            - server_tool_use
        id:
          type: string
        name:
          type: string
        input:
          type: object
          additionalProperties: true
    WebSearchResultBlock:
      type: object
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          enum:
            - web_search_tool_result
        tool_use_id:
          type: string
        content:
          oneOf:
            - type: array
              items:
                type: object
                additionalProperties: true
            - type: object
              additionalProperties: true
              description: Search error object with type=web_search_tool_result_error.
  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.