> ## 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` パラメータで選択）
- 必要なパラメータは `model` と `messages` の 2 つだけ
- 全シリーズで 1M token のコンテキストウィンドウ、最大出力 131,072 tokens
- 全シリーズでデフォルトで深い思考が有効。推論過程は `reasoning_content` で返されます
- ストリーミング出力、ツール呼び出し、思考強度の調節、画像入力などの機能は「完全なパラメータ」ページをご覧ください

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


## OpenAPI

````yaml ja/api-manual/language-series/glm/chat-completions/chat-completions-quickstart.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GLM 全モデルインターフェース - Chat Completions クイックスタート
  description: >-
    OpenAI 互換の Chat Completions API で Zhipu GLM
    シリーズのテキストモデルを呼び出すクイックスタート例。`model` と `messages` の 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: チャット補完
    description: AI 対話生成に関連するエンドポイント
paths:
  /v1/chat/completions:
    post:
      tags:
        - チャット補完
      summary: GLM クイック対話（全モデル）
      description: >-
        - OpenAI Chat Completions プロトコルで GLM シリーズのモデルを呼び出し（モデルは `model`
        パラメータで選択）

        - 必要なパラメータは `model` と `messages` の 2 つだけ

        - 全シリーズで 1M token のコンテキストウィンドウ、最大出力 131,072 tokens

        - 全シリーズでデフォルトで深い思考が有効。推論過程は `reasoning_content` で返されます

        - ストリーミング出力、ツール呼び出し、思考強度の調節、画像入力などの機能は「完全なパラメータ」ページをご覧ください
      operationId: glmChatCompletionsQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
            examples:
              simple:
                summary: 最小構成の呼び出し
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: こんにちは、一文で自己紹介してください
              flash:
                summary: 軽量モデルに切り替え
                description: '`glm-5.3-flash` は `glm-5.3` よりコストが大幅に低く、高頻度の呼び出しに適しています。'
                value:
                  model: glm-5.3-flash
                  messages:
                    - role: user
                      content: HTTP とは何かを一文で説明してください
              multi_turn:
                summary: マルチターン対話
                value:
                  model: glm-5.3
                  messages:
                    - role: user
                      content: 入門に適したプログラミング言語を教えてください
                    - role: assistant
                      content: Python がおすすめです。構文が簡潔で、エコシステムも豊富です。
                    - role: user
                      content: それを習得するにはどれくらいかかりますか？
      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:
    ChatCompletionQuickRequest:
      title: Chat Completion Quick Request
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >
            呼び出すモデル：


            | モデル ID | 位置づけ |

            |---|---|

            | `glm-5.3` | フラッグシップモデル。複雑なソフトウェアエンジニアリングとエージェントタスクの能力が全面的に向上；1M
            コンテキスト |

            | `glm-5.3-flash` | 軽量マルチモーダルモデル。コストが極めて低く、画像入力にネイティブ対応；1M コンテキスト |

            | `glm-5.2` | 前世代のフラッグシップ。複雑な推論と超長コンテキスト；1M コンテキスト |
          enum:
            - glm-5.3
            - glm-5.3-flash
            - glm-5.2
          default: glm-5.3
          example: glm-5.3
        messages:
          type: array
          description: 対話メッセージのリスト。時系列順に並べます。最低 1 件のメッセージが必要です。
          minItems: 1
          items:
            $ref: '#/components/schemas/MessageSimple'
    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'
        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: エラー発生時の提案
    MessageSimple:
      title: Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
          description: |-
            メッセージのロール

            - `system`：システムプロンプト
            - `user`：ユーザー入力
            - `assistant`：モデルの応答（マルチターン対話で付与）
          example: user
        content:
          type: string
          description: メッセージ内容（プレーンテキスト）
          example: こんにちは、一文で自己紹介してください
    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: キャッシュに該当した token 数
              example: 0
        completion_tokens_details:
          type: object
          description: 出力 token の詳細内訳
          properties:
            reasoning_tokens:
              type: integer
              description: 思考連鎖（深い思考）が生成した token 数。`completion_tokens` に含まれます
              example: 321
    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
    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
        ```

````