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

# 查询 Grok Imagine 视频任务

> 查询 Grok Imagine 异步视频任务的状态、生成结果和计费用量。
建议轮询间隔不少于 3 秒，生产环境建议 5–10 秒。


查询 Grok Imagine 异步视频任务的状态、生成结果和计费用量。

```
GET /v1/grok-imagine/videos/generations/{id}
Authorization: Bearer <API_KEY>
```

`id` 为 [创建 Grok Imagine 视频任务](/api/videos/grok-imagine-create-task) 返回的任务 ID，格式通常以 `vidtask_` 开头。

<Warning>
  不要高频轮询。建议间隔 **5–10 秒**，最短不低于 3 秒。视频生成通常需要 30 秒至数分钟。
</Warning>

***

## 示例

```bash theme={null}
curl "https://{your-domain}/v1/grok-imagine/videos/generations/vidtask_87485721c5b54dc9a97467f8a1812b09" \
  -H "Authorization: Bearer $API_KEY"
```

***

## 响应字段

| 字段                              | 类型      | 说明                                                                             |
| ------------------------------- | ------- | ------------------------------------------------------------------------------ |
| `id`                            | string  | 平台任务 ID。                                                                       |
| `object`                        | string  | 固定为 `video.generation.task`。                                                   |
| `created`                       | integer | 任务创建时间，Unix 秒。                                                                 |
| `created_at`                    | integer | 任务创建时间，Unix 秒。                                                                 |
| `updated_at`                    | integer | 任务状态最后更新时间，Unix 秒。                                                             |
| `model`                         | string  | 平台模型名称。                                                                        |
| `status`                        | string  | 任务状态：`queued`、`running`、`succeeded`、`failed`、`cancelled`、`expired`。            |
| `billing_status`                | string  | 账务状态：`frozen`、`settling`、`settled`、`refunded`、`settle_failed`、`refund_failed`。 |
| `content.video_url`             | string  | 生成视频 URL，任务成功时返回。请及时下载和转存。                                                     |
| `content.video_url_expires_at`  | string  | 视频 URL 过期时间，RFC3339 格式。                                                        |
| `error.code`                    | string  | 失败错误码。                                                                         |
| `error.message`                 | string  | 失败说明。                                                                          |
| `usage.billing_unit`            | string  | 计费单位，Grok Imagine 为 `video_second`。                                            |
| `usage.unit_name`               | string  | 单位名称，通常为 `video_second`。                                                       |
| `usage.requested_units`         | string  | 请求秒数，通常等于 `duration`。                                                          |
| `usage.billable_units`          | string  | 对外结算单位数，通常为输出视频秒数。                                                             |
| `usage.billable_input_images`   | string  | 存在时表示实际计费的输入图张数。                                                               |
| `usage.billable_output_seconds` | string  | 存在时表示实际计费的输出视频秒数。                                                              |
| `usage.input_charge_amount`     | string  | 存在时表示输入图费用。                                                                    |
| `usage.output_charge_amount`    | string  | 存在时表示输出视频费用。                                                                   |
| `usage.charge_amount`           | string  | 存在时表示本次任务总费用。                                                                  |

***

## 响应示例

