> ## 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.

# GLM 全モデルインターフェース - Responses クイックスタート

> model と input で GLM を呼び出します。対応モデルは glm-5.3、glm-5.3-flash、glm-5.3-flashx、glm-5.2 です。思考と本文のために max_output_tokens を 1024 以上に設定することを推奨します。

追加の例とモデルの違いは[完全なパラメータ](./responses-reference)を参照してください。

<Note>
  **BaseURL**：デフォルトの BaseURL は `https://direct.evolink.ai` で、テキストモデルへの対応が優れており、長時間接続をサポートします。`https://api.evolink.ai` はマルチモーダルサービスの主力エンドポイントで、テキストモデルに対しては代替アドレスとして使用されます。
</Note>

POST /v1/responses を使用し、model でモデルを選択します。必須フィールドは model と input です。例では使い始めやすいように、出力上限と推論強度も指定しています。

<Warning>
  Responses はトップレベルの `reasoning_effort` や `thinking` ではなく、ネストした `reasoning.effort` を使用します。思考の使用量は `output_tokens` に含まれます。簡単なタスクで `reasoning_tokens=0` が返っても、思考の無効化に対応することを意味しません。

  推論強度。`low` を推奨します。

  **`glm-5.3` / `glm-5.3-flash` / `glm-5.3-flashx` の互換ルール**

  | 指定値                    | 実際の思考レベル       |
  | ---------------------- | -------------- |
  | `low` / `high` / `max` | 同じレベルを維持       |
  | `xhigh`                | `max`          |
  | `medium`               | `high`         |
  | `minimal` / `none`     | `low`。思考は有効なまま |

  **`minimal` と `none` は 5.3 シリーズの思考を無効にしません。** 思考トークンは出力として課金されます。認識されない値は互換変換せず、そのまま扱われます。表の値を使用してください。これらの互換ルールは `glm-5.2` には適用されません。

  このエンドポイントでは `glm-5.2` に `none` を指定しても思考トークンが生成される場合があり、思考の無効化は保証されません。
</Warning>

## 本文を読み取る

順序付き出力項目。`type=message` の content 内にある `type=output_text` の text が本文です。reasoning が本文より前に来る場合や、`function_call` のターンに本文がない場合があります。常に output\[0] を読む実装は避けてください。

応答 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>
  今回の生成の出力トークン上限。思考トークンも含みます。1024 を目安にタスクに応じて調整してください。少なすぎると思考中に上限に達し、reasoning 項目のみで本文が返らない場合があります。status と `incomplete_details` を確認してください。パラメータ名は `max_tokens` ではなく `max_output_tokens` です。
</Note>

ツール呼び出し、画像入力、SSE 処理、複数ターンの会話は[完全なパラメータ](./responses-reference)を参照してください。


## OpenAPI

