创建 Flux 3 视频
通过文本、参考图像或首尾帧创建 Flux 3 视频,并使用 720p 或 1080p 尺寸预设。
{
"id": "<task_id>",
"task_id": "<task_id>",
"object": "video",
"model": "flux-3",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}id,以轮询任务并下载完成的视频。
POST /v1/videos 使用 multipart/form-data。将控制参数作为表单字段发送。对于图像输入,请使用参考图像 URL 或起始帧和结束帧。
将 input_reference 与 first_frame 和 last_frame 分开。
选择输入模式
| 目标 | 必填字段 | 可选字段 |
|---|---|---|
| 文生视频 | model=flux-3, prompt | seconds, size |
| HTTPS 图生视频 | model=flux-3, prompt,一个 input_reference URL | seconds, size |
| 有序关键帧 | model=flux-3, prompt,重复的 input_reference URL | seconds, size |
| 上传起始帧 | model=flux-3, prompt,一个 first_frame 文件 | seconds, size |
| 首尾帧视频 | model=flux-3, prompt, first_frame, last_frame | seconds, size |
使用参考图像
input_reference 字段仅接受可公开访问的 HTTPS 图像 URL。对于单张图像,发送一次该字段;对于多张图像,则按照关键帧顺序重复发送。每个字段使用一个 URL,最多共 10 个 URL。
描述生成的视频应从参考图像中保留的运动、相机行为和视觉细节。
本页顶部的请求示例展示了单图和多图输入。以下请求按提交顺序使用两张图像:
curl \
https://api.cometapi.com/v1/videos \
-H "Authorization: Bearer $COMETAPI_KEY" \
--form-string 'model=flux-3' \
--form-string 'prompt=Move smoothly through the supplied reference images in their given order. Preserve recognizable subjects and visual details as the scene changes. Keep the camera movement gentle.' \
--form-string 'seconds=5' \
--form-string 'size=1280x720' \
--form-string 'input_reference=https://apidoc.cometapi.com/images/image/gemini/6100640_569429.png' \
--form-string 'input_reference=https://apidoc.cometapi.com/images/image/gemini/6100640_569420.png'
设置首尾帧
发送first_frame 以设置起始图像。要同时设置结束图像,请包含 last_frame,并在 prompt 中描述两帧之间的运动。
如果仅设置起始帧,请省略 last_frame。结束帧需要同时提供 first_frame 和 last_frame。
每个字段接受一个可公开访问的 HTTPS URL 或一个 PNG 或 JPEG 文件。每个字段仅发送一次,使用 URL 或文件之一。每个文件大小不得超过 20 MiB (20 × 1024 × 1024 字节).
本页顶部的帧示例展示了 URL 输入和文件上传,并显式设置了 seconds 和 size。
设置时长和尺寸
将seconds 显式设置为从 5 到 20 的整数。
将 size 设置为以下精确的 WxH 预设值之一:
| 分辨率档位 | 尺寸 |
|---|---|
720p | 1280x720 |
1080p | 1920x1080 |
任务流程
创建任务
id。轮询任务
status 为 completed 或 failed。下载结果
completed 状态时,调用 下载 Flux 3 视频内容 以保存 MP4 文件。请求体
Flux 3 multipart request. Choose text, input_reference URLs, or first_frame and last_frame inputs. Keep reference-image and frame inputs separate.
Reference image URLs. Send one publicly accessible HTTPS image URL per input_reference field. For multiple images, repeat the field in keyframe order, up to 10 URLs. This field accepts URLs only. Keep it separate from first_frame and last_frame.
^https://Opening-frame image as one publicly accessible HTTPS URL or one PNG or JPEG file. Keep each file at or below 20 MiB (20 × 1024 × 1024 bytes). Send the field once, using either a URL or a file. Pair with last_frame to set both boundaries. Keep frame inputs separate from input_reference.
^https://Closing-frame image as one publicly accessible HTTPS URL or one PNG or JPEG file. Keep each file at or below 20 MiB (20 × 1024 × 1024 bytes). Send the field once, using either a URL or a file. To specify the closing image through this endpoint, send last_frame together with first_frame. Keep frame inputs separate from input_reference.
^https://响应
Task created. Store the returned id and poll GET /v1/videos/{task_id}.
{
"id": "<task_id>",
"task_id": "<task_id>",
"object": "video",
"model": "flux-3",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}