> ## 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 All-Model API - Chat Completions Quickstart

> - Call xAI Grok text models using the OpenAI SDK format (pick the model via the `model` parameter)
- Reasoning + tool-use models; `grok-4.5` has a 500K-token context window
- Synchronous processing mode, minimal parameters, quick to get started
- 💡 Need more features? See the [full parameter documentation](./chat-completions-reference)
- 💡 Server-side tools (web search, X search, code execution, ...) are available on the [Responses API](../responses/responses-quickstart)

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>


## OpenAPI

````yaml en/api-manual/language-series/grok/chat-completions/chat-completions-quickstart.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Grok All-Model API - Chat Completions Quickstart
  description: >-
    A quickstart example for calling xAI Grok text models through the
    OpenAI-compatible Chat Completions API.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Chat Completion
    description: AI chat completion related APIs
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completion
      summary: Grok Quick Chat (All Models)
      description: >-
        - Call xAI Grok text models using the OpenAI SDK format (pick the model
        via the `model` parameter)

        - Reasoning + tool-use models; `grok-4.5` has a 500K-token context
        window

        - Synchronous processing mode, minimal parameters, quick to get started

        - 💡 Need more features? See the [full parameter
        documentation](./chat-completions-reference)

        - 💡 Server-side tools (web search, X search, code execution, ...) are
        available on the [Responses API](../responses/responses-quickstart)
      operationId: grokChatCompletionsQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
      responses:
        '200':
          description: Chat completion generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthorized, invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: Insufficient quota, recharge required
          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: Access denied
          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: Resource not found
          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: Rate limit exceeded
          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: Internal server error
          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: Upstream service error
          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: Service temporarily unavailable
          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: |-
            Model to call:

            | Model ID | Positioning |
            |---|---|
            | `grok-4.5` | xAI reasoning + tool-use model, 500K context window |
          enum:
            - grok-4.5
          example: grok-4.5
        messages:
          type: array
          description: List of chat messages
          items:
            $ref: '#/components/schemas/MessageSimple'
          minItems: 1
          example:
            - role: user
              content: Hello, introduce yourself
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the chat completion
          example: chatcmpl-20260812164515123456789AbCdEfGh
        model:
          type: string
          description: Model name actually used
          example: grok-4.5
        object:
          type: string
          enum:
            - chat.completion
          description: Response type
          example: chat.completion
        created:
          type: integer
          description: Creation timestamp
          example: 1786538000
        choices:
          type: array
          description: List of chat completion choices
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status error code
            message:
              type: string
              description: Error description
            type:
              type: string
              description: Error type
            param:
              type: string
              description: Related parameter name
            fallback_suggestion:
              type: string
              description: Suggestion when error occurs
    MessageSimple:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: Message role
          enum:
            - user
        content:
          type: string
          description: Message content (plain text)
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: Choice index
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: Finish reason
          enum:
            - stop
            - length
            - content_filter
          example: stop
    Usage:
      type: object
      description: >-
        Token usage statistics. Prompts of 200K tokens or more are billed at 2x
        for all token types.
      properties:
        prompt_tokens:
          type: integer
          description: Number of tokens in input content
          example: 504
        completion_tokens:
          type: integer
          description: Number of tokens in output content
          example: 2
        total_tokens:
          type: integer
          description: Total number of tokens
          example: 526
        prompt_tokens_details:
          type: object
          description: Detailed input token information
          properties:
            cached_tokens:
              type: integer
              description: >-
                Number of cached prompt tokens hit (billed at the lower
                cached-input rate)
              example: 0
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: Message sender role
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AI response message content
          example: Hello! I'm Grok 4.5, a reasoning model built by xAI...
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        ##All APIs require Bearer Token authentication##


        **Get API Key:**


        Visit [API Key Management Page](https://evolink.ai/dashboard/keys) to
        get your API Key


        **Add to request header:**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````