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

# 查询视频任务

> Query the status and result of a video generation task.

> \[!IMPORTANT]
> 视频下载地址（`video_url`）的保存有效期为 **3天**，请及时转存。

### 任务状态说明

| 状态值 (status)                       | 说明                            | 对应进度 (progress) | 备注                                   |
| :--------------------------------- | :---------------------------- | :-------------- | :----------------------------------- |
| `queued` / `pending` / `submitted` | **排队中 / 已提交**。任务已成功提交，正在等待调度。 | `0`             | 初始状态。                                |
| `processing`                       | **生成中**。任务已开始在模型侧运行。          | `1 - 99`        | 进度会随着生成过程实时更新。                       |
| `completed`                        | **成功**。视频生成完成。                | `100`           | 此时可在 `result.video_url` 获取生成的视频下载链接。 |
| `failed`                           | **失败**。视频生成任务运行出错。            | `0`             | 可以在 `error_message` 字段中查看具体的失败原因。    |

### 状态机展示

```mermaid theme={null}
graph TD
    classDef queued fill:#e0f2fe,stroke:#0284c7,stroke-width:2px;
    classDef processing fill:#fef9c3,stroke:#ca8a04,stroke-width:2px;
    classDef completed fill:#dcfce7,stroke:#15803d,stroke-width:2px;
    classDef failed fill:#fee2e2,stroke:#b91c1c,stroke-width:2px;

    Start((任务创建)) --> queued[queued / pending / submitted<br>排队中]
    queued --> processing[processing<br>生成中]
    processing --> completed[completed<br>成功]
    processing --> failed[failed<br>失败]

    class queued queued;
    class processing processing;
    class completed completed;
    class failed failed;
```


## OpenAPI

````yaml GET /api/open-api/v1/videos/{taskId}
openapi: 3.1.0
info:
  title: Jimmy AI OpenAPI
  description: API for Jimmy AI video generation services
  version: 1.0.0
servers:
  - url: https://www.jimmyai.cn
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/open-api/v1/videos/{taskId}:
    get:
      summary: Query Video Task
      description: Query the status and result of a video generation task.
      operationId: queryVideo
      parameters:
        - name: taskId
          in: path
          required: true
          description: The ID of the task to query
          schema:
            type: string
      responses:
        '200':
          description: Task status and result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoQueryResponse'
components:
  schemas:
    VideoQueryResponse:
      type: object
      properties:
        code:
          type: string
          example: '20000'
        msg:
          type: string
          example: ok
        data:
          type: object
          properties:
            task_id:
              type: string
            status:
              type: string
            progress:
              type: integer
            model:
              type: string
            created_at:
              type: integer
              format: int64
            completed_at:
              type: integer
              format: int64
            result:
              type: object
              properties:
                video_url:
                  type: string
                  description: URL of the generated video (Valid for 3 days)
                image_url:
                  type: string
                  description: >-
                    URL of the generated image (for image tasks, Valid for 3
                    days)
            error_message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````