视频创作
提交文本和可选参考素材创建异步视频任务,并轮询获取视频、封面和真实时长。
创建视频任务
按外部模型编码创建 text-to-video 任务;素材必须先通过文件接口上传并属于当前认证用户。
POST
/api/liveAiChat/createVideo请求地址:https://api.jiuma.com/api/liveAiChat/createVideo
请求参数
| 参数 | 类型 | 要求 | 说明 | 能力说明 |
|---|---|---|---|---|
prompt | string | 必填 | 非空视频描述;字数上限见本页实时模型能力表 | 查看 |
api_model_code | string | 必填 | 外部视频模型编码,例如 jiuma-video-2.0;必须是当前启用且属于视频类型的编码 | 查看 |
ratio | string | 选填 | 画幅随模型能力变化;未传时使用模型默认值 | 查看 |
duration | int|string | 选填 | 整数秒;范围和默认值随模型能力变化,不接受小数或布尔 | 查看 |
resolution | string | 选填 | 分辨率、默认值及与时长的组合见模型能力表;未声明清晰度的模型请省略 | 查看 |
material_order | array|string | 选填 | 有序素材数组或 JSON 文本,是素材唯一输入;省略或 [] 表示无素材,后端按 type 分类并保留次序,不开放资产库 | 查看 |
material_order[].type | string | 必填(提供顺序时) | image、video 或 audio,不接受 asset | — |
material_order[].fileId | int|string | 必填(提供顺序时) | 本人通过 /file/uploadMedia 上传的有效正整数 file_id;后端校验归属、实际类型和模型限制;同一文件可分别作为首尾帧查看文件上传说明 | 查看 |
material_order[].name | string | 选填 | 素材显示名称,不用于文件授权 | — |
material_order[].referenceFrameRole | string | 选填 | 仅 image 项:reference 普通参考(默认)、start 首帧、end 尾帧、loop 循环帧;首尾各最多一张,有尾必须有首;loop 仅支持 Grok/GK,不能与首尾并用;Dola、Seedance、Wan、MiniMax 的首尾帧不能混入普通参考图;以模型实际校验为准 | 查看 |
请求示例
cURL · Bash / macOS / Linux
curl -X POST "https://api.jiuma.com/api/liveAiChat/createVideo" \
-H "X-Secret-Key: <secret_id-secret_key>" \
-H "Content-Type: application/json" \
-d '{"api_model_code":"jiuma-video-2.0","prompt":"海边日落"}'普通参考请求示例
cURL · 文件 ID 须替换为本人上传结果
curl -X POST "https://api.jiuma.com/api/liveAiChat/createVideo" \
-H "X-Secret-Key: <secret_id-secret_key>" \
-H "Content-Type: application/json" \
-d '{"api_model_code":"jiuma-video-2.0","prompt":"参考图片中的海边场景","material_order":[{"type":"image","fileId":101,"referenceFrameRole":"reference"}]}'单首帧请求示例
cURL · 文件 ID 须替换为本人上传结果
curl -X POST "https://api.jiuma.com/api/liveAiChat/createVideo" \
-H "X-Secret-Key: <secret_id-secret_key>" \
-H "Content-Type: application/json" \
-d '{"api_model_code":"jiuma-video-2.0","prompt":"镜头缓慢向前推进","material_order":[{"type":"image","fileId":101,"referenceFrameRole":"start"}]}'首帧与尾帧请求示例
cURL · 文件 ID 须替换为本人上传结果
curl -X POST "https://api.jiuma.com/api/liveAiChat/createVideo" \
-H "X-Secret-Key: <secret_id-secret_key>" \
-H "Content-Type: application/json" \
-d '{"api_model_code":"jiuma-video-2.0","prompt":"海边白天逐渐过渡到日落","material_order":[{"type":"image","fileId":101,"referenceFrameRole":"start"},{"type":"image","fileId":102,"referenceFrameRole":"end"}]}'响应示例
JSON
{
"code": 200,
"message": "request_success",
"data": {
"task_id": "12345"
}
}关键返回字段
data.task_id- AI 回复消息 ID;创建成功后使用它调用 statusVideo。
常见失败原因
模型未启用或不属于视频类型、提示词为空、素材未上传或无权访问、模型能力组合不支持、额度不足。
查询视频任务状态
只读查询当前用户的视频任务,不触发供应商查询、重新计费或任务刷新。
POST
/api/liveAiChat/statusVideo请求地址:https://api.jiuma.com/api/liveAiChat/statusVideo
请求参数
| 参数 | 类型 | 要求 | 说明 | 能力说明 |
|---|---|---|---|---|
task_id | int|string | 必填 | createVideo 返回的正整数 AI 回复消息 ID;只能查询本人视频任务 | — |
请求示例
cURL · Bash / macOS / Linux
curl -X POST "https://api.jiuma.com/api/liveAiChat/statusVideo" \
-H "X-Secret-Key: <secret_id-secret_key>" \
-H "Content-Type: application/json" \
-d '{"task_id":"12345"}'响应示例
JSON
{
"code": 200,
"message": "request_success",
"data": {
"task_id": "12345",
"status": "success",
"results": [
{
"type": "video",
"url": "https://media.example.com/result.mp4",
"cover_url": "https://media.example.com/cover.jpg",
"duration": 6
}
],
"error_code": "",
"error_message": ""
}
}关键返回字段
data.status- pending、processing、success 或 failed。
data.results[].url- 授权消息关联的有效视频 URL。
data.results[].cover_url- 存在有效封面时返回。
data.results[].duration- 文件记录确认的真实秒数;无法确认时省略。
data.error_code/error_message- 任务失败时返回受控错误信息。
常见失败原因
task_id 非正整数、任务不存在、任务属于其他用户或媒体类型不匹配;成功消息没有有效文件时返回资源不可用。