> ## 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 クイックスタート

> - Anthropic Messages プロトコルで Kimi モデルを呼び出し、`model` でモデルを選択します
- 必須パラメータは `model`、`max_tokens`、`messages` のみです（Anthropic プロトコルでは `max_tokens` が必須）
- 3 モデルともコンテキストウィンドウは 1,048,576 tokens です
- 3 モデルとも推論は常に有効で、強度は `output_config.effort` で指定します
- ツール呼び出し、Web 検索、画像入力、構造化出力、キャッシュ設定は[完全リファレンス](/ja/api-manual/language-series/kimi/messages/messages-reference)をご覧ください

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

> [!NOTE]
>
> **Kimi モデルでは推論が常に有効**です。レスポンスの `content` には通常 `type="thinking"` ブロックが含まれ、出力トークンに計上されます。`max_tokens` を小さくしすぎると、推論中に出力枠を使い切り、回答本文が返らない場合があります。


## OpenAPI

````yaml ja/api-manual/language-series/kimi/messages/messages-quickstart.json POST /v1/messages
openapi: 3.1.0
info:
  title: Kimi API（全モデル）- Messages クイックスタート
  description: >-
    Anthropic Messages プロトコルで Kimi テキストモデルを呼び出すクイックスタート例です。`model`, `max_tokens`
    と `messages` だけで会話を開始できます。ツール呼び出し、Web 検索、画像入力などは「完全リファレンス」ページをご覧ください。
  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 クイックチャット（全モデル、Anthropic 互換）
      description: >-
        - Anthropic Messages プロトコルで Kimi モデルを呼び出し、`model` でモデルを選択します

        - 必須パラメータは `model`、`max_tokens`、`messages` のみです（Anthropic プロトコルでは
        `max_tokens` が必須）

        - 3 モデルともコンテキストウィンドウは 1,048,576 tokens です

        - 3 モデルとも推論は常に有効で、強度は `output_config.effort` で指定します

        - ツール呼び出し、Web
        検索、画像入力、構造化出力、キャッシュ設定は[完全リファレンス](/ja/api-manual/language-series/kimi/messages/messages-reference)をご覧ください
      operationId: kimiMessagesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageQuickRequest'
            examples:
              simple:
                summary: Pro の最小リクエスト
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 2048
                  messages:
                    - role: user
                      content: コンテキストキャッシュを一文で説明してください。
              highspeed:
                summary: Highspeed：低い推論強度
                value:
                  model: kimi-k3.1-pro-highspeed
                  max_tokens: 2048
                  output_config:
                    effort: low
                  messages:
                    - role: user
                      content: コンテキストキャッシュを一文で説明してください。
              k3:
                summary: Kimi K3 の最小リクエスト
                value:
                  model: kimi-k3
                  max_tokens: 2048
                  messages:
                    - role: user
                      content: コンテキストキャッシュを一文で説明してください。
              multi_turn:
                summary: システムプロンプトと複数ターンの会話
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 2048
                  output_config:
                    effort: low
                  system: あなたは正確さを重視する技術編集者です。簡潔に回答してください。
                  messages:
                    - role: user
                      content: コンテキストキャッシュとは何ですか？
                    - role: assistant
                      content: >-
                        コンテキストキャッシュはリクエストで繰り返されるプレフィックスを保存し、後続のリクエストでヒットすると、より高速かつ低コストで処理できます。
                    - role: user
                      content: どのような用途に適していますか？
              streaming:
                summary: Anthropic SSE ストリーミング
                value:
                  model: kimi-k3.1-pro
                  max_tokens: 2048
                  output_config:
                    effort: low
                  stream: true
                  messages:
                    - role: user
                      content: 夏の夜について 4 行の短い詩を書いてください。
      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:
    CreateMessageQuickRequest:
      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` | 最新世代モデル（推奨） |
            | `kimi-k3.1-pro-highspeed` | Pro と同じパラメータで、より高速に生成 |
            | `kimi-k3` | 前世代モデル |

            3 モデルともコンテキストウィンドウは 1,048,576 tokens で、推論は常に有効です。
        max_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          description: >-
            今回の生成で使用できる最大トークン数。thinking
            と最終テキストを含みます。小さすぎると推論中に出力枠を使い切り、回答本文が返らない場合があります。1024
            以上を推奨し、タスクの複雑さに応じて増やしてください。
        messages:
          type: array
          minItems: 1
          description: 会話メッセージ。複数ターンでは履歴を順番に含めてください。推論とツール呼び出しの履歴を再送する方法は完全リファレンスをご覧ください。
          items:
            $ref: '#/components/schemas/MessageSimple'
        system:
          type: string
          description: >-
            system プロンプト。Messages プロトコルでは system ロールではなく、トップレベルの system
            フィールドを使用します。
        output_config:
          type: object
          description: 出力設定。
          properties:
            effort:
              type: string
              enum:
                - low
                - high
                - max
              default: max
              description: >-
                推論強度。デフォルトは `max`。`kimi-k3` は `max`
                のみ対応します。その他の互換値は完全リファレンスをご覧ください。
        stream:
          type: boolean
          default: false
          description: Anthropic SSE イベントストリームを返すかどうか。
    MessageResponse:
      type: object
      properties:
        id:
          type: string
          description: レスポンス ID。
          example: chatcmpl-6adc72c2b5847b4b2ccb39fd
        type:
          type: string
          enum:
            - message
          example: message
        role:
          type: string
          enum:
            - assistant
          example: assistant
        model:
          type: string
          description: 今回の呼び出しで使用したモデル。
          example: kimi-k3.1-pro
        content:
          type: array
          description: 出力コンテンツブロック。通常は thinking、text の順です。
          items:
            $ref: '#/components/schemas/OutputContentBlock'
        stop_reason:
          type:
            - string
            - 'null'
          enum:
            - end_turn
            - max_tokens
            - tool_use
            - null
          description: >-
            停止理由：`end_turn` は自然な終了、`max_tokens` は出力上限への到達、`tool_use`
            はモデルによるツール呼び出し要求です。
          example: end_turn
        usage:
          $ref: '#/components/schemas/MessageUsage'
    MessageSimple:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          description: メッセージのロール。user と assistant のみをサポートします。
        content:
          type: string
          description: メッセージ内容（プレーンテキスト）。
          example: コンテキストキャッシュを一文で説明してください。
    OutputContentBlock:
      type: object
      properties:
        type:
          type: string
          enum:
            - thinking
            - text
          example: text
        thinking:
          type: string
          description: '`type=thinking` の場合の推論内容。複数ターンでは signature とともに変更せず再送してください。'
        signature:
          type: string
          description: '`type=thinking` の場合の署名。複数ターンでは変更せず再送してください。'
        text:
          type: string
          description: '`type=text` の場合の回答テキスト。'
          example: >-
            コンテキストキャッシュはリクエストで繰り返されるプレフィックスを保存し、後続のリクエストでヒットすると、より高速かつ低コストで処理できます。
    MessageUsage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: 通常入力トークン。キャッシュ読み取りと書き込みは除外済みです。
          example: 24
        cache_read_input_tokens:
          type: integer
          description: キャッシュから提供された入力 tokens。
          example: 0
        cache_creation_input_tokens:
          type: integer
          description: キャッシュに書き込まれた入力 tokens。
          example: 0
        output_tokens:
          type: integer
          description: thinking tokens を含む出力 tokens。
          example: 96
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
        request_id:
          type: string
  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.