> ## 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（全モデル）- Messages 完全リファレンス

> 公開エンドポイントは POST /v1/messages です。推論強度は output_config.effort で設定します。トップレベルの cache_control は 5m/1h の書き込みを制御します（K3.1 シリーズのみ）。thinking、signature、tool_use、サーバー側の検索結果ブロックを完全に保持してください。

> [!NOTE]
>
> **BaseURL**: デフォルトの BaseURL は `https://direct.evolink.ai` で、テキストモデルと長時間接続をより適切にサポートします。`https://api.evolink.ai` はマルチモーダルサービスの主要エンドポイントで、テキストモデルの代替アドレスとして使用されます。


## OpenAPI

````yaml ja/api-manual/language-series/kimi/messages/messages-reference.json POST /v1/messages
openapi: 3.1.0
info:
  title: Kimi API（全モデル）- Messages 完全リファレンス
  description: >-
    Anthropic Messages プロトコルで Kimi テキストモデルを呼び出します。`model` で
    `kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed`、`kimi-k3` を選択します。いずれもコンテキストウィンドウは
    1,048,576 tokens で、複数ターンの会話、ストリーミング、ツール呼び出し、Web 検索、画像入力に対応します。


    3 モデルとも推論は常に有効で、強度は `output_config.effort` で調整します。構造化出力、停止シーケンス、キャッシュ書き込み
    TTL は K3.1 シリーズのみ対応します。`model` の説明をご覧ください。複数ターンでは
    thinking、signature、tool_use を含む assistant の全コンテンツブロックを変更せず再送してください。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 本番環境（推奨）
  - url: https://api.evolink.ai
    description: 代替 URL
security:
  - bearerAuth: []
