Skip to main content
GET
/
v1
/
task
/
{task_id}
获取视频任务状态
curl --request GET \
  --url https://api.qclawrouter.com/v1/task/{task_id}

Documentation Index

Fetch the complete documentation index at: https://docs.qclawrouter.com/llms.txt

Use this file to discover all available pages before exploring further.

说明

视频生成任务提交后,使用此接口轮询任务状态。视频生成通常需要 30 秒到几分钟不等。

请求示例

cURL
curl https://api.qclawrouter.com/v1/task/task_xxx \
  -H "Authorization: Bearer sk-your-api-key"
Python
import requests
import time

def wait_for_video(task_id, api_key):
    headers = {"Authorization": f"Bearer {api_key}"}
    while True:
        resp = requests.get(
            f"https://api.qclawrouter.com/v1/task/{task_id}",
            headers=headers
        )
        data = resp.json()
        if data["status"] == "succeeded":
            return data["output"]["url"]
        elif data["status"] == "failed":
            raise Exception(data["error"])
        time.sleep(5)  # 每5秒轮询一次

返回示例

完成:
{
  "task_id": "task_xxx",
  "status": "succeeded",
  "output": {
    "url": "https://cdn.qclawrouter.com/videos/xxx.mp4",
    "duration": 5,
    "resolution": "1080p"
  }
}
生成的视频文件保存 14 天后自动删除,请及时下载保存。