12API logo12API

Gemini Omni Flash

Gemini Omni Flash 的异步视频生成、首尾帧、参考图片与视频参数及限制

gemini-omni-1.1-flash 和 gemini-omni-flash-preview 支持文生视频、首尾帧、最多 10 张参考图和最多 3 段参考视频。采用异步调用:提交请求取得任务 ID,再查询状态和视频地址。

与旧 Omni 页面区分

本页两个模型均使用 /v1/task/submit。旧模型 omni_flash-10s 使用 /v1/videos,模型名、参数和响应结构都不能与本页混用。

快速了解

项目支持范围
任务流程POST /v1/task/submit 提交,GET /v1/task/{task_id} 查询
视频时长可选,3–10 秒整数
清晰度可选,360p、720p、1080p、4k
画面比例可选,16:9、9:16、auto
素材输入文字、首尾帧、最多 10 张参考图、最多 3 段参考视频(每段不超过 10 秒)
声音要求在 prompt 中描述

请求使用 Bearer 认证,生成参数统一放在 input 对象中:

Authorization: Bearer $API_KEY

请求参数

字段类型必填说明
modelstring是gemini-omni-1.1-flash 或 gemini-omni-flash-preview
input.promptstring是描述画面、动作、镜头及声音要求
input.durationinteger否3–10 秒整数;不传由上游决定
input.aspect_ratiostring否16:9、9:16、auto;不传由上游决定
input.resolutionstring否360p、720p、1080p、4k;不传由上游决定
input.first_framestring否起始帧图片
input.last_framestring否结束帧图片,需要同时提供 input.first_frame
input.image_referencesstring[]否参考图片数组,最多 10 张
input.video_referencesstring[]否参考视频数组,最多 3 段,每段不超过 10 秒
callback_urlstring否任务完成或失败后接收 POST 通知的公开 HTTP(S) 地址;放在请求体顶层

图片、视频支持公开 HTTP(S) URL 或 Base64 data URL。first_frame / last_frame 使用单个字符串,image_references / video_references 使用数组。不传参考素材即可文生视频。

请求示例

以下示例使用 gemini-omni-1.1-flash,也可将 model 替换为 gemini-omni-flash-preview。

curl https://cdn.12ai.org/v1/task/submit \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.1-flash",
    "input": {
      "prompt": "一段现代办公室产品展示视频,镜头平稳推进,光线明亮,节奏轻快",
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "duration": 5
    }
  }'
curl https://cdn.12ai.org/v1/task/submit \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.1-flash",
    "input": {
      "prompt": "参考图片中的小猪在草地上奔跑,镜头轻快跟随,画面明亮自然",
      "image_references": [
        "https://example.com/ref1.jpg"
      ],
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "duration": 3
    }
  }'
curl https://cdn.12ai.org/v1/task/submit \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.1-flash",
    "input": {
      "prompt": "让图片中的猫缓慢向前走,保持外观一致,最终停在结束帧的位置。",
      "first_frame": "https://example.com/cat-start.png",
      "last_frame": "https://example.com/cat-end.png",
      "duration": 5,
      "resolution": "720p"
    }
  }'

获取结果

提交成功后保存返回的 id:

{
  "id": "task_xxxxxxxxxxxxxxxx",
  "status": "queued",
  "phase": "queued",
  "created_at": 1790865001,
  "progress": null
}

queued 仅表示已受理,不代表生成成功。 再用任务 ID 查询状态:

curl https://cdn.12ai.org/v1/task/task_xxxxxxxxxxxxxxxx \
  -H "Authorization: Bearer $API_KEY"

建议每隔 3–5 秒查询一次,直到状态变为 completed 或 failed,然后停止轮询。

status含义
queued排队中
processing正在处理素材、生成视频或上传结果
completed完成,可读取 outputs
failed失败,可读取 error

成功结果示例,仅展示主要字段;outputs 为视频地址数组,可直接播放或下载:

{
  "id": "task_xxxxxxxxxxxxxxxx",
  "status": "completed",
  "phase": "completed",
  "progress": 100,
  "outputs": [
    "https://img.12ai.org/videos/task_xxxxxxxxxxxxxxxx_0.mp4"
  ],
  "error": null
}

失败结果示例:

{
  "id": "task_xxxxxxxxxxxxxxxx",
  "status": "failed",
  "phase": "failed",
  "outputs": [],
  "error": {
    "code": "capacity_unavailable",
    "message": "无可用账号"
  }
}

提交接口也可能直接返回 HTTP 错误,例如 400 参数错误、401 密钥无效、503 暂无可用账号。未取得任务 ID 时,无需继续查询。

回调格式见 异步视频任务。

使用建议

场景建议
快速文生视频不传参考素材,只用 prompt 描述画面、动作和镜头
参考图视频使用 image_references,最多 10 张
参考视频使用 video_references,最多 3 段,每段不超过 10 秒
横屏或竖屏横屏使用 16:9,竖屏使用 9:16;也可使用 auto
首尾帧使用 first_frame / last_frame;传尾帧时必须同时提供首帧

On this page