跳转到主要内容
GET
/
v1
/
videos
/
{id}
cURL
curl https://api.cometapi.com/v1/videos/<TASK_ID> \
  -H "Authorization: Bearer <COMETAPI_KEY>"
{ "id": "task_abc123", "model": "doubao-seedance-2-0-fast", "object": "video", "status": "IN_PROGRESS", "progress": 45, "created_at": 1776567610, "completed_at": null }
使用此端点可读取通过创建一个 Seedance 视频创建的任务状态。路径中的 id 是创建调用返回的值,无论该任务是由哪个 Seedance 模型生成的。

状态机

任务会经历以下某一种状态。SUBMITTEDIN_PROGRESS 为非终态;SUCCESSFAILEDERROR 为终态,任务不会再继续变化。
StatusMeaningTerminal
SUBMITTED已接受并进入渲染队列。
IN_PROGRESS正在渲染中。
SUCCESS已完成。响应中会包含 video_url
FAILED提供方拒绝了该任务。
ERROR内部错误导致无法完成。

轮询频率

建议每 10 到 20 秒轮询一次。大多数任务会在 1 到 3 分钟内完成,具体取决于模型、时长和分辨率。
import time
import requests

TASK_ID = "<TASK_ID>"
headers = {"Authorization": "Bearer <COMETAPI_KEY>"}
TERMINAL = {"SUCCESS", "FAILED", "ERROR"}

while True:
    response = requests.get(
        f"https://api.cometapi.com/v1/videos/{TASK_ID}",
        headers=headers,
        timeout=15,
    )
    response.raise_for_status()
    data = response.json()
    if data["status"] in TERMINAL:
        print(data.get("video_url"))
        break
    time.sleep(10)

需要关注的字段

  • status — 决定你的轮询循环何时停止。
  • progress — 0 到 100 的整数,可用于在 UI 中展示。
  • video_url — 已签名的下载 URL,仅在 SUCCESS 时出现。签名有时间限制;请在签名过期前下载文件或将其重新托管。
  • completed_at — Unix 时间戳,在任务进入终态后填充。
  • model — 回显任务创建时使用的 Seedance model id。

常见错误

  • HTTP 400message: "task_not_exist" 表示该 id 不存在。请确认你记录的是成功的 POST /v1/videos 响应中返回的 id,并且按原样使用它。
  • HTTP 401 表示 bearer token 缺失或无效。请检查请求头是否为 Authorization: Bearer <COMETAPI_KEY>

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

路径参数

id
string
必填

Task id returned by POST /v1/videos.

响应

Current task state.

id
string
必填

Task id.

object
string
必填

Object type, always video.

model
string
必填

Model id that generated the task.

status
enum<string>
必填

Task status. SUBMITTED and IN_PROGRESS are non-terminal. SUCCESS, FAILED, and ERROR are terminal.

可用选项:
SUBMITTED,
IN_PROGRESS,
SUCCESS,
FAILED,
ERROR
progress
integer
必填

Completion percentage.

必填范围: 0 <= x <= 100
created_at
integer
必填

Task creation time as a Unix timestamp in seconds.

video_url
string | null

Signed download URL for the finished video. Present only when status is SUCCESS. The signature is time-limited, so download or re-upload the file to your own storage soon after you receive it.

completed_at
integer | null

Task completion time as a Unix timestamp in seconds. null while the task is non-terminal.