tags:
  - name: Messages
    description: Anthropic Messages 互換 API
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: Kimi Messages API（全モデル、Anthropic 互換）
      description: >-
        公開エンドポイントは POST /v1/messages です。推論強度は output_config.effort
        で設定します。トップレベルの cache_control は 5m/1h の書き込みを制御します（K3.1
        シリーズのみ）。thinking、signature、tool_use、サーバー側の検索結果ブロックを完全に保持してください。
      operationId: createMessageKimi
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
            examples:
              simple:
                summary: Pro の最小リクエスト
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
              highspeed:
                summary: Highspeed の最小リクエスト
                value:
                  model: kimi-k3.1-pro-highspeed
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
              k3:
                summary: Kimi K3 の最小リクエスト
                value:
                  model: kimi-k3
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: Reply with OK.
              system_prompt:
                summary: system プロンプト
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 2048
                  output_config:
                    effort: low
                  system: あなたは正確な技術編集者です。
                  messages:
                    - role: user
                      content: コンテキストキャッシュについて説明してください。
              streaming:
                summary: Anthropic SSE ストリーミング
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: Reply with OK.
                  stream: true
              multimodal:
                summary: 画像入力
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 1024
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content:
                        - type: image
                          source:
                            type: base64
                            media_type: image/jpeg
                            data: /9j/4AAQSkZJRgABAQAA...
                        - type: text
                          text: この画像を説明してください。
              tool_use:
                summary: ツール利用
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 2048
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: 北京の今日の天気を調べてください。
                  tools:
                    - name: get_weather
                      description: 指定した都市の天気を取得
                      input_schema:
                        type: object
                        properties:
                          city:
                            type: string
                            description: 都市名
                        required:
                          - city
                  tool_choice:
                    type: auto
              web_search:
                summary: サーバー側の Web 検索
                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: 厳密な構造化出力（K3.1 シリーズのみ）
                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.
              cache_1h:
                summary: トップレベルの 1h キャッシュ（K3.1 シリーズのみ）
                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
      responses:
        '200':
          description: Message 応答。ストリーミングリクエストでは Anthropic SSE イベントストリームを返します
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  通常のイベント順序は
                  message_start、content_block_*、message_delta、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
            - kimi-k3
          default: kimi-k3.1-pro
          description: >-
            呼び出すモデル：


            | モデル ID | 位置付け | 推論強度 |

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

            | `kimi-k3.1-pro` | 最新世代モデル（推奨） | `low` / `high` / `max`, デフォルト
            `max` |

            | `kimi-k3.1-pro-highspeed` | Pro と同じパラメータで、より高速に生成 |
            `kimi-k3.1-pro` と同じ |

            | `kimi-k3` | 前世代モデル | `max` のみ |


            3 モデルともコンテキストウィンドウは 1,048,576 tokens で、推論は常に有効です。


            構造化出力（`output_config.format`）、停止シーケンス（`stop_sequences`）、キャッシュ書き込み
            TTL（`cache_control`）は K3.1 シリーズのみ対応し、`kimi-k3` は対応しません。`kimi-k3`
            のレスポンスには `text` ブロックのみが含まれ、`thinking` ブロックが返らない場合があります。
        max_tokens:
          type: integer
          minimum: 1
          description: thinking と最終テキストを含む、この生成で使用できる最大 token 数。
          maximum: 1048576
        messages:
          type: array
          minItems: 1
          description: >-
            Anthropic Messages のメッセージ一覧。複数ターンの会話では、assistant
            の完全なコンテンツブロックを変更せずに返してください。
          items:
            $ref: '#/components/schemas/Message'
        system:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/MessagesTextBlockParam'
          description: 文字列または text ブロック配列のシステムプロンプト。
        stream:
          type: boolean
          default: false
          description: Anthropic SSE イベントストリームを返すかどうか。
        tools:
          type: array
          description: >-
            カスタム関数またはサーバー側 Web 検索。内蔵検索は type=web_search_20250305、name=web_search
            を使用し、実際の呼び出し回数で課金されます。
          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: >-
            停止シーケンス。完全一致すると出力を停止し、一致したシーケンス自体は出力しません。最大 5 個、各 32 バイト以下です。一致時は
            `stop_reason` が `end_turn`、`stop_sequence` が `null` になります。


            `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed` のみ対応し、`kimi-k3` は対応しません。
        cache_control:
          type: object
          description: >-
            トップレベルのキャッシュ書き込み設定。`kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed`
            のみ対応し、`kimi-k3` はこのパラメータに対応しません。書き込み TTL はトップレベルの cache_control
            のみで制御され、メッセージブロック内のキャッシュマーカーでは代替できません。省略時は 5m です。
          properties:
            type:
              type: string
              enum:
                - ephemeral
              description: キャッシュ種別。ephemeral 固定。
            ttl:
              type: string
              enum:
                - 5m
                - 1h
              default: 5m
              description: キャッシュ有効期間。5m または 1h。デフォルトは 5m。
          required:
            - type
        output_config:
          type: object
          description: 出力設定：推論強度と構造化出力。
          properties:
            effort:
              type: string
              enum:
                - low
                - high
                - max
                - medium
                - xhigh
                - minimal
                - none
              default: max
              description: >-
                推論強度。推論は常に有効で、`thinking.type: "disabled"` を指定しても無効になりません。


                - `kimi-k3.1-pro` / `kimi-k3.1-pro-highspeed`：`low` / `high` /
                `max` を推奨し、デフォルトは `max` です。汎用クライアントとの互換性のため、`medium` は
                `high`、`xhigh` は `max`、`minimal` / `none` は `low` として扱います。`none`
                でも推論は無効になりません。

                - `kimi-k3`：`max` のみ対応します（デフォルト）。


                強度を上げると通常は推論トークンとレイテンシーが増えます。推論トークンは出力に含まれます。
            format:
              type: object
              description: >-
                構造化出力：指定した JSON Schema に厳密に従う JSON を出力します。 `kimi-k3.1-pro` /
                `kimi-k3.1-pro-highspeed` のみ対応し、`kimi-k3` は対応しません。`kimi-k3`
                で構造化出力が必要な場合は Chat Completions API の `response_format`
                を使用してください。
              properties:
                type:
                  type: string
                  enum:
                    - json_schema
                schema:
                  type: object
                  description: 出力が従う JSON Schema。
                  additionalProperties: true
              required:
                - type
                - schema
        temperature:
          type: number
          default: 1
          description: >-
            サンプリング温度。モデル側で `1` に固定されているため、指定は不要です。`kimi-k3.1-pro` /
            `kimi-k3.1-pro-highspeed` はこのフィールドを自動的に無視し、`kimi-k3`
            は未対応の値に対してエラーを返します。
        top_p:
          type: number
          default: 0.95
          description: >-
            核サンプリングの閾値。モデル側で `0.95` に固定されているため、指定は不要です。`kimi-k3.1-pro` /
            `kimi-k3.1-pro-highspeed` はこのフィールドを自動的に無視し、`kimi-k3`
            は未対応の値に対してエラーを返します。
    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: メッセージのロール。user と assistant のみをサポートします。
          enum:
            - user
            - assistant
        content:
          description: プレーンテキストまたは Anthropic コンテンツブロック配列としてのメッセージ内容。
          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: ツール名。
        description:
          type: string
          description: モデルがツールを使用するタイミングを判断するための説明。
        input_schema:
          type: object
          additionalProperties: true
          description: JSON Schema 形式のツールパラメータ定義。
    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: 今回の応答で許可される最大検索回数。
    ToolChoice:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: ツール選択。auto はモデルに判断を任せ、any はツール呼び出しを必須にし、none は呼び出しを禁止します。
          enum:
            - auto
            - any
            - none
          default: auto
    ContentBlock:
      description: テキスト、画像、推論、ツール呼び出し、またはツール結果を表す Anthropic コンテンツブロック。
      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: キャッシュ読み取りと書き込みを除いた通常入力トークン数。3 区分は重複しないため、キャッシュ分を再度差し引かないでください。
        cache_creation_input_tokens:
          type: integer
          description: キャッシュに書き込まれた入力 tokens。
        cache_read_input_tokens:
          type: integer
          description: キャッシュから提供された入力 tokens。
        output_tokens:
          type: integer
          description: thinking tokens を含む出力 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: >-
            cache_creation_input_tokens 内の 2 種類の書き込み内訳。K3.1 シリーズでは実際の TTL
            ごとに課金されます。
        server_tool_use:
          type: object
          properties:
            web_search_requests:
              type: integer
              minimum: 0
          description: 今回の応答の検索使用量。
    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: コンテンツブロックの種類。text 固定です。
          enum:
            - text
        text:
          type: string
          description: テキスト内容。
    ImageBlock:
      type: object
      required:
        - type
        - source
      description: 画像コンテンツブロック（マルチモーダル入力）。
      properties:
        type:
          type: string
          enum:
            - image
          description: コンテンツブロックの種類。image 固定です。
        source:
          type: object
          required:
            - type
          description: 画像ソース。
          properties:
            type:
              type: string
              enum:
                - base64
                - url
              description: 画像ソース。base64 はインラインデータ、url はファイル参照です。
            media_type:
              type: string
              enum:
                - image/jpeg
                - image/png
                - image/gif
                - image/webp
              description: '`type=base64` のときの画像 MIME タイプ。'
            data:
              type: string
              description: '`type=base64` のときの画像 Base64 データ（`data:` プレフィックスを含まない）。'
            url:
              type: string
              description: 画像のファイル参照。type=url の場合のみ使用します。
    ThinkingBlock:
      type: object
      required:
        - type
        - thinking
      properties:
        type:
          type: string
          description: コンテンツブロックの種類。thinking 固定です。
          enum:
            - thinking
        thinking:
          type: string
          description: モデルの推論内容。複数ターンの会話では signature と一緒に変更せず返してください。
        signature:
          type: string
          description: 複数ターンの会話では thinking ブロックと一緒に変更せず返してください。
    ToolUseBlock:
      type: object
      required:
        - type
        - id
        - name
        - input
      properties:
        type:
          type: string
          description: コンテンツブロックの種類。tool_use 固定です。
          enum:
            - tool_use
        id:
          type: string
          description: 結果を返すときに参照する tool_use ID。
        name:
          type: string
          description: モデルが要求したツール名。
        input:
          type: object
          additionalProperties: true
          description: モデルが生成したツール入力オブジェクト。
    ToolResultBlock:
      type: object
      required:
        - type
        - tool_use_id
        - content
      properties:
        type:
          type: string
          description: コンテンツブロックの種類。tool_result 固定です。
          enum:
            - tool_result
        tool_use_id:
          type: string
          description: 対応する tool_use コンテンツブロックの ID。
        content:
          description: 文字列、またはテキスト・画像ブロック配列のツール実行結果。
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/TextBlock'
                  - $ref: '#/components/schemas/ImageBlock'
        is_error:
          type: boolean
          default: false
          description: ツール実行が失敗したかどうか。
    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: 検索エラーオブジェクト。type=web_search_tool_result_error。
  responses:
    BadRequest:
      description: リクエストパラメータが無効です
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: API キーがないか、無効です
      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: |-
        ##すべての API で Bearer Token 認証が必要です##

        **API キーの取得：**

        [API キー管理ページ](https://evolink.ai/dashboard/keys)で API キーを取得してください

        **リクエストヘッダーに追加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````

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