````yaml ja/api-manual/language-series/glm/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: GLM 全モデルインターフェース - Responses クイックスタート
  description: >-
    OpenAI 互換の Responses 形式で智譜 GLM
    シリーズを呼び出します。glm-5.3、glm-5.3-flash、glm-5.3-flashx、glm-5.2
    に対応します。オプション機能はモデルによって異なります。
  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: Responses
    description: GLM Responses API
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: GLM Responses クイックスタート
      description: >-
        model と input で GLM を呼び出します。対応モデルは
        glm-5.3、glm-5.3-flash、glm-5.3-flashx、glm-5.2 です。思考と本文のために
        max_output_tokens を 1024 以上に設定することを推奨します。


        追加の例とモデルの違いは[完全なパラメータ](./responses-reference)を参照してください。
      operationId: glmResponsesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
            examples:
              basic:
                summary: 基本的なテキスト対話
                value:
                  model: glm-5.3-flash
                  input: 自己紹介を一文でしてください。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
              stream:
                summary: SSE ストリーミング出力
                value:
                  model: glm-5.3-flash
                  input: 自己紹介を一文でしてください。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
                  stream: true
              flashx:
                summary: GLM-5.3-FlashX を呼び出す
                value:
                  model: glm-5.3-flashx
                  input: 自己紹介を一文でしてください。
                  max_output_tokens: 1024
                  reasoning:
                    effort: low
      responses:
        '200':
          description: 生成完了または不完全な結果。status を確認してください。ストリーミングでは text/event-stream を返します。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
              example:
                id: response_demo
                object: response
                created_at: 1789971757
                model: glm-5.3-flash
                status: completed
                output:
                  - type: message
                    id: message_demo
                    status: completed
                    role: assistant
                    content:
                      - type: output_text
                        text: こんにちは、GLM です。会話、文章作成、プログラミングをお手伝いします。
                        annotations: []
                usage:
                  input_tokens: 17
                  output_tokens: 24
                  total_tokens: 41
                  input_tokens_details:
                    cached_tokens: 0
                  output_tokens_details:
                    reasoning_tokens: 0
                error: null
            text/event-stream:
              schema:
                type: string
              example: >+
                event: response.output_text.delta

                data:
                {"type":"response.output_text.delta","item_id":"message_demo","output_index":0,"content_index":0,"delta":"こんにちは"}


                event: response.completed

                data:
                {"type":"response.completed","response":{"id":"response_demo","object":"response","created_at":1789971757,"model":"glm-5.3-flash","status":"completed","output":[{"type":"message","id":"message_demo","status":"completed","role":"assistant","content":[{"type":"output_text","text":"こんにちは","annotations":[]}]}],"usage":{"input_tokens":17,"output_tokens":3,"total_tokens":20},"error":null}}

        '400':
          description: >-
            無効なリクエストパラメータ。input の欠落、reasoning の形式不正、previous_response_id
            に非対応のモデルなどが該当します。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: API キーが無効、または有効期限切れです。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: 利用可能なクレジットが不足しています。
          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'
        '503':
          description: サービスを一時的に利用できません。後で再試行してください。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ResponsesQuickRequest:
      type: object
      properties:
        model:
          type: string
          description: >-
            GLM モデルを選択します。4 モデルともこのエンドポイントのテキスト入力に対応します。オプション機能はモデルによって異なります。


            | モデル ID | 入力 | 推論に関する注意 |

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

            | `glm-5.3` | テキスト | 実際のレベルは low / high / max。互換値は reasoning
            を参照。思考は無効化できません。 |

            | `glm-5.3-flash` | テキスト、画像 | glm-5.3 と同じ。画像には input_image を使用します。 |

            | `glm-5.3-flashx` | テキスト、画像 | glm-5.3 と同じ。画像には input_image を使用します。
            |

            | `glm-5.2` | テキスト | none でも思考トークンが生成される場合があり、思考の無効化は保証されません。 |
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.3-flashx
            - glm-5.2
          default: glm-5.3-flash
          example: glm-5.3-flash
        input:
          description: >-
            必須。テキスト文字列、または Responses
            入力項目の配列。配列にはメッセージ、モデル出力の再送項目、function_call_output
            を含められます。複数ターンでは毎回すべての履歴を送信できます。システムプロンプトは先頭の role=system
            メッセージに置くことを推奨します。画像は input_image を使用し、glm-5.3-flash と glm-5.3-flashx
            のみ対応します。Chat Completions の messages / image_url ブロック形式は使用しないでください。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/InputItem'
          example: 自己紹介を一文でしてください。
        max_output_tokens:
          type: integer
          minimum: 1
          description: >-
            今回の生成の出力トークン上限。思考トークンも含みます。1024
            を目安にタスクに応じて調整してください。少なすぎると思考中に上限に達し、reasoning
            項目のみで本文が返らない場合があります。status と incomplete_details を確認してください。パラメータ名は
            max_tokens ではなく max_output_tokens です。
          example: 1024
        stream:
          type: boolean
          default: false
          description: >-
            SSE ストリーミングを有効にします。本文は response.output_text.delta の delta
            から読み取ります。成功時の終了イベントは response.completed
            です。response.incomplete、response.failed、error
            でもそのターンを終了して処理してください。[DONE] や接続終了だけを待たないでください。
        reasoning:
          type: object
          properties:
            effort:
              type: string
              description: >-
                推論強度。low を推奨します。


                **glm-5.3 / glm-5.3-flash / glm-5.3-flashx の互換ルール**


                | 指定値 | 実際の思考レベル |

                | --- | --- |

                | `low` / `high` / `max` | 同じレベルを維持 |

                | `xhigh` | `max` |

                | `medium` | `high` |

                | `minimal` / `none` | low。思考は有効なまま |


                **minimal と none は 5.3 シリーズの思考を無効にしません。**
                思考トークンは出力として課金されます。認識されない値は互換変換せず、そのまま扱われます。表の値を使用してください。これらの互換ルールは
                glm-5.2 には適用されません。


                このエンドポイントでは glm-5.2 に none
                を指定しても思考トークンが生成される場合があり、思考の無効化は保証されません。
              enum:
                - max
                - xhigh
                - high
                - medium
                - low
                - minimal
                - none
              example: low
          description: >-
            Responses はトップレベルの reasoning_effort や thinking ではなく、ネストした
            reasoning.effort を使用します。思考の使用量は output_tokens に含まれます。簡単なタスクで
            reasoning_tokens=0 が返っても、思考の無効化に対応することを意味しません。
      required:
        - model
        - input
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: 今回の応答 ID。previous_response_id にはそのまま指定します。
          example: response_demo
        object:
          type: string
          const: response
        created_at:
          type: integer
          description: 作成時刻。Unix 秒単位。
        model:
          type: string
          example: glm-5.3-flash
        status:
          type: string
          description: >-
            completed は今回の生成終了を示し、ツール呼び出しのみの場合もあります。incomplete
            は出力が不完全であることを示します。output と error を両方確認してください。
          enum:
            - completed
            - incomplete
            - failed
            - in_progress
            - queued
        output:
          type: array
          items:
            $ref: '#/components/schemas/OutputItem'
          description: >-
            順序付き出力項目。type=message の content 内にある type=output_text の text
            が本文です。reasoning が本文より前に来る場合や、function_call のターンに本文がない場合があります。常に
            output[0] を読む実装は避けてください。
        output_text:
          type: string
          description: 本文を集約したオプションフィールド。存在しない場合があります。汎用クライアントでは output を走査してください。
        usage:
          $ref: '#/components/schemas/Usage'
        error:
          type:
            - object
            - 'null'
          description: 応答エラー。成功時は通常 null です。
          additionalProperties: true
        incomplete_details:
          type: object
          properties:
            reason:
              type: string
              description: 出力が打ち切られた場合の詳細。例：max_output_tokens。
        metadata:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - integer
                - 'null'
      required:
        - error
    InputItem:
      description: >-
        メッセージ、関数結果、または前の output からそのまま再送する項目。ツール結果には返された call_id
        を使用し、前の出力項目の元のフィールドを保持してください。
      oneOf:
        - $ref: '#/components/schemas/InputMessage'
        - $ref: '#/components/schemas/FunctionCallOutput'
        - type: object
          properties:
            type:
              type: string
              description: 再送する出力項目の種類。
              enum:
                - function_call
                - reasoning
                - web_search_call
            id:
              type: string
            call_id:
              type: string
            name:
              type: string
            arguments:
              type: string
              description: JSON 文字列にエンコードされた引数。
            status:
              type: string
            action:
              type: object
              additionalProperties: true
              description: web_search_call の検索またはページアクセスの操作。
          required:
            - type
    OutputItem:
      type: object
      properties:
        type:
          type: string
          description: 主な種類：message、reasoning、function_call、web_search_call。
          enum:
            - message
            - reasoning
            - function_call
            - web_search_call
        id:
          type: string
        status:
          type: string
        role:
          type: string
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
              annotations:
                type: array
                items:
                  type: object
          description: message 内は output_text、reasoning 内は reasoning_text の場合があります。
        summary:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
          description: 思考内容は summary_text で返る場合もあります。すべての reasoning 項目に content があるとは限りません。
        call_id:
          type: string
          description: 結果の返送に使用する関数呼び出し ID。
        name:
          type: string
          description: 関数名。
        arguments:
          type: string
          description: 関数引数の JSON 文字列。実行前に解析と検証を行ってください。
        action:
          type: object
          additionalProperties: true
          description: web_search_call の検索またはページアクセスの操作。
      required:
        - type
    Usage:
      type: object
      properties:
        input_tokens:
          type: integer
          description: 入力トークン総数。キャッシュにヒットした分を含みます。
        output_tokens:
          type: integer
          description: 出力トークン総数。思考トークンを含みます。
        total_tokens:
          type: integer
          description: 入力と出力のトークン合計。
        input_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
              description: >-
                入力のうちキャッシュにヒットしたトークン数。input_tokens
                に再加算しないでください。プレフィックスキャッシュは自動で、明示的な cache_control
                は不要です。ヒット数は返された値で確認してください。
        output_tokens_details:
          type: object
          properties:
            reasoning_tokens:
              type: integer
              description: >-
                出力のうち思考に使われたトークン数。output_tokens に二重計上しないでください。この詳細は省略される場合や 0
                の場合があります。
    InputMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
        content:
          description: >-
            テキスト文字列または入力コンテンツブロックの配列。既存の assistant 出力を再送する場合、output_text
            ブロックをそのまま保持できます。
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/InputText'
                  - $ref: '#/components/schemas/InputImage'
                  - $ref: '#/components/schemas/OutputText'
      required:
        - role
        - content
    FunctionCallOutput:
      type: object
      properties:
        type:
          type: string
          const: function_call_output
        call_id:
          type: string
          description: 元の function_call の call_id。
        output:
          type: string
          description: 関数結果。通常は JSON エンコードされた文字列です。
      required:
        - type
        - call_id
        - output
    InputText:
      type: object
      properties:
        type:
          type: string
          const: input_text
        text:
          type: string
      required:
        - type
        - text
    InputImage:
      type: object
      properties:
        type:
          type: string
          const: input_image
        image_url:
          type: string
          description: >-
            公開画像 URL または Base64 Data URL。PNG
            の例：data:image/png;base64,...。画像に対応するのは glm-5.3-flash /
            glm-5.3-flashx のみです。glm-5.3 と glm-5.2 にはテキストのみを使用してください。
      required:
        - type
        - image_url
    OutputText:
      type: object
      properties:
        type:
          type: string
          const: output_text
        text:
          type: string
        annotations:
          type: array
          items:
            type: object
      required:
        - type
        - text
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Authorization ヘッダーに Bearer YOUR_API_KEY を指定します。

````