下载视频

GET/v1/videos/{video_id}/content

下载已完成视频生成任务的成品视频内容。

请在 GET /v1/videos/{video_id} 返回 status: "completed" 后调用本接口。默认响应为 302 重定向到新的签名 URL;也可以返回 JSON 格式的 URL,或通过 API 直接流式返回视频二进制内容。

认证

Authorization Bearer

在 Authorization 请求头中使用 API Key 作为 Bearer Token。

路径和查询参数

video_idstringrequired

视频任务 ID。

formatenum<string>default:redirect

响应格式。redirect 返回 302 重定向,url 返回 JSON,binary 通过 API 流式返回视频文件。

Available options: redirect url binary

Response

redirect302

默认模式。重定向到签名视频 URL。

urlobject

当 format=url 时返回。

url.urlstring

签名视频 URL。

url.video_idstring

视频任务 ID。

url.expires_ininteger

签名 URL 有效期,单位为秒。

binaryvideo/mp4

当 format=binary 时返回。响应包含 Content-Disposition 附件文件名。

如果任务尚未完成,API 会返回包含当前状态的错误对象。

请求

Download Mode-1: Redirect download(重定向下载)

Shell
1curl -L https://api.token360.ai/v1/videos/your-video-id/content \
2  -H "Authorization: Bearer sk-your-api-key" \
3  -o video.mp4

Download Mode-2: Return a signed URL(返回签名 URL)

Shell
1curl "https://api.token360.ai/v1/videos/your-video-id/content?format=url" \
2  -H "Authorization: Bearer sk-your-api-key"

Download Mode-3: Stream binary content(流式返回二进制内容)

Shell
1curl "https://api.token360.ai/v1/videos/your-video-id/content?format=binary" \
2  -H "Authorization: Bearer sk-your-api-key" \
3  -o video.mp4

响应

签名 URL 响应:

JSON
1{
2  "url": "your-signed-video-url",
3  "video_id": "your-video-id",
4  "expires_in": 3600
5}

未就绪:

JSON
1{
2  "error": {
3    "message": "Video is not ready yet. Current status: in_progress",
4    "type": "invalid_request_error"
5  }
6}
此页面对您有帮助吗?