<CodeGroup>
  ```json 排队中 theme={null}
  {
    "id": "vidtask_87485721c5b54dc9a97467f8a1812b09",
    "object": "video.generation.task",
    "created": 1779782400,
    "created_at": 1779782400,
    "updated_at": 1779782400,
    "model": "grok-imagine-video-1.5-preview",
    "status": "queued",
    "billing_status": "frozen"
  }
  ```

  ```json 成功 theme={null}
  {
    "id": "vidtask_87485721c5b54dc9a97467f8a1812b09",
    "object": "video.generation.task",
    "created": 1779782400,
    "created_at": 1779782400,
    "updated_at": 1779782488,
    "model": "grok-imagine-video-1.5-preview",
    "status": "succeeded",
    "billing_status": "settled",
    "duration": 6,
    "ratio": "16:9",
    "resolution": "720p",
    "content": {
      "video_url": "https://example.com/generated-video.mp4",
      "video_url_expires_at": "2026-07-17T12:00:00Z"
    },
    "usage": {
      "billing_unit": "video_second",
      "unit_name": "video_second",
      "requested_units": "6",
      "billable_units": "6",
      "billable_input_images": "1",
      "billable_output_seconds": "6",
      "input_charge_amount": "0.060000",
      "output_charge_amount": "5.040000",
      "charge_amount": "5.100000"
    }
  }
  ```

  ```json 失败 theme={null}
  {
    "id": "vidtask_87485721c5b54dc9a97467f8a1812b09",
    "object": "video.generation.task",
    "created": 1779782400,
    "created_at": 1779782400,
    "updated_at": 1779782488,
    "model": "grok-imagine-video-1.5-preview",
    "status": "failed",
    "billing_status": "refunded",
    "error": {
      "code": "failed",
      "message": "Failed to download the provided image. Ensure the image URL is publicly accessible."
    }
  }
  ```
</CodeGroup>


## OpenAPI

````yaml GET /v1/grok-imagine/videos/generations/{id}
openapi: 3.1.0
info:
  title: WengaoCloud AI Gateway API
  version: 0.1.0
  description: WengaoCloud AI 聚合平台公开 API 契约草案，覆盖 OpenAI 兼容接口、Anthropic 原生接口和平台扩展接口。
servers:
  - url: https://xxx.wengaocloud.com
    description: 问高云 API 网关根域名。OpenAI SDK 的 base_url 使用 https://xxx.wengaocloud.com/v1。
  - url: https://{tenant}.wengaocloud.com
    description: 控制台展示的租户或 OEM API 网关根域名。
    variables:
      tenant:
        default: xxx
security:
  - bearerAuth: []
tags:
  - name: models
    x-group: 模型
  - name: openai-compatible
    x-group: OpenAI 兼容接口
  - name: anthropic-native
    x-group: Anthropic 原生接口
  - name: images-v3
    x-group: 图片（V3 同步）
  - name: volcengine-images
    x-group: 图片（火山直连）
  - name: images
    x-group: 图片（V1 兼容）
  - name: async-images
    x-group: 图片异步任务
  - name: aliwan-images
    x-group: 图片（百炼万相）
  - name: videos
    x-group: 视频
