视频生成API

本文将介绍慧星云创建视频生成任务 API 接口的使用。支持文生视频、图生视频,兼容 OpenAI Videos API 接口格式。

接口地址

https://api.huixingyun.com/v1
接口名说明
/videos视频任务创建接口,支持文生视频(根据文本描述生成视频)和图生视频(根据参考图片和文本描述生成视频)
/videos/:id查询视频任务接口,根据视频任务 ID 查询生成进度和结果
/videos/:id/content视频获取接口,根据视频任务 ID 下载视频内容

鉴权

使用 Bearer token 方式进行 API 鉴权,格式为 Bearer 加上 API Key。Curl 请求中 HTTP Auth 头示例:--header 'Authorization: Bearer sk-xxxxxxxxxxxxxx' \

请求

Body
名称类型是否必填说明
modelstring模型id
promptstring视频生成的文本描述提示词。
input_referencestring参考图片,支持 url 或者 base64编码
secondsstring视频时长(秒),可选值:4812。默认值:8
sizestring视频分辨率,格式:宽x高 可选值:1280x720720x12801920x10801080x19203840x21602160x3840 默认值:1280x720

响应

Body
名称类型说明
idstring视频生成任务 ID 。创建视频生成任务为异步接口,获取 ID 后,需要通过 查询视频生成任务 API 来查询视频生成任务的状态。
objectstring对象类型,固定为 video
modelstring使用的模型名称
statusstring任务状态,见下方状态说明
reated_atinteger创建时间 (Unix 时间戳,秒)
updated_atinteger更新时间 (Unix 时间戳,秒)
completed_atinteger完成时间 (Unix 时间戳,秒),仅在已完成时返回
secondsstring视频时长 (秒)
sizestring视频分辨率 (宽 x 高)
errorobject错误信息,仅在失败时返回

调用示例

创建视频任务

文生视频
curl -X POST https://api.huixingyun.com/v1/videos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-cuN8CNKiY76GtOGGCa2f**********528bB4111e91Ec226d" \ -d '{ "model": "veo-3.1-fast-generate-001", "prompt": "A cat playing with a ball of yarn in a sunny garden", "seconds": "4", "size": "720x1280" }'
图生视频
curl -X POST https://api.huixingyun.com/v1/videos \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-cuN8CNKiY76GtOGGCa2f**********528bB4111e91Ec226d" \ -d '{ "model": "veo-3.1-fast-generate-001", "prompt": "镜头缓慢推进,画面中的场景逐渐生动起来,光影流动,充满动感", "input_reference": "https://example.com/reference-image.jpg", "seconds": "4", "size": "1280x720" }'{ { "id": "video_bGl***********1jMTdlOWIxNGViYTE=", "object": "video", "status": "processing", "created_at": null, "completed_at": null, "expires_at": null, "error": null, "progress": null, "remixed_from_video_id": null, "seconds": null, "size": null, "model": "veo-3.1-fast-generate-001", "usage": { "duration_seconds": 4.0 } } }

视频任务查询

curl -X POST https://api.huixingyun.com/v1/videos/$VIDEO_ID \ -H "Authorization: Bearer sk-cuN8CNKiY76GtOGGCa2f**********528bB4111e91Ec226d" \{ "id": "video_bGl***********1jMTdlOWIxNGViYTE=", "object": "video", "status": "completed", "created_at": 1775037188, "completed_at": null, "expires_at": null, "error": null, "progress": null, "remixed_from_video_id": null, "seconds": null, "size": null, "model": "veo-3.1-fast-generate-001", "usage": null }
2026-04-01