> ## Documentation Index
> Fetch the complete documentation index at: https://docs.toapis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini Omni Flash 视频生成

> 使用 Gemini Omni Flash 生成或编辑视频，支持文本、最多 10 张参考图或最多 3 个输入视频

* 通过 `model` 指定 `gemini-omni-flash-preview-official`
* 支持文生视频、图像/参考图生视频和视频编辑
* 最多支持 10 张参考图或 3 个输入视频；图片与视频不能混用
* 视频最长 10 秒；Playground 提供 4 / 6 / 8 / 10 秒预设
* 仅支持 `720p` 分辨率；支持 `16:9` 和 `9:16` 画幅
* 异步任务接口，提交后使用任务 ID 查询结果

<Note>
  本文档仅适用于 `gemini-omni-flash-preview-official`。平台通过 Vertex AI Interactions API 调用它（使用 Service Account OAuth），而不是 Vertex AI Publisher Model 的 `predictLongRunning` 接口。它与旧版 `gemini-omni-flash` / `gemini_omni_flash` 是两个独立模型，不会改变旧模型的路由或参数。
</Note>

<Warning>
  请先通过[图片上传 API](../../uploads/images)上传本地图片，通过[视频上传 API](../../uploads/videos)上传本地视频，再传入返回的 URL。不要直接传 base64 媒体数据。
</Warning>

## Authorizations

<ParamField header="Authorization" type="string" required>
  使用 Bearer Token 认证：

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" default="gemini-omni-flash-preview-official" required>
  模型名称。使用 `gemini-omni-flash-preview-official`。
</ParamField>

<ParamField body="prompt" type="string" required>
  视频生成提示词。
</ParamField>

<ParamField body="duration" type="integer" default="6">
  视频时长（秒），最大为 `10`。Playground 提供 `4`、`6`、`8`、`10` 秒预设。
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  视频比例，支持：

  * `16:9` 横屏
  * `9:16` 竖屏
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  视频分辨率：

  * `720p` 默认分辨率
  * 仅支持 `720p`，不接受 Veo 专属参数
</ParamField>

<ParamField body="image_urls" type="string[]">
  可选的参考图 URL 数组，最多 `10` 张。不传时为文生视频。不能与 `video_list` 同时使用。
</ParamField>

<ParamField body="video_list" type="object[]">
  可选的视频编辑输入，最多 `3` 个。每一项必须包含 `video_url`，例如 `{ "video_url": "https://example.com/input.mp4" }`。支持 HTTPS URL、data URI 和平台上传后返回的视频 URL；后端下载的单个输入视频最大 50 MB。不能与 `image_urls` 同时使用。
</ParamField>

<ParamField body="metadata" type="object">
  可选的 Interactions 生成参数。支持 `temperature`（`0.0`–`2.0`）、`topP` / `top_p`（`0.0`–`1.0`）、`candidateCount` / `candidate_count`、`previous_interaction_id`，以及 `task`（`text_to_video`、`image_to_video`、`reference_to_video` 或 `edit`）。省略 `task` 时，平台不会擅自默认；由上游根据 prompt 和媒体推断。对 `edit`（或带参考视频且未显式指定非 edit 任务）路径，平台会省略 `aspect_ratio`，因为上游拒绝在 edit 的 `response_format` 中设置宽高比。
</ParamField>

## Response

<ResponseField name="id" type="string">
  任务 ID，用于查询任务状态。
</ResponseField>

<ResponseField name="object" type="string">
  对象类型，通常为 `generation.task`。
</ResponseField>

<ResponseField name="model" type="string">
  使用的模型名称。
</ResponseField>

<ResponseField name="status" type="string">
  任务状态：`queued`、`in_progress`、`completed`、`failed`。
</ResponseField>

<ResponseField name="created_at" type="integer">
  任务创建时间戳。
</ResponseField>

<ResponseField name="video_url" type="string">
  任务完成后的生成视频 URL。
</ResponseField>

## Examples

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://toapis.com/v1/videos/generations \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "gemini-omni-flash-preview-official",
      "prompt": "一支蓝色按压瓶在纯白摄影棚中轻微转动，商业产品视频",
      "duration": 6,
      "aspect_ratio": "9:16",
      "resolution": "720p",
      "image_urls": ["https://example.com/reference.jpg"]
    }'
  ```
</RequestExample>

视频编辑示例：

```bash theme={null}
curl --request POST \
  --url https://toapis.com/v1/videos/generations \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-omni-flash-preview-official",
    "prompt": "保留镜头运动，把白天场景改成雨夜",
    "duration": 8,
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "video_list": [{"video_url": "https://example.com/input.mp4"}],
    "metadata": {"temperature": 1.0, "topP": 0.95}
  }'
```

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "video_01JZEXAMPLE",
    "object": "generation.task",
    "model": "gemini-omni-flash-preview-official",
    "status": "queued",
    "created_at": 1779247407
  }
  ```
</ResponseExample>

## 查询任务

提交接口会返回任务 ID。使用通用视频任务查询接口获取状态和结果：

```bash theme={null}
curl --request GET \
  --url https://toapis.com/v1/videos/generations/{task_id} \
  --header "Authorization: Bearer YOUR_API_KEY"
```
