Skip to content

Grok Imagine 图生视频 ​

接口 ​

POST /videos/generations

完整 URL: https://modelfold.ai/v1/videos/generations

鉴权:所有请求都需要 Authorization: Bearer <API_KEY> 请求头。

模型参数直接放在 JSON 请求体中,不要套 input。请求等待生成完成后返回 data[].url;支持的媒体模型也可使用 异步创建、轮询及回调。示例素材地址须替换为自己的公开可访问文件。计费及错误说明见 API 网关。

视频生成任务的输入参数

请求参数 ​

请求体 (application/json) ​

参数类型必填说明
modelstring是用于生成的模型名称。必填字段。
- 此端点必须使用 grok-imagine/image-to-video 默认值:"grok-imagine/image-to-video"。 可选值:grok-imagine/image-to-video。 示例:grok-imagine/image-to-video。
image_urlsarray&lt;string&gt;否提供一个外部图像 URL 作为视频生成的参考。支持最多7个图像,不要与 task_id 同时使用。在提示词中引用已上传图片时,请输入 @image(n),并在其后加一个空格(例如:@image1 海边日落)。
- 支持 JPEG、PNG、WEBP 格式
- 每张图像最大文件大小:10MB
- 使用外部图像时 Spicy 模式不可用
- 数组最多包含七个 URL
- resolution为1080p时只支持一张。 maxItems: 7.
task_idstring否之前生成的 Grok 图像的任务 ID。与 index 配合使用选择特定图像,不要与 image_urls 同时使用。
- 使用 grok-imagine/text-to-image 生成的任务 ID
- 支持所有模式,包括 Spicy
- 最大长度:100 字符 maxLength: 100. 示例:task_grok_12345678。
indexinteger否使用 task_id 时,指定使用第几张图(从 0 开始)。grok-imagine/text-to-image 每个任务返回 2 张,所以取值为 0 或 1,默认 0。
- 如果提供了 image_urls 则忽略此参数 默认值:0。 minimum: 0. maximum: 1. 示例:0。
promptstring是本站网关要求传入 prompt,最长 2000 字。描述期望视频运动的文本提示。可选字段。
- 应该对期望的视觉运动详细具体
- 描述运动、动作序列、摄影工作和时间安排
- 包含主体、环境和运动动态的细节
- 最大长度:5000 字符
- 支持英文提示 maxLength: 2000. 示例:POV hand comes into frame handing the girl a cup of take away coffee, the girl steps out of the screen looking tired, then takes it and she says happily: "thanks! Back to work" she exits the frame and walks right to a different part of the office.。
modestring否指定影响运动风格和强度的生成模式。注意:外部图像输入不支持 Spicy 模式。
- fun: 更有创意和趣味的解读
- normal: 平衡方法,具有良好的运动质量
- spicy: 更有活力和强烈的运动效果(外部图像不可用)
默认值:normal 默认值:"normal"。 可选值:fun / normal / spicy。 示例:normal。
durationnumber否生成的视频时长(秒)(6-30)。(最小值:6,最大值:30,步长:1) 本站最短 6 秒,不支持 -1。
resolutionstring否生成视频的分辨率。 默认值:"480p"。 可选值:480p / 720p / 1080p。 示例:480p。
aspect_ratiostring否图像比例选择,仅适用于多图生成模式,单图模式下视频宽高参考图片宽高。 默认值:"16:9"。 可选值:2:3 / 3:2 / 1:1 / 16:9 / 9:16。 示例:16:9。
nsfw_checkerboolean否默认 false。为 false 时不额外进行内容过滤,结果由模型直接返回。

请求示例 ​

bash
curl -X POST "https://modelfold.ai/v1/videos/generations" \
  -H "Authorization: Bearer $MODELFOLD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine/image-to-video",
  "index": 0,
  "prompt": "POV hand comes into frame handing the girl a cup of take away coffee, the girl steps out of the screen looking tired, then takes it and she says happily: \"thanks! Back to work\" she exits the frame and walks right to a different part of the office.",
  "mode": "normal",
  "resolution": "480p",
  "aspect_ratio": "16:9"
}'
json
{
  "model": "grok-imagine/image-to-video",
  "index": 0,
  "prompt": "POV hand comes into frame handing the girl a cup of take away coffee, the girl steps out of the screen looking tired, then takes it and she says happily: \"thanks! Back to work\" she exits the frame and walks right to a different part of the office.",
  "mode": "normal",
  "resolution": "480p",
  "aspect_ratio": "16:9"
}

响应 ​

200 — 生成完成。usage 返回实际计费明细;结果地址仅作结构示例。 ​

json
{
  "ok": true,
  "created": 1792134000,
  "data": [
    {
      "url": "https://modelfold.ai/uploads/outputs/result.mp4"
    }
  ],
  "usage": {}
}

ModelFold — 一个 API,接入所有主流 AI 模型。