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

# Seedance 视频任务查询

> 查询 Seedance 兼容视频任务的状态与生成结果

使用创建任务时返回的 `id` 查询状态。响应保持 Seedance 协议字段，成功后可从 `content.video_url` 获取视频地址。

<Tip>
  建议每 10-15 秒轮询一次。设置 `return_last_frame: true` 后，成功响应还会包含可用于衔接下一段视频的尾帧地址。
</Tip>

## 轮询示例

```python Python theme={null}
import time
import requests

task_id = "cgt-20260730120000-a1b2c3"
url = f"https://api.haitoken.ai/v1/seedance/video/generations/{task_id}"
headers = {"Authorization": "Bearer YOUR_API_KEY"}

while True:
    result = requests.get(url, headers=headers).json()
    status = result.get("status")
    if status == "succeeded":
        print(result["content"]["video_url"])
        break
    if status in ("failed", "cancelled", "expired"):
        error = result.get("error") or {}
        print(error.get("code"), error.get("message"))
        break
    time.sleep(5)
```


## OpenAPI

````yaml zh/api-reference/video/seedance/openapi.json GET /v1/seedance/video/generations/{taskId}
openapi: 3.0.1
info:
  title: 默认模块
  description: ''
  version: 1.0.0
servers: []
security: []
tags: []
paths:
  /v1/seedance/video/generations/{taskId}:
    get:
      tags: []
      summary: 查询任务（seedance 兼容协议响应）
      description: |-
        <p>
        兼容seedance查询报文
      parameters:
        - name: taskId
          in: path
          description: ''
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: API Key token (Bearer sk-xxx)
          required: true
          example: 'Bearer '
          schema:
            type: string
        - name: Content-Type
          in: header
          description: ''
          example: application/json
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceQueryTaskResponse'
          headers: {}
      deprecated: false
      security: []
components:
  schemas:
    SeedanceQueryTaskResponse:
      type: object
      properties:
        created_at:
          type: integer
          description: 任务创建时间（Unix 时间戳，秒）
          format: int64
        updated_at:
          type: integer
          description: 任务最后更新时间（Unix 时间戳，秒）
          format: int64
        framespersecond:
          type: integer
          description: 生成视频帧率
        generate_audio:
          type: boolean
          description: |-
            生成视频帧率
            生成的视频是否包含与视觉同步的音频。此参数仅在seedance 2.0 & 2.0 fast和seedance 1.5 pro中支持。
            true：模型输出一个同步音频的视频。
            false：输出无声视频。
        safety_identifier:
          type: string
          description: 终端用户的唯一标识符。如果在创建视频生成任务时设置此参数，则API将返回不变的参数。
        service_tier:
          type: string
          description: 服务层级：default 在线推理 / flex 离线推理
        execution_expires_after:
          type: integer
          description: 任务超时阈值（秒），以秒为单位
        draft_task_id:
          type: string
          description: 草稿视频任务ID。当根据草稿视频生成正式视频时，返回该参数
        id:
          type: string
          description: 任务ID
        model:
          type: string
          description: 模型名称
        status:
          type: string
          description: 任务状态：queued / running / succeeded / failed / expired / cancelled
        error:
          $ref: '#/components/schemas/SeedanceError'
          description: 错误信息（任务失败时返回）
        content:
          $ref: '#/components/schemas/Content'
          description: 生成结果内容（任务成功时返回）
        usage:
          $ref: '#/components/schemas/Usage'
          description: Token 用量统计
        seed:
          type: integer
          description: 随机种子
          format: int64
        resolution:
          type: string
          description: 生成视频分辨率：480p / 720p / 1080p / 4k
        ratio:
          type: string
          description: 生成视频宽高比：16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9
        duration:
          type: integer
          description: 生成视频时长（秒）
        frames:
          type: string
          description: |-
            生成视频帧数
            注意：只返回duration和frames参数中的一个。如果在创建视频生成请求中指定了帧数，则将返回帧数。
        priority:
          type: integer
          description: 当前请求的执行优先级
        draft:
          type: boolean
          description: |-
            生成的视频是否为草稿视频。此参数仅由seedance 1.5 pro返回。
            true：当前输出为草稿视频。
            false：当前输出为标准视频。
    SeedanceError:
      type: object
      properties:
        code:
          type: string
          description: 错误码
        message:
          type: string
          description: 错误描述
    Content:
      type: object
      properties:
        video_url:
          type: string
          description: 生成视频的下载地址
        last_frame_url:
          type: string
          description: |-
            生成视频的最后一帧图片的下载地址
            如果在创建视频生成任务请求时设置了“return_last_frame”：true，则返回该参数。
    Usage:
      type: object
      properties:
        completion_tokens:
          type: integer
          description: 模型为视频输出所消耗的令牌数量
          format: int64
        total_tokens:
          type: integer
          description: 此请求的令牌总数。对于视频模型，输入令牌总是0，因此total_token = completion_token。
          format: int64

````