> ## 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 - Responses Quickstart

> - Call xAI Grok text models using the OpenAI Responses API format (pick the model via the `model` parameter)
- Reasoning + tool-use models with a 500K-token context window
- xAI server-side tools run on xAI infrastructure: `web_search`, `x_search`, `code_execution`, `attachment_search`, and `collections_search`. X Search is billed by posts and user profiles fetched; other tools are billed per successful call.
- Need tools and all parameters? See the [full parameter documentation](/en/api-manual/language-series/grok/responses/responses-reference)
- Under xAI's official API contract, `grok-4.7` returns `reasoning` items containing `encrypted_content` by default; the fields actually returned depend on the current route.

> [!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.


## OpenAPI

````yaml en/api-manual/language-series/grok/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: Grok All-Model API - Responses Quickstart
  description: >-
    A quickstart example for calling xAI Grok text models through the
    OpenAI-compatible Responses API, including server-side tools.
  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: Responses
    description: OpenAI Responses API with xAI server-side tools
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: Grok Quick Response (All Models)
      description: >-
        - Call xAI Grok text models using the OpenAI Responses API format (pick
        the model via the `model` parameter)

        - Reasoning + tool-use models with a 500K-token context window

        - xAI server-side tools run on xAI infrastructure: `web_search`,
        `x_search`, `code_execution`, `attachment_search`, and
        `collections_search`. X Search is billed by posts and user profiles
        fetched; other tools are billed per successful call.

        - Need tools and all parameters? See the [full parameter
        documentation](/en/api-manual/language-series/grok/responses/responses-reference)

        - Under xAI's official API contract, `grok-4.7` returns `reasoning`
        items containing `encrypted_content` by default; the fields actually
        returned depend on the current route.
      operationId: grokResponsesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
      responses:
        '200':
          description: Response generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
        '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/credits
        '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
        '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:
    ResponsesQuickRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: >-
            Model to call:


            | Model ID | Positioning |

            |---|---|

            | `grok-4.7` | xAI reasoning and tool-use model; 500K-token context
            window; supports `xhigh`; knowledge cutoff: 2026-05 |

            | `grok-4.6` | xAI reasoning + tool-use model, 500K context window;
            knowledge cutoff 2026-02-01 |

            | `grok-4.5` | xAI reasoning + tool-use model, 500K context window |
          enum:
            - grok-4.7
            - grok-4.6
            - grok-4.5
          example: grok-4.7
        input:
          type: string
          description: Input text for the model
          example: Explain what makes Grok 4.5 different in two sentences.
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the response
          example: 55d44212-8d5e-90cc-975f-36d341ce21f5
        object:
          type: string
          enum:
            - response
          description: Response type
          example: response
        status:
          type: string
          description: Response status
          enum:
            - completed
            - incomplete
            - failed
          example: completed
        model:
          type: string
          description: Model name actually used
          example: grok-4.7
        created_at:
          type: integer
          description: Creation timestamp
          example: 1786538000
        output:
          type: array
          description: >-
            Output items. Grok reasoning models typically return `reasoning`
            items (summarized thinking) followed by a `message` item with the
            final answer.
          items:
            $ref: '#/components/schemas/OutputItem'
        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
    OutputItem:
      type: object
      properties:
        id:
          type: string
          description: Output item identifier
        type:
          type: string
          description: Output item type
          enum:
            - reasoning
            - message
          example: message
        status:
          type: string
          description: Output item status
          example: completed
        content:
          type: array
          description: Message content parts (`output_text`), present on `message` items
          items:
            type: object
        encrypted_content:
          type: string
          description: >-
            Encrypted reasoning content on output items with type=reasoning.
            Under xAI's API contract, grok-4.7 returns this field by default
            without include. When managing conversation history yourself, pass
            the complete reasoning item back unchanged in the next input. Check
            whether the field is present in the actual response; do not decode
            or alter the ciphertext.
    Usage:
      type: object
      description: >-
        Token usage statistics. Prompts of 200K tokens or more are billed at 2x
        for all token types.
      properties:
        input_tokens:
          type: integer
          description: Number of input tokens
          example: 1692
        output_tokens:
          type: integer
          description: Number of output tokens (includes reasoning tokens)
          example: 54
        total_tokens:
          type: integer
          description: Total number of tokens
          example: 1746
        input_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: 512
        output_tokens_details:
          type: object
          description: Detailed output token information
          properties:
            reasoning_tokens:
              type: integer
              description: Number of reasoning tokens
              example: 35
  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

        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.