> ## 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 全モデルインターフェース - Chat Completions 完全なパラメータ

> - OpenAI Chat Completions プロトコルで GLM シリーズのモデルを呼び出し（モデルは `model` パラメータで選択）
- 同期処理モードで、対話内容をリアルタイムに返します
- **テキスト対話**：シングルターンまたはマルチターンのコンテキスト対話。`glm-5.3-flash` は画像入力にも対応
- **システムプロンプト**：`role=system` メッセージで AI の役割と振る舞いをカスタマイズ
- **深い思考**：`thinking.type` で思考連鎖を制御し、`reasoning_effort` で推論の強度を調節。推論過程は `reasoning_content` で返されます
- **ストリーミング出力**：SSE でのストリーミング返却に対応（`stream=true`）
- **ツール呼び出し**：Function Calling とウェブ検索に対応（`web_search`、最大 128 個のツール）
- **構造化出力**：`response_format` で JSON モードを有効化

**ストリーミングレスポンスについて**：`stream=true` の場合、Server-Sent Events で返却され、各メッセージの形式は `data: {JSON}`、終了時に `data: [DONE]` が返ります。各データチャンク（`ChatCompletionChunk`）には `id`、`created`、`model`、`choices`、および任意で `usage` と `content_filter` が含まれます。そのうち `choices[].delta` は `role` / `content` / `reasoning_content` / `tool_calls` を差分で返し、`choices[].finish_reason` は最後のチャンクで終了理由を示します。

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

<Note>
  **思考の制御はモデルによって異なります**：`glm-5.3` と `glm-5.3-flash` は常に思考し、無効化できません。`reasoning_effort` は `low` / `high` / `max` の 3 段階が実際に効き、その他の段階は最も近い利用可能な段階へ自動的に降格されます（`xhigh` → `max`、`medium` → `high`、`minimal` / `none` → `low`。いずれも思考は継続し、output として課金されます）。`glm-5.2` は `thinking.type: "disabled"` で思考を無効化でき、より多くの推論段階に対応します。詳細は `thinking` と `reasoning_effort` フィールドの説明をご覧ください。
</Note>

<Note>
  **画像入力**：対応しているのは `glm-5.3-flash` のみで、`messages[].content[]` の `image_url` コンテンツブロックで渡します。他のモデルに画像ブロックを渡すとエラーになります。
</Note>


## OpenAPI

````yaml ja/api-manual/language-series/glm/chat-completions/chat-completions-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GLM 全モデルインターフェース - Chat Completions 完全なパラメータ
  description: >-
    OpenAI 互換の Chat Completions API で Zhipu GLM シリーズのテキストモデルを呼び出すための完全な API
    リファレンス。


    **収録モデル**：`glm-5.3`、`glm-5.3-flash`、`glm-5.2`（`model` パラメータで選択）


    **共通の機能**：

    - 1M token のコンテキストウィンドウ、最大出力 **131,072 tokens**（128K）、**1,024 tokens** 以上を推奨

    - 深い思考：`thinking` フィールドで思考連鎖を制御し、`reasoning_effort` で推論の強度を調節。推論過程は
    `reasoning_content` で返されます

    - ツール呼び出し：Function Calling、ウェブ検索（最大 128 個のツール）

    - ストリーミング出力：SSE でのストリーミング返却

    - 構造化出力：`text` / `json_object` の 2 つのレスポンス形式

    - コンテキストキャッシュ：暗黙のプレフィックスキャッシュ。同じプレフィックスの繰り返しリクエストは自動的にヒットし、ヒット分は
    `usage.prompt_tokens_details.cached_tokens` に反映されます


    **モデル間の違い**（思考の制御、画像入力）は、以下の `model` および `thinking` / `reasoning_effort`
    フィールドの説明をご覧ください。
  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: チャット補完
    description: AI 対話生成に関連するエンドポイント