paths:
  /v1/grok-imagine/videos/generations/{id}:
    get:
      tags:
        - videos
      summary: 查询 Grok Imagine 视频任务
      description: |
        查询 Grok Imagine 异步视频任务的状态、生成结果和计费用量。
        建议轮询间隔不少于 3 秒，生产环境建议 5–10 秒。
      operationId: getGrokImagineVideoGenerationTask
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: 创建接口返回的任务 ID，格式通常以 `vidtask_` 开头。
      responses:
        '200':
          description: Grok Imagine 视频任务状态与结果。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationTaskResponse'
              examples:
                running:
                  value:
                    id: vidtask_87485721c5b54dc9a97467f8a1812b09
                    object: video.generation.task
                    created: 1779782400
                    created_at: 1779782400
                    updated_at: 1779782420
                    model: grok-imagine-video-1.5-preview
                    status: running
                    billing_status: frozen
                succeeded:
                  value:
                    id: vidtask_87485721c5b54dc9a97467f8a1812b09
                    object: video.generation.task
                    created: 1779782400
                    created_at: 1779782400
                    updated_at: 1779782488
                    model: grok-imagine-video-1.5-preview
                    status: succeeded
                    billing_status: settled
                    duration: 6
                    ratio: '16:9'
                    content:
                      video_url: https://example.com/generated-video.mp4
                      video_url_expires_at: '2026-07-17T12:00:00Z'
                    usage:
                      billing_unit: video_second
                      unit_name: video_second
                      requested_units: '6'
                      billable_units: '6'
                      billable_input_images: '1'
                      billable_output_seconds: '6'
                      input_charge_amount: '0.060000'
                      output_charge_amount: '5.040000'
                      charge_amount: '5.100000'
                failed:
                  value:
                    id: vidtask_87485721c5b54dc9a97467f8a1812b09
                    object: video.generation.task
                    created: 1779782400
                    created_at: 1779782400
                    updated_at: 1779782488
                    model: grok-imagine-video-1.5-preview
                    status: failed
                    billing_status: refunded
                    error:
                      code: failed
                      message: >-
                        Failed to download the provided image. Ensure the image
                        URL is publicly accessible.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    VideoGenerationTaskResponse:
      type: object
      required:
        - id
        - object
        - status
      properties:
        id:
          type: string
          example: vidtask_3cb6299b32d24f93a82e8a74b3e06161
        object:
          type: string
          enum:
            - video.generation.task
        created:
          type: integer
          description: 任务创建时间，Unix 秒。
        created_at:
          type: integer
          description: 任务创建时间，Unix 秒。
        updated_at:
          type: integer
          description: 任务状态更新时间，Unix 秒。
        model:
          type: string
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
            - cancelled
            - expired
          description: |
            任务状态：`queued`（排队中）、`running`（运行中）、`succeeded`（成功）、
            `failed`（失败）、`cancelled`（已取消）、`expired`（已超时）。
        billing_status:
          type: string
          enum:
            - frozen
            - settling
            - settled
            - refunded
            - settle_failed
            - refund_failed
          description: |
            账务状态：`frozen`（已冻结）、`settling`（结算中）、`settled`（已结算）、
            `refunded`（已退款）、`settle_failed`（结算失败）、`refund_failed`（退款失败）。
        content:
          type: object
          description: 视频生成结果，任务成功且存在视频地址时返回。
          properties:
            video_url:
              type: string
              description: 生成视频 URL，请及时下载和转存。
            video_url_expires_at:
              type: string
              description: 视频 URL 过期时间，RFC3339 格式。
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
        usage:
          type: object
          description: 用量信息，任务完成并完成用量统计后返回。Token 视频模型返回 token 字段；Grok Imagine 返回按秒计费字段。
          properties:
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
            billing_unit:
              type: string
              description: 计费单位，例如 `video_second`。
            unit_name:
              type: string
              description: 单位名称，例如 `video_second`。
            requested_units:
              oneOf:
                - type: string
                - type: number
              description: 请求单位数。Grok Imagine 中通常为请求的视频秒数。
            billable_units:
              oneOf:
                - type: string
                - type: number
              description: 实际结算单位数。Grok Imagine 中通常为输出视频秒数。
            billable_input_images:
              oneOf:
                - type: string
                - type: number
              description: 实际计费的输入图张数，存在时返回。
            billable_output_seconds:
              oneOf:
                - type: string
                - type: number
              description: 实际计费的输出视频秒数，存在时返回。
            input_charge_amount:
              oneOf:
                - type: string
                - type: number
              description: 输入图费用，存在时返回。
            output_charge_amount:
              oneOf:
                - type: string
                - type: number
              description: 输出视频费用，存在时返回。
            charge_amount:
              oneOf:
                - type: string
                - type: number
              description: 本次任务总费用，存在时返回。
        seed:
          type: integer
        resolution:
          type: string
        ratio:
          type: string
        duration:
          oneOf:
            - type: integer
            - type: string
        frames:
          type: integer
        framespersecond:
          type: integer
        generate_audio:
          type: boolean
        service_tier:
          type: string
        expires_at:
          type: integer
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request_error
            code:
              type: string
              example: model_endpoint_mismatch
            message:
              type: string
              example: 该模型不支持当前 endpoint。
  responses:
    Unauthorized:
      description: API Key 缺失或无效。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: 资源不存在。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      x-default: sk-your-api-key

````