> ## 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（全モデル）- Responses クイックスタート

> `model` と `input` で Kimi を呼び出します。`kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed`、`kimi-k3` に対応します。`max_output_tokens` は 1024 から設定し、推論と回答の両方に余裕を持たせてください。

その他の例とモデルの違いは[完全リファレンス](/ja/api-manual/language-series/kimi/responses/responses-reference)をご覧ください。

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

`POST /v1/responses` を使用し、`model` で `kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed`、`kimi-k3` を選択します。必須項目は `model` と `input` のみです。

> [!WARNING]
>
> **パラメータ名は Chat Completions と異なります**：入力は `input`、出力上限は `max_output_tokens`、推論強度は `reasoning.effort` を使用します。

## 回答本文の読み取り

レスポンスの `output` には推論、回答本文、ツール呼び出しが含まれる場合があります。`type="message"` の `output_text` コンテンツブロックを走査してください。先頭の項目が本文とは限りません。

レスポンス JSON を `response` にパース済みの場合、次のようにテキストを抽出できます。

```python theme={null}
text = "".join(
    part["text"]
    for item in response.get("output", [])
    if item.get("type") == "message"
    for part in item.get("content", [])
    if part.get("type") == "output_text"
)
print(text)
```

> [!NOTE]
>
> **推論用の出力枠を確保してください**：`max_output_tokens` は推論と回答本文の両方を含みます。`status="incomplete"` かつ `incomplete_details.reason="max_output_tokens"` の場合は上限を増やしてください。出力枠を使い切ると、推論項目のみが返り、本文が含まれない場合があります。

