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

# 查询视频 · 即梦兼容

> 查询任务状态、判断成功或失败，并获取视频下载地址。

## 查询与状态判断

把 `<TASK_ID>` 替换为返回的 `task_id`，保持相同 `req_key`，每 10 到 15 秒查询一次：

```bash theme={"system"}
curl "https://api.aiohub.org/jimeng/?Action=CVSync2AsyncGetResult&Version=2022-08-31" \
  -H "Authorization: Bearer <AIOHUB_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "req_key": "doubao-seedance-2-0-fast-260128",
    "task_id": "<TASK_ID>"
  }'
```

| `data.status` | 处理 |
| - | - |
| `SUBMITTED` / `QUEUED` / `IN_PROGRESS` | 继续查询 |
| `SUCCESS` | 读取 `data.result_url` 并下载 |
| `FAILURE` | 停止查询，读取 `data.fail_reason` |

顶层 `code: success` 表示查询请求成功，不代表视频已生成。成功任务的关键字段如下：

```json theme={"system"}
{
  "code": "success",
  "data": {
    "status": "SUCCESS",
    "result_url": "https://api.aiohub.org/v1/videos/task_example/content"
  }
}
```

任务成功后，按 [下载视频](/cn/api/video-content) 保存文件。

## 失败与重试

查询断线后继续用原 `task_id` 查询；`FAILURE` 时读取 `data.fail_reason`。不要用 `CVSync2AsyncSubmitTask` 重试查询。文件保留 72 小时，任务记录保留 7 天。

收到 429 或临时不可用错误时，等待后重试查询，不要重新创建任务。查询不到任务时，确认任务标识和 API 令牌所属账号。


## OpenAPI

````yaml openapi/jimeng-result.json POST /jimeng/
openapi: 3.0.1
info:
  title: AIOHub 即梦视频 API
  version: 1.0.0
servers:
  - url: https://api.aiohub.org
security: []
paths:
  /jimeng/:
    post:
      tags:
        - 即梦视频
      summary: 查询即梦视频任务
      description: >
        即梦查询操作，通过 Action=CVSync2AsyncGetResult 区分。


        顶层 code: success 只代表查询成功。检查 data.status，SUCCESS 时下载
        data.result_url，FAILURE 时读取 data.fail_reason。
      operationId: getJimengSeedanceVideo
      parameters:
        - name: Action
          in: query
          required: true
          schema:
            type: string
            enum:
              - CVSync2AsyncGetResult
            default: CVSync2AsyncGetResult
          description: 操作名称，使用此页的固定值。
        - name: Version
          in: query
          required: true
          schema:
            type: string
            enum:
              - '2022-08-31'
            default: '2022-08-31'
          description: 协议版本。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                req_key:
                  type: string
                  description: 与创建任务相同的模型名。
                task_id:
                  type: string
                  description: 提交响应顶层 task_id。
              required:
                - req_key
                - task_id
            example:
              req_key: doubao-seedance-2-0-fast-260128
              task_id: task_example
      responses:
        '200':
          description: 查询成功，须继续检查 data.status。
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: 查询成功时为 success，不代表视频生成成功。
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      task_id:
                        type: string
                      status:
                        type: string
                        enum:
                          - SUBMITTED
                          - QUEUED
                          - IN_PROGRESS
                          - SUCCESS
                          - FAILURE
                      progress:
                        type: string
                        description: 进度文本，例如 100%。
                      result_url:
                        type: string
                        description: 成功后返回带鉴权的 HTTPS 下载地址。
                        format: uri
                      fail_reason:
                        type: string
                        description: 失败原因，失败时检查。
                      submit_time:
                        type: integer
                        format: int64
                      start_time:
                        type: integer
                        format: int64
                      finish_time:
                        type: integer
                        format: int64
                    required:
                      - task_id
                      - status
                      - fail_reason
                required:
                  - code
                  - data
              examples:
                pending:
                  summary: 处理中
                  value:
                    code: success
                    message: ''
                    data:
                      task_id: task_example
                      status: IN_PROGRESS
                      progress: 50%
                      fail_reason: ''
                succeeded:
                  summary: 生成成功
                  value:
                    code: success
                    message: ''
                    data:
                      task_id: task_example
                      status: SUCCESS
                      progress: 100%
                      fail_reason: ''
                      result_url: https://api.aiohub.org/v1/videos/task_example/content
                failed:
                  summary: 生成失败
                  value:
                    code: success
                    message: ''
                    data:
                      task_id: task_example
                      status: FAILURE
                      fail_reason: Video generation failed
        '400':
          description: 字段错误或任务不存在；检查 task_id 与账号。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceTaskError'
        '401':
          description: API 令牌缺失或无效。
        '429':
          description: 请求过多，等待后重试。
      security:
        - BearerAuth: []
components:
  schemas:
    SeedanceTaskError:
      type: object
      description: 视频任务接口的错误响应。
      properties:
        code:
          type: string
          description: 错误码
          example: invalid_duration
        message:
          type: string
          description: 错误信息
          example: duration must be between 4 and 30 seconds for this model
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key (sk-xxx)

````

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