生成视频
generate_videoGenerate videos from text prompts with optional first-frame or reference images, returning a task ID for polling and an estimated cost.
Instructions
用 Grok Imagine、Seedance 或 Kling 生成视频,会产生上游模型调用费用,返回 estimated_cost_usd。image 表示首帧;reference_images 表示不固定首帧的参考图。Grok、已适配 Seedance 与 Kling Omni 支持多参考图,数量和组合限制先查 list_media_models;Seedance 首帧与普通参考图不能混用。视频素材编辑暂未开放,上游编辑端点实测返回 HTTP 404;不要调用 video。长片先 prepare_story_shot,逐镜复用人物和衔接设定。立即返回 task_id,每约 5 秒用 get_task 续查。只有用户明确要求创作时调用。
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"operation_id": "<operation_id>",
"model": "<model>",
"prompt": "<prompt>"
},
"name": "generate_video"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | No | 视频首帧或单张编辑参考图:HTTPS、JPEG/PNG/WebP data URL 或本地图片路径 | |
| model | Yes | 先从 list_media_models 选择可用模型 | |
| video | No | 待编辑的单段 HTTPS MP4 视频链接,最长 8.7 秒;不支持本地路径、视频 data URL、多段混剪或视频延长。输出沿用源时长和比例,最高 720p | |
| prompt | Yes | 用户希望生成的内容 | |
| duration | No | 生成视频秒数,默认 5;视频编辑不得传入 | |
| credential | No | 密钥别名;多把密钥时必填,不能传密钥本身 | |
| image_file | No | ChatGPT 聊天中附加的单张图片,作用同 image;其他客户端请用 create_upload_link | |
| resolution | No | 模型支持的清晰度;以 list_media_models 为准 | |
| aspect_ratio | No | 模型支持的比例;图片默认 1:1,视频默认 16:9 | |
| operation_id | Yes | 本次创作唯一标识,例如 UUID。重试同一请求须复用原值,防止重复提交;新的用户需求才用新值 | |
| reference_files | No | ChatGPT 聊天中附加的多张参考图,按顺序追加在 reference_images 之后 | |
| reference_images | No | 有序参考图片列表;格式同 image,素材合计不超过 14 MB。Grok 图片最多 3 张,视频经典版 7/1.5 版 14 张;已适配 Seedance 2.0 最多 9/2.5 最多 14 张、Kling Omni 7 张、Midjourney 10 张、部分 GPT Image 14 张。准确型号与首帧组合限制以 list_media_models.inputs 为准 |