> ## 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 全模型接口 - Responses 快速开始

> - 使用 OpenAI Responses 格式调用 xAI Grok 文本模型（通过 `model` 参数选择具体模型）
- 推理 + 工具调用模型；`grok-4.5` 上下文窗口 50 万 token
- 本接口支持 xAI 服务端工具：联网搜索、X 搜索、代码执行、附件搜索、文档集搜索（按成功调用次数计费）
- 💡 需要工具与全部参数？查看[完整参数文档](./responses-reference)

<Note>
  **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，对文本模型作为备用地址使用。
</Note>


## OpenAPI

````yaml cn/api-manual/language-series/grok/responses/responses-quickstart.json POST /v1/responses
openapi: 3.1.0
info:
  title: Grok 全模型接口 - Responses 快速开始
  description: 通过 OpenAI 兼容的 Responses 接口调用 xAI Grok 系列文本模型的快速开始示例（服务端工具在此接口提供）。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: Responses
    description: OpenAI Responses 接口与 xAI 服务端工具
paths:
  /v1/responses:
    post:
      tags:
        - Responses
      summary: Grok 快速调用（全模型）
      description: |-
        - 使用 OpenAI Responses 格式调用 xAI Grok 文本模型（通过 `model` 参数选择具体模型）
        - 推理 + 工具调用模型；`grok-4.5` 上下文窗口 50 万 token
        - 本接口支持 xAI 服务端工具：联网搜索、X 搜索、代码执行、附件搜索、文档集搜索（按成功调用次数计费）
        - 💡 需要工具与全部参数？查看[完整参数文档](./responses-reference)
      operationId: grokResponsesQuick
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesQuickRequest'
      responses:
        '200':
          description: 响应生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未授权，Token 无效或已过期
          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:
    ResponsesQuickRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: |-
            要调用的模型：

            | 模型 ID | 定位 |
            |---|---|
            | `grok-4.5` | xAI 推理 + 工具调用模型，50 万 token 上下文窗口 |
          enum:
            - grok-4.5
          example: grok-4.5
        input:
          type: string
          description: 输入给模型的文本
          example: 用两句话说明 Grok 4.5 的特点。
    ResponsesResponse:
      type: object
      properties:
        id:
          type: string
          description: 响应的唯一标识
          example: 55d44212-8d5e-90cc-975f-36d341ce21f5
        object:
          type: string
          enum:
            - response
          description: 响应类型
          example: response
        status:
          type: string
          description: 响应状态
          enum:
            - completed
            - incomplete
            - failed
          example: completed
        model:
          type: string
          description: 实际使用的模型名称
          example: grok-4.5
        created_at:
          type: integer
          description: 创建时间戳
          example: 1786538000
        output:
          type: array
          description: 输出项列表。Grok 推理模型通常先返回 `reasoning` 项（思考摘要），最后是含最终回答的 `message` 项。
          items:
            $ref: '#/components/schemas/OutputItem'
        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: 出错时的处理建议
    OutputItem:
      type: object
      properties:
        id:
          type: string
          description: 输出项标识
        type:
          type: string
          description: 输出项类型
          enum:
            - reasoning
            - message
          example: message
        status:
          type: string
          description: 输出项状态
          example: completed
        content:
          type: array
          description: 消息内容片段（`output_text`），出现在 `message` 项上
          items:
            type: object
    Usage:
      type: object
      description: Token 用量统计。Prompt 达到 20 万 token 起，全部 token 按 2 倍价格计费。
      properties:
        input_tokens:
          type: integer
          description: 输入 token 数
          example: 1692
        output_tokens:
          type: integer
          description: 输出 token 数（含推理 token）
          example: 54
        total_tokens:
          type: integer
          description: 总 token 数
          example: 1746
        input_tokens_details:
          type: object
          description: 输入 token 明细
          properties:
            cached_tokens:
              type: integer
              description: 命中缓存的 token 数（按更低的缓存输入价计费）
              example: 512
        output_tokens_details:
          type: object
          description: 输出 token 明细
          properties:
            reasoning_tokens:
              type: integer
              description: 推理 token 数
              example: 35
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需 Bearer Token 认证##

        **获取 API Key：**

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取你的 API Key

        **添加到请求头：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````