通过文本、图像或视频创建 Omni 视频
通过 CometAPI 使用 POST /v1/videos 创建 Beta 版 Omni 文生视频、图生视频或参考视频编辑任务,然后轮询任务并下载完成的 MP4 文件。
id 并轮询任务,直到其达到终止状态。
选择与输入模式匹配的请求内容类型。将文生视频和图生视频控制参数作为 multipart/form-data 字段发送。将参考视频编辑作为 application/json 请求正文发送。
选择输入模式
model=omni-fast。视频转视频示例使用 model=omni-fast-v2v。请使用 列出可用模型 来确认某个模型 ID 是否对您的 API 密钥可见。
为参考图像添加动画
对于图生视频,请使用model=omni-fast,并在 multipart input_reference 字段中上传一个 PNG 文件。对于文生视频,该字段仍为可选;但当参考图像应引导生成的视频时,该字段为必填。
将 prompt 聚焦于要添加的运动,并明确说明结果应保留的颜色、形状、主体或构图。代码示例选择器提供 Shell、Python 和 JavaScript 示例,这些示例会从工作目录上传 reference.png 并创建任务。
此请求结构仅涵盖一个上传的 PNG 文件。它未规定 URL 输入、其他图像格式、多个参考图像或文件大小限制。
编辑参考视频
对于视频转视频,将本地 MP4 文件编码为 base64,并在编码后的字节前添加data:video/mp4;base64,。在 video 字段中发送完整的数据 URL。
在 prompt 中描述请求的更改。同时说明结果应保留的主体、对象、构图或运动。代码示例选择器提供 Shell、Python 和 JavaScript 示例,这些示例会从工作目录读取 reference.mp4。
此请求结构涵盖内联 MP4 数据 URL。它未规定 URL 输入、其他视频容器格式或文件大小限制。
设置时长、比例和分辨率
Omni 被标记为 beta,因为生成稳定性可能因输入和所选路由而异。请保持首次请求规模较小,然后检查已完成的视频,再依赖特定的渲染时长或帧大小。aspect_ratio 和 resolution 视为生成偏好设置,并在依赖最终像素前验证下载的 MP4。
任务流程
创建任务
id。轮询任务
status 为 completed 或 failed。下载结果
completed 状态时,调用 检索 Omni 视频内容 以下载 MP4 文件。授权
Bearer authentication. Use your CometAPI API key.
请求体
Omni model ID for this endpoint. Use omni-fast for text-to-video and image-to-video.
"omni-fast"
Text prompt that describes the video to generate. For image-to-video, focus on motion and name the reference content that should be preserved.
"Ocean waves rolling onto a sandy beach at golden hour"
One PNG reference image uploaded as a multipart file. Optional for text-to-video and required for image-to-video. This contract does not define URL input, other image formats, multiple references, or a file-size limit.
Requested clip duration in seconds. The completed video can use a different duration.
"4"
Output aspect ratio preference. 16:9 and 9:16 are the most predictable; 1:1 can be accepted but may render as landscape.
16:9, 9:16, 1:1 "16:9"
Output resolution preference. Start with 720p. A request for 1080p can render at 720p.
"720p"
响应
Task accepted. Store the returned id and poll GET /v1/videos/{task_id}.
Task ID. Use this value with retrieve and content endpoints.
"task_example"
Object type. Video tasks return video.
"video"
Model ID used for the task.
"omni-fast"
Task lifecycle status. Poll until the value is completed, failed, or error.
queued, in_progress, completed, failed, error "queued"
Task progress as a coarse percentage.
0 <= x <= 1000
Task creation time as a Unix timestamp in seconds.
1779938152
Compatibility alias for id when present.
"task_example"
Task completion time as a Unix timestamp in seconds. This field appears on completed tasks.
1779938219
Temporary video delivery URL. This field appears on completed tasks.
"<temporary-video-url>"
Failure details. This field appears when the task fails.