> ## 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 クイックスタート

> - OpenAI SDK 形式で xAI Grok テキストモデルを呼び出し（モデルは `model` パラメータで選択）
- 推論 + ツール呼び出しモデル。`grok-4.5` のコンテキストウィンドウは 500K トークン
- 同期処理モード、最小限のパラメータで手軽に開始
- 💡 さらに機能が必要ですか？[完全なパラメータドキュメント](./chat-completions-reference)をご覧ください
- 💡 サーバーサイドツール（ウェブ検索、X 検索、コード実行など）は [Responses API](../responses/responses-quickstart) で利用できます

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


## OpenAPI

````yaml ja/api-manual/language-series/grok/chat-completions/chat-completions-quickstart.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: >-
        - OpenAI SDK 形式で xAI Grok テキストモデルを呼び出し（モデルは `model` パラメータで選択）

        - 推論 + ツール呼び出しモデル。`grok-4.5` のコンテキストウィンドウは 500K トークン

        - 同期処理モード、最小限のパラメータで手軽に開始

        - 💡 さらに機能が必要ですか？[完全なパラメータドキュメント](./chat-completions-reference)をご覧ください

        - 💡 サーバーサイドツール（ウェブ検索、X 検索、コード実行など）は [Responses
        API](../responses/responses-quickstart) で利用できます
      operationId: grokChatCompletionsQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
      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: grok-4.5
        '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 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:
    ChatCompletionQuickRequest:
      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: チャットメッセージのリスト
          items:
            $ref: '#/components/schemas/MessageSimple'
          minItems: 1
          example:
            - role: user
              content: Hello, introduce yourself
    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: エラー発生時の提案
    MessageSimple:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: メッセージのロール
          enum:
            - user
        content:
          type: string
          description: メッセージ内容（プレーンテキスト）
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 選択インデックス
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: 終了理由
          enum:
            - stop
            - length
            - 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: Hello! I'm Grok 4.5, a reasoning model built by xAI...
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIにBearer Token認証が必要です##

        **APIキーの取得：**

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

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

````