> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inb.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 Grok 视频内容

> 通过接口代理下载已完成 Grok 视频任务的 MP4 文件

## 使用场景

当你需要在自己的服务器中代理视频下载，或不方便直接访问
`metadata.url` 中的链接时，可使用此接口。

## 前置条件

* 任务 `status` 必须为 `completed`
* 任务未过期（参考 `expires_at` 字段）

## 响应格式

成功时返回 `video/mp4` 字节流，HTTP 状态码为 200。
客户端应将响应体直接写入文件或通过流传输给终端用户。

## 替代方案

如果只需要链接，直接读取
`GET /v1/videos/{task_id}` 响应中的 `metadata.url` 即可，
无需通过此接口下载。


## OpenAPI

````yaml /openapi/grok-video.zh.yaml get /v1/videos/{task_id}/content
openapi: 3.1.0
info:
  title: InfinityBlue API — Grok Imagine 视频
  version: 1.0.0
  summary: Grok Imagine 视频生成接口（/v1/videos 异步）
  description: |
    Grok Imagine 系列视频生成接口，采用 `/v1/videos` **异步任务模型**：
    提交任务 → 轮询状态 → 获取结果。

    ## 使用要点

    - **分辨率由模型名决定**：用 `-480p` / `-720p` 后缀的模型来选择分辨率，
      **不要传入 `resolution` 参数**。例如 720p 用 `grok-imagine-video-720p`。
    - **`size` 仅决定画幅比例**（如 `1280x720` → 16:9），不决定分辨率；
      请勿使用 `1792x1024` / `1024x1792`。
    - 不支持 `generate_audio`、`camera_fixed`、`watermark` 等参数；
      `grok-imagine-video-1.5-preview` **仅支持图生视频**（必须带输入图），且自带同步音频。

    ## 典型调用流程

    1. `POST /v1/videos` — 提交任务，获取任务对象（含 `id`）
    2. `GET /v1/videos/{task_id}` — 轮询状态，直到 `status` 为 `completed` 或 `failed`
    3. 从 `metadata.url` 读取视频 URL，或 `GET /v1/videos/{task_id}/content` 直接下载视频流

    ## 认证

    所有请求需在请求头中携带 API Key：
    ```
    Authorization: Bearer YOUR_API_KEY
    ```
  contact:
    name: InfinityBlue
    url: https://getinfinityblue.com
servers:
  - url: https://api.getinfinityblue.com
    description: 生产环境
security:
  - bearerAuth: []
tags:
  - name: Grok Imagine 视频
    description: |
      Grok Imagine 系列视频生成接口，复用 `/v1/videos` 异步任务模型。
      分辨率由模型名后缀（`-480p` / `-720p`）决定，`size` 仅控制画幅比例。
paths:
  /v1/videos/{task_id}/content:
    get:
      tags:
        - Grok Imagine 视频
      summary: 获取 Grok 视频内容
      description: |
        获取已完成的 Grok 视频任务的视频文件内容。
        接口代理/重定向至视频文件流，返回原始 `video/mp4` 字节流。
        仅当任务 `status=completed` 时可用，未完成时返回 404。
      operationId: getGrokVideoContent
      parameters:
        - name: task_id
          in: path
          description: 视频任务 ID，由创建接口返回的 `id` 字段。
          required: true
          schema:
            type: string
          example: video_abc123
      responses:
        '200':
          description: 成功获取视频内容，返回原始 MP4 字节流
          content:
            video/mp4:
              schema:
                type: string
                format: binary
                description: 视频文件的原始字节流。
        '400':
          description: 请求参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: API Key 无效或缺失
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: 任务不存在、尚未完成或内容已过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      description: 标准错误响应。
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: 错误信息。
              examples:
                - 无效的时长。支持的范围为 1 到 15 秒。
            type:
              type: string
              description: 错误类型。
              examples:
                - invalid_request_error
            param:
              type:
                - string
                - 'null'
              description: 相关参数。
              examples:
                - seconds
            code:
              type:
                - string
                - 'null'
              description: 错误代码。
              examples:
                - invalid_duration
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        使用 Bearer Token 认证，格式：`Authorization: Bearer sk-xxxxxx`。
        在 [控制台](https://api.getinfinityblue.com/console) 获取 API Key。

````