创建 Omni 视频
通过 POST /v1/videos 使用 CometAPI 创建 Beta 版 Omni 文本转视频或参考视频编辑任务,然后轮询任务并下载完成的 MP4 文件。
id,并轮询任务,直到其达到终止状态。
选择与输入模式匹配的请求内容类型。将文本转视频控件作为 multipart/form-data 字段发送。将参考视频编辑作为 application/json 请求体发送。
选择输入模式
model=omni-fast。视频转视频示例使用 model=omni-fast-v2v。使用 列出可用模型 以确认模型 ID 对您的 API 密钥可见。
编辑参考视频
对于视频转视频,请将本地 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.
"omni-fast"
Text prompt that describes the video to generate.
"Ocean waves rolling onto a sandy beach at golden hour"
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.