Omni 视频

omni-fast 视频生成

使用 `POST /v1/videos` 调用 `omni-fast` 生成文生视频、图生视频、首尾帧和多参考图视频。

POSThttps://duoyuanx.com/v1/videos
请求示例
curl -X POST https://duoyuanx.com/v1/videos \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '
{
  "model": "omni-fast",
  "prompt": "Ocean waves gently rolling onto a sandy beach at golden hour, cinematic, warm sunlight",
  "seconds": "6",
  "aspect_ratio": "16:9"
}'
响应示例
{
  "id": "video_abc123",
  "task_id": "video_abc123",
  "object": "video",
  "model": "omni-fast",
  "status": "queued",
  "progress": 0,
  "created_at": 1735689600,
  "video_url": ""
}

omni-fast 使用 JSON 请求体提交异步视频任务,适合文生视频、首帧图生视频、首尾帧和多参考图视频。

  • 异步处理模式,提交后返回 id 或 task_id。
  • 文生视频只需要 model、prompt、seconds 和画面比例字段。
  • 首帧图生视频使用 first_image_url。
  • 首尾帧使用 first_image_url 和 last_image_url。
  • 多参考图使用 images,最多 5 张。

请求头

Authorizationstring必填

请求身份认证。使用 Bearer Token,示例值:Bearer YOUR_API_KEY。

Content-Typestring必填

请求内容类型,必须设置为 application/json。

请求体

modelstring必填

固定传 omni-fast。示例:"omni-fast"。

promptstring必填

视频提示词。示例:"Ocean waves gently rolling onto a sandy beach at golden hour"。

secondsstring

视频时长。支持 4s / 6s / 10s。示例:"10"。

aspect_ratiostring

画面比例。示例值:"16:9"、"9:16"。

first_image_urlstring

首帧图。传入后进入首帧图生视频模式。支持公网 URL 或 data:image/...;base64,...。示例:"https://example.com/first-frame.jpg"。

last_image_urlstring

尾帧图。需要配合 first_image_url 使用。示例:"https://example.com/last-frame.jpg"。

imagesarray<string>

多参考图列表,最多 5 张。支持公网 URL 或 data:image/...;base64,...。示例:["https://example.com/character.jpg"]。

请求示例

响应示例

响应字段

idstring

视频任务 ID。后续可用于 GET /v1/videos/{task_id} 查询。

task_idstring

视频任务 ID 的兼容字段。通常与 id 相同。

objectstring

对象类型,通常为 video。

modelstring

本次任务使用的模型,例如 omni-fast。

statusstring

任务状态。常见值为 queued、in_progress、completed、failed。

progressnumber

任务进度,常见范围为 0 到 100。

video_urlstring

完成后的视频地址。

errorobject

任务失败或接口错误时返回的错误对象,通常包含 message 和 code。

使用场景

竖屏文生视频

{
  "model": "omni-fast",
  "prompt": "A woman walking through a neon-lit Tokyo street at night, rain reflections, cinematic",
  "seconds": "6",
  "aspect_ratio": "9:16"
}

首帧图生视频

{
  "model": "omni-fast",
  "prompt": "The scene comes alive with gentle wind and drifting clouds",
  "first_image_url": "https://example.com/first-frame.jpg",
  "seconds": "6",
  "aspect_ratio": "16:9"
}

多参考图视频

{
  "model": "omni-fast",
  "prompt": "Use the first image as the character reference and the second image as the visual style reference.",
  "images": [
    "https://example.com/character.jpg",
    "https://example.com/style.jpg"
  ],
  "seconds": "6",
  "aspect_ratio": "16:9"
}

注意事项

  • omni-fast 不支持 video、video_url、input_video 参考视频字段。
  • images 最多 5 张。
  • 图片字段使用 JSON,不需要 multipart。
  • 建议轮询 GET /v1/videos/{task_id},完成后从返回的 video_url 获取生成的 MP4。

相关接口