Documentation Index
Fetch the complete documentation index at: https://docs.kapon.cloud/llms.txt
Use this file to discover all available pages before exploring further.
查询任务状态
curl "$BASE_URL/v1beta/operations/{operation_id}" \
-H "Authorization: Bearer $TOKEN"
operation_id 来自创建任务时返回的 name 字段(如 operations/abc123xyz 中的 abc123xyz)。
响应示例
进行中
{
"name": "operations/abc123xyz",
"done": false
}
已完成
{
"name": "operations/abc123xyz",
"done": true,
"response": {
"generateVideoResponse": {
"generatedSamples": [{
"video": {"uri": "https://.../video.mp4"},
"metadata": {
"durationSeconds": 6,
"size": "1280x720"
}
}]
}
}
}
轮询建议
- 间隔 6-10 秒
- 超时设置 5-10 分钟
- 使用指数退避避免频繁请求
import time
def poll_operation(op_id, timeout=600):
start = time.time()
interval = 6
while time.time() - start < timeout:
resp = get_operation(op_id)
if resp.get("done"):
return resp
time.sleep(interval)
interval = min(interval * 1.5, 30)
raise TimeoutError("Operation timed out")