功能与鉴权
创建后可能需要数分钟等待。每次查询和下载继续使用 Authorization: Bearer YOUR_API_KEY,Key 属于创建任务的同一个账号。
| 字段 | 示例 | 用途 |
|---|---|---|
| id | resp_veo_example | GET /v1/responses/{response_id} |
| metadata.task_id | task_veo_example | GET /v1/videos/{task_id}/content |
| metadata.retrieval_path | /v1/responses/resp_veo_example | 本站查询路径 |
直接读取响应中的 ID,不要手工修改前缀或传入 Google operation name。Responses 与视频任务两个 ID 的用途不同。
查询接口
GET https://top.qingyuntop.ai/v1/responses/{response_id}
路径参数 response_id 必填,来自创建响应顶层 id;无需请求体。返回普通 JSON 快照。约每 10 秒查询一次,不需要重复创建。
| 返回字段 | 含义 |
|---|---|
| object | 固定为 response |
| status | queued、in_progress、completed、failed;流式观察还可能出现 incomplete |
| model | 请求使用的模型名 |
| output | 结果消息数组,等待时通常为空 |
| output[].content[].text | type 为 output_text 时,是包含 video 标记的结果文本 |
| error | 失败信息对象,检查 code 与 message;没有错误时为 null |
| metadata.task_status | 底层任务状态,用于区分生成失败和结果观察失败 |
| metadata.task_id | 下载时使用的视频任务 ID |
| metadata.retrieval_path | 使用原任务继续查询的路径 |
| usage | 兼容响应可能是空值或零 token;不能用于计算视频费用,请查看本站价格与账单 |
查询并自动下载示例
把 resp_veo_example 替换为真实 id。Bash 需要 jq;Python 需要 requests;Node.js 使用 22+,保存为 .mjs。示例限制查询次数,超时后仍保留原 ID。429/5xx 可以延迟重试查询,生产程序应同时遵循 Retry-After;不要自动重试创建请求。
set -e
response_id="resp_veo_example"
for attempt in $(seq 1 90); do
http_code=$(curl -sS --max-time 60 -o response.json -w '%{http_code}' \
"https://top.qingyuntop.ai/v1/responses/$response_id" \
-H "Authorization: Bearer YOUR_API_KEY")
case "$http_code" in
429|5??) sleep 30; continue ;;
2??) ;;
*) cat response.json; exit 1 ;;
esac
status=$(jq -r '.status' response.json)
case "$status" in
completed)
task_id=$(jq -er '.metadata.task_id | select(startswith("task_"))' response.json)
curl --fail --location --max-time 180 \
"https://top.qingyuntop.ai/v1/videos/$task_id/content" \
-H "Authorization: Bearer YOUR_API_KEY" --output veo-output.mp4
exit 0 ;;
queued|in_progress) sleep 10 ;;
*) cat response.json; echo "请保留响应 ID,按错误文档排查"; exit 1 ;;
esac
done
echo "等待超时,请使用原响应 ID 稍后查询"
exit 1完成响应与视频地址
成功结果的关键字段示意如下;video 的 src 由服务端生成,示例地址不能用于真实下载。
{
"id": "resp_veo_example",
"object": "response",
"status": "completed",
"output": [{
"type": "message",
"role": "assistant",
"status": "completed",
"content": [{
"type": "output_text",
"text": "<video controls src=\"https://top.qingyuntop.ai/v1/tasks/task_veo_example/artifacts/video/content?access=PLACEHOLDER\"></video>"
}]
}],
"metadata": {
"task_id": "task_veo_example",
"task_status": "completed",
"retrieval_path": "/v1/responses/resp_veo_example"
},
"error": null
}src 是服务端生成的临时授权链接,不是 Google Key,也不是永久保存地址。不要自行拼接 access 参数或公开分享完整链接。服务端下载推荐使用上述带青云鉴权的 /v1/videos/{metadata.task_id}/content,无需从 HTML 字符串提取网址。下载成功后及时保存文件。
失败、观察超时与缺少结果
HTTP 200 只代表本次查询成功。status 为 failed 时检查 error 与 metadata.task_status;如果底层任务仍在进行,可稍后查询原 ID;底层已经 completed 但结果渲染失败时,保留 ID 联系支持。不要把响应的 HTML 文本或 JSON 错误写进 MP4。
同步 queued 或 SSE incomplete 后继续查询。连接断开不会取消已持久化的任务。completed 但下载返回 410、artifact_not_found,或 response 渲染失败,见错误与限制。