# Gemini Omni 1.2 Flash Video Generation

Create Gemini Omni 1.2 Flash (Google) text-to-video, multi-reference video, or strict first-frame and first-and-last-frame video tasks with `gemini-omni-1.2-flash`. Pass reference assets via `ref`.

> A model is callable only when it appears in `GET /v1/models` for your current API key. A successful creation response, task ID, or in-progress status does not mean a deliverable video has been obtained.

## Endpoints & Authentication

```http
POST https://vip.brioi.com/v1/videos
GET  https://vip.brioi.com/v1/videos/{task_id}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## Request Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---:|---|---|
| `model` | string | Yes | — | Must be `gemini-omni-1.2-flash`. |
| `prompt` | string | Yes | — | Non-empty video description. Reference input assets with the literal model tags `@图片1`, `@视频1`, etc. |
| `ref` | object[] | No | — | Reference assets; see `ref` items below. Omit for text-to-video. |
| `duration` | integer | No | `5` | Output duration in integer seconds (`3–15`). |
| `aspect_ratio` | string | No | `9:16` | Supports `9:16`, `16:9`. |
| `resolution` | string | No | `720p` | Supports `360p`, `720p`, `1080p`, `4K`. |

### `ref` Items

Each item passes `type` and `url`, plus `role` for strict first and last frames. Every URL must be a publicly accessible HTTPS address readable throughout task execution without login, cookies, or custom request headers.

| Field | Required | Description |
|---|---:|---|
| `type` | Yes | `image` or `video`. |
| `url` | Yes | Asset URL. |
| `role` | No | Omit for general reference assets; pass `first_frame` for a strict first frame or `last_frame` for a strict last frame (`type=image` only). |

The contents of `ref` determine the generation mode:

| `ref` Contents | Generation Mode | Max Count |
|---|---|---|
| Omit `ref` | Text-to-video | — |
| General images and/or videos only | Multi-reference video | Up to 6 images and 3 videos, individually or combined |
| One `role=first_frame` image | Strict first-frame video | 1 image |
| One `first_frame` and one `last_frame` image | Strict first-and-last-frame video | 2 images |

- General images and videos are numbered separately starting from 1 according to their order in `ref`: the first image is `@图片1` and the first video is `@视频1` (note: `@图片1` and `@视频1` are literal Chinese model syntax tags—keep them unchanged in prompts).
- `last_frame` must be submitted together with `first_frame`; first and last frames cannot be mixed with general reference images or videos.
- Reference audio is not currently supported.

## Examples

### Text-to-Video (Defaults to 5s, 9:16, 720p)

```bash
curl --request POST 'https://vip.brioi.com/v1/videos' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gemini-omni-1.2-flash",
    "prompt": "Rainy neon street at night, camera pushing forward slowly, lights reflected on wet pavement"
  }'
```

### Multi-Reference: 2 Images + 1 Video, Portrait 10s

```json
{
  "model": "gemini-omni-1.2-flash",
  "prompt": "The two people in @图片1 and @图片2 walk side by side down a neon-lit street, following the motion and camera pacing of @视频1, then wave together at the end",
  "duration": 10,
  "aspect_ratio": "9:16",
  "ref": [
    { "type": "image", "url": "https://example.com/person-1.png" },
    { "type": "image", "url": "https://example.com/person-2.png" },
    { "type": "video", "url": "https://example.com/motion-1.mp4" }
  ]
}
```

### Strict First-and-Last Frame

```json
{
  "model": "gemini-omni-1.2-flash",
  "prompt": "Natural transition of a street from early morning to night with a stationary camera",
  "duration": 5,
  "ref": [
    { "type": "image", "role": "first_frame", "url": "https://example.com/morning.png" },
    { "type": "image", "role": "last_frame", "url": "https://example.com/night.png" }
  ]
}
```

Keep only `first_frame` for a strict first-frame request.

## Billing

Billed per generation at a flat rate regardless of duration or resolution.

## Asynchronous Responses

Save `id` from the creation response and poll the same task via `GET /v1/videos/{task_id}`. Generation typically takes 1–5 minutes; poll every 10–30 seconds. Public statuses:

| Status | Action |
|---|---|
| `queued` | Queued; continue polling. |
| `in_progress` | Generating; continue polling. |
| `completed` | Read `metadata.url`. |
| `failed` | Read `error` and stop polling. |

Treat any status value not listed above as incomplete and continue polling. A deliverable video is obtained only when `status=completed` and `metadata.url` is non-empty and downloadable (`result_url` holds the same value as a fallback). Result URLs expire—download or persist the video immediately upon completion. If a creation request times out or returns a transient `5xx`, verify whether the task was already created before submitting a second task.

## Unsupported Parameters

The following are not currently exposed: aspect ratios other than `9:16` and `16:9`, durations under 3 seconds or over 15 seconds, reference audio, and Chat Completions parameters (`messages`, `temperature`, `top_p`, `stream`).

## Error Handling

| HTTP Status | Common Cause |
|---:|---|
| `400` | Invalid parameters; querying a non-existent task also returns `400` with `code` set to `task_not_exist` |
| `401` | Missing or invalid API key |
| `403` | Insufficient balance/quota, or no permission for the requested model |
| `429` | Rate limit exceeded |
| `503` | Service temporarily unavailable |
| `500` / `502` | Transient service error |