ツール呼び出し、Web 検索、画像入力、構造化出力は[完全リファレンス](https://evolink.ai/docs/ja/api-manual/language-series/kimi/responses/responses-reference.md)をご覧ください。


## OpenAPI

````yaml ja/api-manual/language-series/kimi/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: Kimi API（全モデル）- Responses クイックスタート
  description: >-
    OpenAI Responses プロトコルで Kimi テキストモデルを呼び出すクイックスタート例です。`model` と `input`
    だけで会話を開始できます。ツール呼び出し、Web 検索、構造化出力、画像入力などは「完全リファレンス」ページをご覧ください。
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 本番環境（推奨）
  - url: https://api.evolink.ai
    description: 代替 URL
security:
  - bearerAuth: []
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: Kimi Responses のクイック呼び出し
      description: >-
        `model` と `input` で Kimi
        を呼び出します。`kimi-k3.1-pro`、`kimi-k3.1-pro-highspeed`、`kimi-k3`
        に対応します。`max_output_tokens` は 1024 から設定し、推論と回答の両方に余裕を持たせてください。


        その他の例とモデルの違いは[完全リファレンス](/ja/api-manual/language-series/kimi/responses/responses-reference)をご覧ください。
      operationId: kimiResponsesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
            examples:
              simple:
                summary: Pro の最小リクエスト
                value:
                  model: kimi-k3.1-pro
                  input: コンテキストキャッシュを一文で説明してください。
              highspeed:
                summary: Highspeed：低い推論強度
                value:
                  model: kimi-k3.1-pro-highspeed
                  input: コンテキストキャッシュを一文で説明してください。
                  reasoning:
                    effort: low
                  max_output_tokens: 1024
              k3:
                summary: Kimi K3 の最小リクエスト
                value:
                  model: kimi-k3
                  input: コンテキストキャッシュを一文で説明してください。
              multi_turn:
                summary: システムプロンプトと複数ターンの会話
                value:
                  model: kimi-k3.1-pro
                  input:
                    - role: developer
                      content: あなたは正確さを重視する技術編集者です。簡潔に回答してください。
                    - role: user
                      content: コンテキストキャッシュとは何ですか？
                    - role: assistant
                      content: >-
                        コンテキストキャッシュはリクエストで繰り返されるプレフィックスを保存し、後続のリクエストでヒットすると、より高速かつ低コストで処理できます。
                    - role: user
                      content: どのような用途に適していますか？
                  reasoning:
                    effort: low
                  max_output_tokens: 2048
              streaming:
                summary: SSE ストリーミング出力
                value:
                  model: kimi-k3.1-pro
                  input: 夏の夜について 4 行の短い詩を書いてください。
                  reasoning:
                    effort: low
                  max_output_tokens: 2048
                  stream: true
      responses:
        '200':
          description: レスポンスの作成に成功。ストリーミングでは SSE イベントストリームを返します
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
            text/event-stream:
              schema:
                type: string
                description: >-
                  Responses 形式の SSE
                  イベントストリーム。`response.completed`、`response.incomplete`、`response.failed`
                  のいずれかのイベントで終了します。
        '400':
          description: リクエストエラー：無効なパラメータ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 認証エラー：API キーが無効または未指定
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: レート制限超過またはクォータ不足
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: サーバーエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ResponsesQuickRequest:
      type: object
      required:
        - model
        - input
      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 で、推論は常に有効です。
        input:
          description: 今回のリクエストの入力。文字列は 1 件の user メッセージと同じで、配列では過去のメッセージを順番に指定します。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/InputMessage'
        max_output_tokens:
          type: integer
          minimum: 1
          maximum: 1048576
          default: 131072
          description: 推論と最終回答を含む最大生成トークン数。デフォルト 131072、最大 1048576。
        reasoning:
          type: object
          description: 推論に関する設定。
          properties:
            effort:
              type: string
              enum:
                - low
                - high
                - max
              default: max
              description: >-
                推論強度。デフォルトは `max`。`kimi-k3` は `max`
                のみ対応します。その他の互換値は完全リファレンスをご覧ください。
        stream:
          type: boolean
          default: false
          description: true の場合、SSE イベントストリームで応答を返します。
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: レスポンス ID。
          example: resp_6adc72aab1f2eaaebe6b869e
        object:
          type: string
          enum:
            - response
          example: response
        created_at:
          type: integer
          description: 作成日時。Unix タイムスタンプ（秒）。
          example: 1792832171
        status:
          type: string
          enum:
            - completed
            - incomplete
            - failed
          description: レスポンスの状態。`incomplete` は通常、`max_output_tokens` の上限への到達を示します。
          example: completed
        incomplete_details:
          type:
            - object
            - 'null'
          description: '`status` が `incomplete` の場合の理由。'
          properties:
            reason:
              type: string
              enum:
                - max_output_tokens
                - content_filter
        model:
          type: string
          description: 今回の呼び出しで使用したモデル。
          example: kimi-k3.1-pro
        output:
          type: array
          description: 出力項目の配列。通常は reasoning、message の順です。
          items:
            $ref: '#/components/schemas/OutputItem'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: エラー原因を説明するメッセージ。
            type:
              type: string
              description: エラータイプ
            code:
              type: string
              description: エラーコード
          required:
            - message
      required:
        - error
    InputMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
            - developer
          description: メッセージの役割。`developer` はシステム指示として扱います。
        content:
          type: string
          description: メッセージ内容（プレーンテキスト）。
          example: コンテキストキャッシュを一文で説明してください。
    OutputItem:
      type: object
      properties:
        type:
          type: string
          enum:
            - reasoning
            - message
          description: '`reasoning` は推論内容、`message` は最終回答です。'
          example: message
        id:
          type: string
          example: msg_6adc72aab1f2eaaebe6b869f
        summary:
          type: array
          description: '`type=reasoning` の場合の推論内容。'
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - summary_text
              text:
                type: string
        role:
          type: string
          enum:
            - assistant
          description: '`type=message` の場合に返されます。'
        content:
          type: array
          description: '`type=message` の場合の回答内容。'
          items:
            $ref: '#/components/schemas/OutputText'
        status:
          type: string
          enum:
            - completed
          example: completed
    Usage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: キャッシュヒット分を含む入力トークン。
          example: 24
        input_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: キャッシュから提供された入力 tokens。
              example: 0
        output_tokens:
          type: integer
          description: 推論トークンを含む出力トークン。
          example: 96
        output_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: 推論トークン。output_tokens に含まれます。
              example: 62
        total_tokens:
          type: integer
          description: 入力と出力の合計 tokens。
          example: 120
    OutputText:
      type: object
      properties:
        type:
          type: string
          enum:
            - output_text
          example: output_text
        text:
          type: string
          example: >-
            コンテキストキャッシュはリクエストで繰り返されるプレフィックスを保存し、後続のリクエストでヒットすると、より高速かつ低コストで処理できます。
  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.