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

# Grok 全モデルインターフェース - Chat Completions 完全なパラメータ

> - xAI Grok テキストモデル向けの OpenAI 互換 Chat Completions エンドポイント。モデルは `model` パラメータで選択（全指定値は `model` パラメータの対照表を参照）
- `grok-4.5`：コンテキストウィンドウ 500K トークン。プロンプトが 200K トークン以上になると、すべてのトークン種別が 2 倍の料金で課金されます
- プロンプトキャッシュは自動的に有効：キャッシュにヒットした入力トークンはより安いキャッシュ料金で課金されます
- 同期モードとストリーミング（SSE）モードに対応
- 通常の `function` ツール呼び出しに対応。xAI のサーバーサイドツールは [Responses API](../responses/responses-reference) のみで利用できます

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

<Note>
  **サーバーサイドツール**（ウェブ検索、X 検索、コード実行、添付ファイル検索、コレクション検索）は [Responses API](../responses/responses-reference) のみで利用できます。Chat Completions エンドポイントは通常の `function` ツール呼び出しのみに対応します。
</Note>


## OpenAPI

````yaml ja/api-manual/language-series/grok/chat-completions/chat-completions-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Grok 全モデルインターフェース - Chat Completions 完全なパラメータ
  description: OpenAI 互換の Chat Completions API で xAI Grok テキストモデルを呼び出すための完全なパラメータリファレンス。
  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: Chat Completion
    description: AIチャット補完関連API
paths:
  /v1/chat/completions:
    post:
      tags:
        - チャット補完
      summary: Grok チャット補完（全モデル、完全なパラメータ）
      description: >-
        - xAI Grok テキストモデル向けの OpenAI 互換 Chat Completions エンドポイント。モデルは `model`
        パラメータで選択（全指定値は `model` パラメータの対照表を参照）

        - `grok-4.5`：コンテキストウィンドウ 500K トークン。プロンプトが 200K トークン以上になると、すべてのトークン種別が 2
        倍の料金で課金されます

        - プロンプトキャッシュは自動的に有効：キャッシュにヒットした入力トークンはより安いキャッシュ料金で課金されます

        - 同期モードとストリーミング（SSE）モードに対応

        - 通常の `function` ツール呼び出しに対応。xAI のサーバーサイドツールは [Responses
        API](../responses/responses-reference) のみで利用できます
      operationId: grokChatCompletionsReference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: >-
            チャット補完が正常に生成されました（JSON オブジェクト、または `stream=true` の場合は
            `chat.completion.chunk` イベントの SSE ストリーム）
          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
        '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
        '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 | 位置づけ |
            |---|---|
            | `grok-4.5` | xAI の推論 + ツール呼び出しモデル、コンテキストウィンドウ 500K |
          enum:
            - grok-4.5
          example: grok-4.5
        messages:
          type: array
          description: チャットメッセージのリスト。`system`、`user`、`assistant` のロールに対応します。
          items:
            $ref: '#/components/schemas/Message'
          minItems: 1
          example:
            - role: system
              content: You are a concise assistant.
            - role: user
              content: Explain prompt caching in one sentence.
        stream:
          type: boolean
          description: >-
            ストリーミングでレスポンスを返すかどうか（SSE、`chat.completion.chunk` イベント）。デフォルトは
            `false`。
          default: false
          example: false
        max_tokens:
          type: integer
          description: 生成するトークンの最大数。そのままモデルに渡されます。
          example: 1024
        temperature:
          type: number
          description: サンプリング温度（0-2）。値を大きくすると出力がよりランダムになります。
          example: 0.7
        top_p:
          type: number
          description: Nucleus サンプリングのパラメータ（0-1）。
          example: 0.95
        tools:
          type: array
          description: >-
            通常の OpenAI `function` ツール定義（クライアント側の関数呼び出し。呼び出しごとの追加料金なし）。xAI
            のサーバーサイドツールは Responses API のみで利用できます。
          items:
            $ref: '#/components/schemas/FunctionTool'
        tool_choice:
          description: 関数の選択を制御します：`"auto"` / `"none"` / `"required"`、または特定の関数を指定するオブジェクト。
          oneOf:
            - type: string
              enum:
                - auto
                - none
                - required
            - type: object
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: チャット補完の一意の識別子
          example: chatcmpl-20260812164515123456789AbCdEfGh
        model:
          type: string
          description: 実際に使用されたモデル名
          example: grok-4.5
        object:
          type: string
          enum:
            - chat.completion
          description: レスポンスタイプ
          example: chat.completion
        created:
          type: integer
          description: 作成タイムスタンプ
          example: 1786538000
        choices:
          type: array
          description: チャット補完選択肢のリスト
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    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: エラー発生時の提案
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: メッセージのロール
          enum:
            - system
            - user
            - assistant
        content:
          type: string
          description: メッセージ内容
    FunctionTool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
          description: ツールタイプ。Chat Completions エンドポイントは `function` のみを受け付けます
        function:
          type: object
          description: 関数の定義：`name`、`description`、および JSON Schema 形式の `parameters` オブジェクト
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 選択インデックス
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: 終了理由
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
          example: stop
    Usage:
      type: object
      description: トークン使用統計。プロンプトが 200K トークン以上の場合、すべてのトークン種別（入力、キャッシュ入力、出力）が 2 倍で課金されます。
      properties:
        prompt_tokens:
          type: integer
          description: 入力コンテンツのトークン数
          example: 504
        completion_tokens:
          type: integer
          description: 出力コンテンツのトークン数
          example: 2
        total_tokens:
          type: integer
          description: トークンの合計数
          example: 526
        prompt_tokens_details:
          type: object
          description: 入力トークンの詳細情報
          properties:
            cached_tokens:
              type: integer
              description: キャッシュにヒットしたプロンプトトークン数（より安いキャッシュ料金で課金。キャッシュは自動的に有効）
              example: 0
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: メッセージ送信者のロール
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AIレスポンスメッセージの内容
          example: >-
            Prompt caching reuses previously processed prompt prefixes so
            repeated context is billed at a lower rate.
        tool_calls:
          type: array
          description: モデルが要求した関数呼び出し（`function` ツールを使用した場合に出力）
          items:
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIにBearer Token認証が必要です##

        **APIキーの取得：**

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

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

````