paths:
  /v1/chat/completions:
    post:
      tags:
        - チャット補完
      summary: GLM チャット補完（全モデル、OpenAI 互換）
      description: >-
        - OpenAI Chat Completions プロトコルで GLM シリーズのモデルを呼び出し（モデルは `model`
        パラメータで選択）

        - 同期処理モードで、対話内容をリアルタイムに返します

        - **テキスト対話**：シングルターンまたはマルチターンのコンテキスト対話。`glm-5.3-flash` は画像入力にも対応

        - **システムプロンプト**：`role=system` メッセージで AI の役割と振る舞いをカスタマイズ

        - **深い思考**：`thinking.type` で思考連鎖を制御し、`reasoning_effort` で推論の強度を調節。推論過程は
        `reasoning_content` で返されます

        - **ストリーミング出力**：SSE でのストリーミング返却に対応（`stream=true`）

        - **ツール呼び出し**：Function Calling とウェブ検索に対応（`web_search`、最大 128 個のツール）

        - **構造化出力**：`response_format` で JSON モードを有効化


        **ストリーミングレスポンスについて**：`stream=true` の場合、Server-Sent Events
        で返却され、各メッセージの形式は `data: {JSON}`、終了時に `data: [DONE]`
        が返ります。各データチャンク（`ChatCompletionChunk`）には
        `id`、`created`、`model`、`choices`、および任意で `usage` と `content_filter`
        が含まれます。そのうち `choices[].delta` は `role` / `content` / `reasoning_content`
        / `tool_calls` を差分で返し、`choices[].finish_reason` は最後のチャンクで終了理由を示します。
      operationId: createChatCompletionGLM
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: シングルターンのテキスト対話
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: 自己紹介してください
              multi_turn:
                summary: マルチターン対話（文脈理解）
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: Python とは何ですか？
                    - role: assistant
                      content: Python は高水準プログラミング言語です...
                    - role: user
                      content: どんな利点がありますか？
              system_prompt:
                summary: システムプロンプトの使用
                value:
                  model: glm-5.3
                  messages:
                    - role: system
                      content: あなたはプロの Python プログラミングアシスタントです。簡潔な言葉で質問に答えてください。
                    - role: user
                      content: ファイルを読み込むにはどうすればよいですか？
              deep_thinking:
                summary: 深い思考を有効化して推論強度を調整
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: >-
                        農夫がオオカミ、ヤギ、キャベツを連れて川を渡ろうとしています。一度に運べるのは 1
                        つだけです。どうすれば安全に川を渡れますか？
                  thinking:
                    type: enabled
                  reasoning_effort: max
              function_calling:
                summary: ツール呼び出し（Function Calling）
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: 北京の今日の天気はどうですか？
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: 指定した都市のリアルタイムの天気を照会します
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: 都市名、例：北京
                          required:
                            - city
                  tool_choice: auto
              web_search:
                summary: ウェブ検索ツールを有効化
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: 直近 1 週間の人工知能のニュースを調べてください
                  tools:
                    - type: web_search
                      web_search:
                        enable: true
                        count: 10
                        search_recency_filter: oneWeek
                description: >-
                  モデルがインターネットを必要と判断すると自動的に検索し、検索結果はコンテキストに統合されて推論に使われます。検索結果は入力トークンとして課金され、検索サービス自体は別途
                  1 回ごとに課金されます（詳細は料金ページをご覧ください）。モデルが検索を実行しなかった場合、検索料金は発生しません。
              json_mode:
                summary: JSON 構造化出力
                value:
                  model: glm-5.3
                  messages:
                    - role: system
                      content: name と age の 2 つのフィールドを含む JSON 形式で出力してください。
                    - role: user
                      content: 張三、今年 28 歳
                  response_format:
                    type: json_object
              streaming:
                summary: ストリーミング出力（SSE）
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: 春についての短い詩を書いてください
                  stream: true
              disable_thinking_glm52_only:
                summary: 深い思考を無効化（glm-5.2 のみ対応）
                value:
                  model: glm-5.2
                  messages:
                    - role: user
                      content: 相対性理論を一文で要約してください。
                  thinking:
                    type: disabled
                description: >-
                  思考を無効にできるのは `glm-5.2` のみです。`glm-5.3` と `glm-5.3-flash` に
                  `thinking.type: "disabled"` を渡すとエラーになるため、代わりに
                  `reasoning_effort: "low"` を使ってください。
              low_effort:
                summary: 思考コストを抑える（glm-5.3 シリーズで思考を無効化する代わりの方法）
                description: >-
                  `glm-5.3` シリーズは思考を無効にできません。`reasoning_effort: "low"`
                  で推論の強度を最小まで下げてください。
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: HTTP を一文で説明してください
                  thinking:
                    type: enabled
                  reasoning_effort: low
                  max_tokens: 1024
              vision_flash:
                summary: 画像入力（glm-5.3-flash のみ）
                description: >-
                  `glm-5.3-flash` はビジョンにネイティブ対応しています。画像は `image_url`
                  コンテンツブロックで渡し、公開 URL または Base64 データ URL が使えます。
                value:
                  model: glm-5.3-flash
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: この画像には何が写っていますか？
                        - type: image_url
                          image_url:
                            url: https://example.com/photo.jpg
                  max_tokens: 1024
      responses:
        '200':
          description: チャット補完が正常に生成されました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: リクエストパラメータエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未認可、トークンが無効または期限切れです
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: クォータ不足、チャージが必要
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '403':
          description: アクセス拒否
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
                  param: model
        '404':
          description: リソースが存在しません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
                  fallback_suggestion: glm-5.3
        '429':
          description: レート制限を超過しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: 内部サーバーエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
                  fallback_suggestion: try again later
        '502':
          description: 上流サービスエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Upstream AI service unavailable
                  type: upstream_error
                  fallback_suggestion: try different model
        '503':
          description: サービス一時利用不可
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: service_unavailable_error
                  fallback_suggestion: retry after 30 seconds
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >
            呼び出すモデル：


            | モデル ID | 位置づけ | 思考の制御 | 画像入力 |

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

            | `glm-5.3` |
            フラッグシップモデル。複雑なソフトウェアエンジニアリングとエージェントタスクの能力が全面的に向上し、コーディング能力は前世代から大幅に強化；1M
            コンテキスト | 常に思考し、無効化できません。`reasoning_effort` は `low` / `high` / `max`
            のみ実際に効き、その他のレベルは自動的に降格されます | 非対応 |

            | `glm-5.3-flash` |
            軽量マルチモーダルモデル。スパースアテンションとリニアアテンションのハイブリッド構成で、コストが極めて低くビジョンにネイティブ対応；1M
            コンテキスト | `glm-5.3` と同じ | **対応**。`messages` フィールドを参照 |

            | `glm-5.2` | 前世代のフラッグシップ。複雑な推論と超長コンテキスト；1M コンテキスト | `thinking.type:
            "disabled"` で無効化できます。`reasoning_effort` は 7 段階すべてに対応 | 非対応 |
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.2
          default: glm-5.3
          example: glm-5.3
        messages:
          type: array
          description: >-
            対話メッセージのリスト。現在の対話の完全な文脈情報を含みます


            `system`、`user`、`assistant`、`tool` の 4
            種類の役割に対応します。役割が異なるメッセージは異なるフィールド構造を持つため、対応する役割を選択して確認してください。少なくとも 1
            件のメッセージを含む必要があり、システムメッセージまたはアシスタントメッセージのみで構成することはできません。
          items:
            oneOf:
              - $ref: '#/components/schemas/SystemMessage'
              - $ref: '#/components/schemas/UserMessage'
              - $ref: '#/components/schemas/AssistantRequestMessage'
              - $ref: '#/components/schemas/ToolMessage'
            discriminator:
              propertyName: role
              mapping:
                system:
                  $ref: '#/components/schemas/SystemMessage'
                user:
                  $ref: '#/components/schemas/UserMessage'
                assistant:
                  $ref: '#/components/schemas/AssistantRequestMessage'
                tool:
                  $ref: '#/components/schemas/ToolMessage'
          minItems: 1
        stream:
          type: boolean
          description: >-
            ストリーミング出力モードを有効にするかどうか


            - `false`：モデルが完全なレスポンスを生成してから一括で返します（デフォルト）。短いテキストやバッチ処理に適しています

            - `true`：Server-Sent
            Events（SSE）でチャンクごとにリアルタイムに返します。チャットや長文に適しています。ストリーミング終了時に `data:
            [DONE]` を返します
          default: false
          example: false
        thinking:
          type: object
          description: 思考連鎖（Chain of Thought）を有効にするかどうかを制御します
          properties:
            type:
              type: string
              description: >-
                思考連鎖のスイッチ


                - `enabled`：深い思考を有効化（すべてのモデルのデフォルト動作）

                - `disabled`：深い思考を無効化し、モデルが直接回答します


                **`disabled` に対応しているのは `glm-5.2` のみです。** `glm-5.3` と
                `glm-5.3-flash` は常に思考し、`disabled` を渡すとエラーになります。


                `glm-5.3` シリーズで思考コストを下げたい場合は、代わりに `reasoning_effort: "low"`
                を使ってください。


                **`glm-5.2` からの移行**：既存コードで `thinking.type: "disabled"`
                をハードコードしている場合、`glm-5.3` に切り替える前に `"enabled"`
                へ変更する必要があります（思考コストを下げたい場合はさらに `reasoning_effort: "low"`
                を指定）。そうしないとリクエストが直接失敗します。


                この 2 つのフィールドは扱いが**異なる**点に注意してください：`reasoning_effort`
                は該当シリーズが対応しないレベルを渡しても自動的に降格され、エラーにはなりません。一方 `thinking.type`
                は明示的なスイッチで、`disabled` を渡すと必ずエラーになり、暗黙に書き換えられることはありません。したがって
                `reasoning_effort` を `none` から `low`
                に変えるだけでは不十分で、`thinking.type` も併せて変更する必要があります。
              enum:
                - enabled
                - disabled
              default: enabled
            clear_thinking:
              type: boolean
              description: >-
                過去の対話ターンの `reasoning_content` をクリアするかどうか


                - `true`（デフォルト）：過去ターンの `reasoning_content` を無視 /
                削除し、推論以外の内容（ユーザー /
                アシスタントの可視テキスト、ツール呼び出しとその結果など）のみを文脈として使用します。コンテキスト長とコストを削減できます

                - `false`：過去ターンの `reasoning_content`
                を保持し、文脈とともにモデルへ渡します（Preserved Thinking）。この場合、過去の
                `reasoning_content` を `messages`
                内で**完全に、未修正のまま、元の順序で**透過する必要があります。欠落、切り詰め、書き換え、並べ替えがあると効果が低下したり機能しなくなったりします

                - 注意：このパラメータはターンをまたぐ過去の思考にのみ影響し、現在のターンで思考を生成するかどうかは変わりません
              default: true
              example: true
        reasoning_effort:
          type: string
          description: >-
            モデルの推論の強度を制御します。`thinking` が有効な場合にのみ効き、デフォルトは `max` です


            **対応する値はモデルによって異なります**：


            | 値 | `glm-5.3` / `glm-5.3-flash` | `glm-5.2` |

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

            | `max` | 深い推論（デフォルト） | 深い推論 |

            | `high` | 強化された推論 | 強化された推論 |

            | `low` | 軽量な推論 | `high` と同等 |

            | `xhigh` | `max` に降格 | `max` と同等 |

            | `medium` | `high` に降格 | `high` と同等 |

            | `minimal` | `low` に降格（思考は継続） | 思考を行いません |

            | `none` | `low` に降格（思考は継続） | 思考を行いません |


            `glm-5.3` シリーズは常に思考し、実際に効くのは `low` / `high` / `max` の 3 段階です。残る 4
            つはエラーにはならず、最も近い利用可能な段階へ自動的に降格されます（`xhigh` → `max`、`medium` →
            `high`、`minimal` / `none` → `low`）。


            **`glm-5.3` シリーズは思考を無効にできません。** `minimal` や `none` を渡しても最低段階の `low`
            に下がるだけで、モデルは思考トークンを生成し続け、**output 単価で課金**されます。コスト削減のためにこの 2
            つを渡している場合、`glm-5.2` とは異なる点にご注意ください。`glm-5.2` では実際に思考を行いません。


            プログラミングなど複雑なタスクには `max` を推奨します。
          enum:
            - max
            - xhigh
            - high
            - medium
            - low
            - minimal
            - none
          default: max
          example: max
        do_sample:
          type: boolean
          description: >-
            サンプリング戦略を有効にするかどうか


            - `true`（デフォルト）：`temperature` / `top_p`
            を用いてランダムサンプリングを行い、出力がより多様になります

            - `false`：常に確率が最も高い語彙を選択し（貪欲デコード）、出力がより定まります。この場合 `temperature` と
            `top_p` は無視されます


            一貫性や再現性が必要なタスク（コード生成、翻訳など）には `false` の設定を推奨します
          default: true
          example: true
        temperature:
          type: number
          format: float
          description: |-
            サンプリング温度。出力のランダム性と創造性を制御します

            **説明**：
            - 範囲：`[0.0, 1.0]`、小数第 2 位まで
            - 高い値（例：0.8）：よりランダムで独創性が高くなり、クリエイティブな執筆に適しています
            - 低い値（例：0.2）：より安定して定まりやすくなり、事実に基づく質問応答やコード生成に適しています
            - デフォルト値：`1.0`

            **推奨**：`temperature` と `top_p` を同時に調整しないでください
          minimum: 0
          maximum: 1
          default: 1
          example: 1
        top_p:
          type: number
          format: float
          description: >-
            核サンプリング（Nucleus Sampling）パラメータ。`temperature` サンプリングの代替手段です


            **説明**：

            - 範囲：`[0.01, 1.0]`、小数第 2 位まで

            - モデルは累積確率が `top_p` に達する候補語彙のみを考慮します。例えば 0.1 は上位 10%
            の確率の語彙のみを考慮することを意味します

            - 小さい値ほど絞り込まれた一貫性のある出力になり、大きい値ほど多様性が増します

            - デフォルト値：`0.95`


            **推奨**：`temperature` と `top_p` を同時に調整しないでください
          minimum: 0.01
          maximum: 1
          default: 0.95
          example: 0.95
        max_tokens:
          type: integer
          description: |-
            モデル出力の最大トークン数の上限

            **説明**：
            - GLM シリーズは最大 **131,072 tokens**（128K）の出力に対応しています。`1024` 以上の設定を推奨します
            - `thinking` が有効な場合、思考連鎖のトークンもこの上限に含まれます
            - `length` を理由に生成が打ち切られた場合は、この値を上げてください
          minimum: 1
          maximum: 131072
          example: 1024
        tools:
          type: array
          description: >-
            モデルが呼び出せるツールのリスト


            **説明**：

            - 関数呼び出し（`function`）とウェブ検索（`web_search`）に対応

            - 関数は最大 128 個まで

            - このうち `web_search` は実際に検索が行われた場合に**1
            回ごとに別途課金**されます。その他のツールに追加料金はかかりません
          items:
            oneOf:
              - $ref: '#/components/schemas/FunctionTool'
              - $ref: '#/components/schemas/WebSearchTool'
            discriminator:
              propertyName: type
              mapping:
                function:
                  $ref: '#/components/schemas/FunctionTool'
                web_search:
                  $ref: '#/components/schemas/WebSearchTool'
          maxItems: 128
        tool_choice:
          type: string
          description: >-
            モデルがどの関数を呼び出すかを選択する方法を制御します


            **説明**：ツールの種類が `function` の場合のみ有効で、デフォルトかつ `auto`
            のみに対応します（ツールを呼び出すかどうかをモデルが自動で判断します）
          enum:
            - auto
          default: auto
          example: auto
        stop:
          type: array
          description: |-
            停止ワードのリスト

            **説明**：
            - モデルが生成テキスト中に指定した文字列に遭遇すると、ただちに生成を停止します（停止ワード自体は返却テキストに含まれません）
            - 現在は単一の停止ワードのみに対応し、形式は `["stop_word1"]`、例えば `["Human:"]` です
          items:
            type: string
          maxItems: 4
          example:
            - 'Human:'
        response_format:
          type: object
          description: >-
            モデルのレスポンス出力形式を指定します。デフォルトは `text`


            **説明**：

            - `{ "type": "json_object" }` で JSON モードを有効化すると、モデルは有効な JSON
            形式のデータを返します。構造化データの抽出などのシナリオに適しています

            - JSON モードを使用する場合は、`system` または `user` メッセージで JSON
            出力をはっきりと要求することを推奨します
          required:
            - type
          properties:
            type:
              type: string
              description: |-
                出力形式の種類

                - `text`：プレーンテキスト出力（デフォルト）
                - `json_object`：JSON 形式の出力
              enum:
                - text
                - json_object
              default: text
        request_id:
          type: string
          description: |-
            リクエストの一意の識別子

            **説明**：
            - ユーザー側から渡し、長さは 6〜64 文字です。一意性を確保するため UUID 形式を推奨します
            - 指定しない場合は、プラットフォームが自動で生成します
          minLength: 6
          maxLength: 64
          example: req-7f3a2c1e8b9d4f0a
        user_id:
          type: string
          description: >-
            エンドユーザーの一意の識別子


            **説明**：長さは 6〜128
            文字です。機密情報を含まない一意の識別子の使用を推奨します。プラットフォームによる不正利用の監視と検出に役立ちます
          minLength: 6
          maxLength: 128
          example: user-abc123456
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: タスク `ID`
          example: chatcmpl-a6613b56-c61c-94ba-9a9f-43d4cdc7d77a
        object:
          type: string
          description: レスポンスタイプ
          enum:
            - chat.completion
          example: chat.completion
        request_id:
          type: string
          description: リクエスト `ID`（リクエストで `request_id` を指定した場合に返送されます）
          example: req-7f3a2c1e8b9d4f0a
        created:
          type: integer
          description: リクエストの作成時刻。`Unix` タイムスタンプ（秒）
          example: 1777021417
        model:
          type: string
          description: モデル名
          example: glm-5.3
        choices:
          type: array
          description: モデルレスポンスのリスト
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
        web_search:
          type: array
          description: ウェブ検索関連情報。`web_search` ツールを使用し検索がヒットした場合に返却されます
          items:
            $ref: '#/components/schemas/WebSearchResult'
        content_filter:
          type: array
          description: コンテンツ安全関連情報
          items:
            $ref: '#/components/schemas/ContentFilter'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP ステータスエラーコード
            message:
              type: string
              description: エラー説明情報
            type:
              type: string
              description: エラータイプ
            param:
              type: string
              description: 関連パラメータ名
            fallback_suggestion:
              type: string
              description: エラー発生時の提案
    SystemMessage:
      title: System Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
          description: 役割識別子。固定値 `system`
        content:
          type: string
          description: システムプロンプトの内容。AI の役割と振る舞いを設定するために使用します
    UserMessage:
      title: User Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: 役割識別子。固定値 `user`
        content:
          description: |-
            ユーザーメッセージの内容。

            - **文字列**：プレーンテキスト。すべてのモデルが対応
            - **コンテンツブロック配列**：テキストと画像の混在。**対応しているのは `glm-5.3-flash` のみ**

            `glm-5.3` や `glm-5.2` に画像コンテンツブロックを渡すとエラーになります。
          oneOf:
            - type: string
              title: プレーンテキスト
              description: プレーンテキストのメッセージ内容
              example: こんにちは、自己紹介してください
            - type: array
              title: コンテンツブロック配列（glm-5.3-flash のみ）
              description: >-
                テキストと画像の混在。画像は `image_url` ブロックで渡し、公開 URL（推奨）または Base64 データ URL
                が使えます。複数の画像は `image_url` ブロックを複数並べます。
              items:
                $ref: '#/components/schemas/ContentPart'
    AssistantRequestMessage:
      title: Assistant Message
      type: object
      description: アシスタントメッセージ。ツール呼び出しを含めることができます
      required:
        - role
      properties:
        role:
          type: string
          enum:
            - assistant
          description: 役割識別子。固定値 `assistant`
        content:
          type:
            - string
            - 'null'
          description: >-
            アシスタントメッセージの内容


            **説明**：マルチターン対話で過去のアシスタントの返信を渡すために使用します。`tool_calls` が存在する場合は通常
            `null` になります
        reasoning_content:
          type:
            - string
            - 'null'
          description: >-
            過去の思考連鎖の内容


            **説明**：`thinking.clear_thinking=false`（Preserved
            Thinking）の場合のみ必要で、前のターンのレスポンスの `reasoning_content`
            をそのまま返送します。デフォルト（`clear_thinking=true`）では返送する必要はありません
        tool_calls:
          type: array
          description: |-
            ツール呼び出しリスト

            マルチターン対話で過去のツール呼び出し情報を渡すために使用します。このフィールドを指定する場合、`content` は通常空になります
          items:
            type: object
            required:
              - id
              - type
            properties:
              id:
                type: string
                description: ツール呼び出し ID
              type:
                type: string
                enum:
                  - function
                  - web_search
                description: ツールの種類
              function:
                type: object
                description: 関数呼び出し情報。`type` が `function` の場合は空になりません
                required:
                  - name
                  - arguments
                properties:
                  name:
                    type: string
                    description: 関数名
                  arguments:
                    type: string
                    description: 関数の引数（JSON 形式の文字列）
    ToolMessage:
      title: Tool Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - tool
          description: 役割識別子。固定値 `tool`
        content:
          type: string
          description: ツール呼び出しの返却結果の内容
        tool_call_id:
          type: string
          description: >-
            このメッセージが対応するツール呼び出しの `ID` を示します（assistant メッセージの `tool_calls` で返された
            `id` に対応します）
    FunctionTool:
      title: Function ツール
      type: object
      required:
        - type
        - function
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - function
          default: function
          description: ツールの種類。固定値 `function`
        function:
          type: object
          required:
            - name
            - description
            - parameters
          properties:
            name:
              type: string
              description: >-
                呼び出す関数名


                **説明**：`a-z`、`A-Z`、`0-9` の文字、またはアンダースコアとハイフンで構成する必要があります。最大長は 64
                文字です
              minLength: 1
              maxLength: 64
              pattern: ^[a-zA-Z0-9_-]+$
            description:
              type: string
              description: 関数の機能説明。モデルがこの関数をいつ、どのように呼び出すかを選択するのに役立ちます
            parameters:
              type: object
              description: 関数の入力パラメータ。JSON Schema オブジェクトとして記述します
    WebSearchTool:
      title: Web Search ツール（ウェブ検索）
      type: object
      required:
        - type
        - web_search
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - web_search
          default: web_search
          description: ツールの種類。固定値 `web_search`
        web_search:
          type: object
          required:
            - enable
          properties:
            enable:
              type: boolean
              description: 検索機能を有効にするかどうか。有効にする場合は `true` に設定します
              default: false
            search_query:
              type: string
              description: 検索を強制してトリガーするカスタムキーワード
            search_intent:
              type: boolean
              description: |-
                検索意図の認識を行うかどうか。デフォルトで実行します

                - `true`：検索意図の認識を実行し、検索意図があれば検索を実行します
                - `false`：意図認識をスキップし、直接検索を実行します
            count:
              type: integer
              description: >-
                返される結果の件数。範囲は `1-50`、デフォルトは `10` です。


                件数はコストに直結します。検索結果は `prompt_tokens` に統合されて入力単価で課金され、`50` にすると 1
                回の入力が 2 万トークン規模に達することがあります。より広い再現率が本当に必要でない限り、デフォルトのままを推奨します。
              minimum: 1
              maximum: 50
              default: 10
            search_domain_filter:
              type: string
              description: 検索結果を限定するドメインのホワイトリスト（例：`www.example.com`）
            search_recency_filter:
              type: string
              description: 検索結果を限定する時間範囲。デフォルトは `noLimit`
              enum:
                - oneDay
                - oneWeek
                - oneMonth
                - oneYear
                - noLimit
              default: noLimit
            content_size:
              type: string
              description: |-
                ウェブページ要約の文字数を制御します。デフォルトは `medium`

                - `medium`：要約情報を返し、基本の推論ニーズを満たします
                - `high`：コンテキストを最大化し、より詳細な情報を提供します
              enum:
                - medium
                - high
              default: medium
            result_sequence:
              type: string
              description: 検索結果を返す位置（モデルの返信の前か後か）。デフォルトは `after`
              enum:
                - before
                - after
              default: after
            search_result:
              type: boolean
              description: >-
                検索元の詳細情報をレスポンスに含めるかどうか。デフォルトは `false` です。


                `true` に設定すると、レスポンスのトップレベルに `web_search`
                配列が付き、今回検索された情報源（タイトル、リンク、メディア名、公開日時、要約など）が一覧化されます。デフォルトのままではこのフィールドは含まれません。


                このパラメータはレスポンスの内容にのみ影響し、検索を実行するかどうかにも課金にも影響しません。
              default: false
              example: true
            require_search:
              type: boolean
              description: 検索結果に基づくことを強制して回答を返すかどうか。デフォルトは `false`
              default: false
            search_prompt:
              type: string
              description: 検索結果の処理をカスタマイズするための `Prompt`。指定しない場合はデフォルトテンプレートを使用します
      description: >-
        ウェブ検索ツール。有効にすると、モデルは必要に応じてインターネットを検索し、結果をコンテキストに統合します。


        **課金**：コンテキストに統合された検索結果の部分は `prompt_tokens`
        として入力単価で計上されます。検索サービス自体は**呼び出し回数ごとに別途課金**され、トークン使用量とは分けて精算されます（詳細は料金ページをご覧ください）。検索を実行するかどうかは検索意図に基づいてモデルが判断し、検索が発生しなければこの料金はかかりません。
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 結果のインデックス
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: |-
            推論の終了理由

            - `stop`：自然終了または停止ワードのトリガー
            - `tool_calls`：モデルが関数（ツール呼び出し）にヒット
            - `length`：token 長の上限に到達
            - `sensitive`：内容が安全審査によりブロックされた（公開した内容を撤回するかどうかを判断し決定してください）
            - `network_error`：モデル推論の異常
            - `model_context_window_exceeded`：モデルのコンテキストウィンドウを超過
          enum:
            - stop
            - tool_calls
            - length
            - sensitive
            - network_error
            - model_context_window_exceeded
          example: stop
    Usage:
      type: object
      description: 呼び出し終了時に返却される Token 使用統計
      properties:
        prompt_tokens:
          type: integer
          description: ユーザー入力の token 数
          example: 24
        completion_tokens:
          type: integer
          description: 出力の token 数（思考連鎖 `reasoning_tokens` 部分を含む）
          example: 346
        total_tokens:
          type: integer
          description: token 総数 = prompt_tokens + completion_tokens
          example: 370
        prompt_tokens_details:
          type: object
          description: 入力 token の詳細内訳
          properties:
            cached_tokens:
              type: integer
              description: >-
                コンテキストキャッシュにヒットした入力トークン数。


                GLM
                シリーズは**暗黙のプレフィックスキャッシュ**を採用しています。同じプレフィックスの繰り返しリクエストは追加パラメータなしで自動的にヒットし、ヒットした部分はキャッシュ単価で課金され、未ヒットの入力単価より大幅に安くなります。初回リクエストは
                0 で、以降は同じプレフィックスであればヒットします。
              example: 0
        completion_tokens_details:
          type: object
          description: 出力 token の詳細内訳
          properties:
            reasoning_tokens:
              type: integer
              description: 思考連鎖（深い思考）が生成した token 数。`completion_tokens` に含まれます
              example: 321
    WebSearchResult:
      type: object
      description: 単一のウェブ検索結果
      properties:
        icon:
          type: string
          description: ソースサイトのアイコン
        title:
          type: string
          description: 検索結果のタイトル
        link:
          type: string
          description: 検索結果のウェブページリンク
        media:
          type: string
          description: 検索結果ウェブページのメディアソース名
        publish_date:
          type: string
          description: サイトの公開時刻
        content:
          type: string
          description: 検索結果ウェブページが引用したテキスト内容
        refer:
          type: string
          description: 添え字の番号
    ContentFilter:
      type: object
      description: コンテンツ安全情報
      properties:
        role:
          type: string
          description: |-
            安全が適用された段階

            - `assistant`：モデル推論
            - `user`：ユーザー入力
            - `history`：過去の文脈
          enum:
            - assistant
            - user
            - history
        level:
          type: integer
          description: 深刻度 `0-3`。`0` が最も深刻、`3` が軽微を示します
          minimum: 0
          maximum: 3
    ContentPart:
      title: Content Part
      type: object
      description: マルチモーダルのコンテンツブロック。**画像ブロックに対応しているのは `glm-5.3-flash` のみです。**
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
          description: |-
            コンテンツブロックの種類

            - `text`：テキスト
            - `image_url`：画像（`glm-5.3-flash` のみ）
        text:
          type: string
          description: テキスト内容。`type=text` の場合は必須
          example: この画像には何が写っていますか？
        image_url:
          type: object
          description: 画像内容。`type=image_url` の場合は必須
          required:
            - url
          properties:
            url:
              type: string
              description: >-
                画像のアドレス。公開 HTTPS URL（推奨）または Base64 データ
                URL（`data:image/png;base64,...`）に対応
              example: https://example.com/photo.jpg
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: 現在の対話の役割。デフォルトは `assistant`
          enum:
            - assistant
          example: assistant
        content:
          type:
            - string
            - 'null'
          description: >-
            対話テキストの内容


            **説明**：ツール（`tool_calls`）を呼び出す場合は `null`
            になることがあります。それ以外の場合はモデルの返信内容を返します
          example: こんにちは！私は GLM-5.3 です。対話、推論、執筆、コーディングなど、さまざまなタスクをお手伝いできます。
        reasoning_content:
          type: string
          description: |-
            思考連鎖の内容

            **説明**：`thinking` が有効な場合に返却され、モデルの推論過程を記録します
          example: まずこの問題を分析してみましょう...
        tool_calls:
          type: array
          description: 生成されたツール呼び出し情報（モデルがツールの呼び出しを決定した場合に返却）
          items:
            type: object
            properties:
              id:
                type: string
                description: ツール呼び出しの一意の識別子
              type:
                type: string
                description: ツール呼び出しの種類
                enum:
                  - function
              function:
                type: object
                description: 関数呼び出し情報（生成された関数名と JSON 形式の引数を含みます）
                properties:
                  name:
                    type: string
                    description: 生成された関数名
                  arguments:
                    type: string
                    description: 関数呼び出し引数の JSON 形式文字列。関数を呼び出す前に引数を検証してください
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべての API は Bearer Token 認証が必要です##

        **API キーの取得：**

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

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

````