# Gemini Omni 1.2 Flash

> Gemini Omni 1.2 Flash API on PoYo. Generate 3–15 second videos at 360p to 4K from text, first and last frames, or up to 10 reference images and 3 reference videos, and edit existing videos up to 15 seconds. From 5.46 credits ($0.0273) per second.

## Overview

- Submit: `https://api.poyo.ai/api/generate/submit`
- Status: `https://api.poyo.ai/api/generate/status/{task_id}`
- Page: https://poyo.ai/models/gemini-omni-1-2-flash
- Model page ID: `gemini-omni-1-2-flash`
- API model ID: `gemini-omni-1.2-flash`
- Category: Video
- Auth: `Authorization: Bearer $POYO_API_KEY`
- Create a key at https://poyo.ai/dashboard/api-key

This model uses PoYo's unified async API. POST the JSON body below, then poll status with the returned `task_id` or receive a webhook on `callback_url`. Failed tasks are not charged.

## Pricing

- 360p: 5.46 credits ($0.027) per second
- 720p: 16.38 credits ($0.082) per second
- 1080p: 24.58 credits ($0.123) per second
- 4K: 49.14 credits ($0.246) per second

For more details, see https://poyo.ai/models/gemini-omni-1-2-flash.

## API Information

The request envelope is always `{ model, input, callback_url? }`. Input fields below are nested under `input`.

### Request envelope

- `model` (`ModelEnum`, required):
  Gemini Omni 1.2 Flash model identifier
  - Options: `"gemini-omni-1.2-flash"`
- `callback_url` (`string`, optional):
  Webhook callback URL for result notifications
  - Examples: "https://your-domain.com/callback"

### Input Schema

The API accepts the following `input` parameters:

- `prompt` (`string`, required):
  Text prompt describing the video, or the edit instruction when `video_url` is provided. Maximum length is 20,000 characters.
  - Length: 1 to 20000 characters
  - Examples: "A cinematic night city with neon reflections and a slow camera push-in"
- `image_urls` (`list`, optional):
  Optional first frame and last frame, in order. One or two publicly accessible HTTP or HTTPS image URLs. Cannot be combined with `reference_image_urls` or `reference_video_urls`.
  - Array of string
  - Length: 1 to 2
  - Examples: `["https://example.com/first-frame.webp","https://example.com/last-frame.webp"]`
- `reference_image_urls` (`list`, optional):
  Optional reference images. Up to 10 publicly accessible HTTP or HTTPS image URLs. Can be combined with `reference_video_urls`.
  - Array of string
  - Length: 1 to 10
  - Examples: `["https://example.com/reference-image.webp"]`
- `reference_video_urls` (`list`, optional):
  Optional reference videos. Up to 3 publicly accessible HTTP or HTTPS video URLs, each at most 15 seconds long.
  - Array of string
  - Length: 1 to 3
  - Examples: `["https://example.com/reference-video.mp4"]`
- `video_url` (`string`, optional):
  Optional source video to edit. A publicly accessible HTTP or HTTPS video URL, at most 15 seconds long. When provided, only `prompt` and `resolution` can be sent with it, and the output length follows the source video.
  - Examples: "https://example.com/source.mp4"
- `resolution` (`ResolutionEnum`, optional):
  The resolution of the generated video. Available values are 360p, 720p, 1080p, and 4k.
  - Default: `"720p"`
  - Options: `"360p"`, `"720p"`, `"1080p"`, `"4k"`
  - Examples: "720p"
- `duration` (`integer`, optional):
  Output duration in seconds, from 3 to 15. Default is 8. At most 10 when a last frame is provided. Not accepted for video editing.
  - Default: `8`
  - Range: `3` to `15`
  - Examples: `8`
- `aspect_ratio` (`AspectRatioEnum`, optional):
  The aspect ratio of the generated video. 16:9 is landscape, and 9:16 is portrait. Not accepted for video editing.
  - Default: `"16:9"`
  - Options: `"16:9"`, `"9:16"`
  - Examples: "16:9"

Required Parameters Example:

```json
{
  "model": "gemini-omni-1.2-flash",
  "input": {
    "prompt": "A cinematic night city with neon reflections and a slow camera push-in",
    "resolution": "720p",
    "duration": 8,
    "aspect_ratio": "16:9"
  }
}
```

Full Example:

```json
{
  "model": "gemini-omni-1.2-flash",
  "input": {
    "prompt": "A cinematic night city with neon reflections and a slow camera push-in",
    "resolution": "720p",
    "duration": 8,
    "aspect_ratio": "16:9",
    "image_urls": [
      "https://example.com/first-frame.webp",
      "https://example.com/last-frame.webp"
    ],
    "reference_image_urls": [
      "https://example.com/reference-image.webp"
    ],
    "reference_video_urls": [
      "https://example.com/reference-video.mp4"
    ],
    "video_url": "https://example.com/source.mp4"
  }
}
```

First and last frame video:

```json
{
  "model": "gemini-omni-1.2-flash",
  "input": {
    "prompt": "Create a smooth cinematic transition between the two frames",
    "image_urls": [
      "https://example.com/first-frame.webp",
      "https://example.com/last-frame.webp"
    ],
    "resolution": "1080p",
    "duration": 8,
    "aspect_ratio": "16:9"
  }
}
```

Reference image video:

```json
{
  "model": "gemini-omni-1.2-flash",
  "input": {
    "prompt": "Use the references to create a polished product campaign video",
    "reference_image_urls": [
      "https://example.com/product.webp",
      "https://example.com/environment.webp"
    ],
    "resolution": "720p",
    "duration": 10,
    "aspect_ratio": "9:16"
  }
}
```

### Output Schema

Submit returns a `task_id`. Poll `GET /api/generate/status/{task_id}` until `status` is `finished` or `failed`. Completed media is in `data.files`.

Response fields:

- `code` (`CodeEnum`, required):
  Business status code. `200` means success; any other value means the request failed. Always check this field: some validation errors return HTTP 200 with `code: 400` in the body.
  
  - `200`: Success
  - `400`: Invalid request parameters
  - `401`: Missing or invalid API key
  - `402`: Insufficient credits
  - `403`: Permission denied
  - `404`: Resource not found
  - `408`: Request timeout
  - `429`: Rate limit exceeded
  - `500`: Internal server error
  - `502`: Upstream service error
  - `503`: Service unavailable
  
  See [Error Codes](/api-manual/error-codes) for details.
  - Options: `200`, `400`, `401`, `402`, `403`, `404`, `408`, `429`, `500`, `502`, `503`
  - Examples: `200`
- `message` (`string`, optional):
  - Examples: "success"
- `data` (`object`, required):

Example Response:

```json
{
  "code": 200,
  "data": {
    "task_id": "task_example",
    "status": "finished",
    "files": [
      {
        "file_url": "https://storage.poyo.ai/models/gemini-omni-1-2-flash/examples/balloon_first_last_frames-a729878aa2716a74.mp4",
        "file_type": "video"
      }
    ]
  }
}
```

## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://api.poyo.ai/api/generate/submit \
  --header "Authorization: Bearer $POYO_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"model":"gemini-omni-1.2-flash","input":{"prompt":"A cinematic night city with neon reflections and a slow camera push-in","resolution":"720p","duration":8,"aspect_ratio":"16:9"}}'
```

### Python

```python
import json
import os
import time
import requests

API = "https://api.poyo.ai"
headers = {
    "Authorization": f"Bearer {os.environ['POYO_API_KEY']}",
    "Content-Type": "application/json",
}
payload = json.loads("{\n  \"model\": \"gemini-omni-1.2-flash\",\n  \"input\": {\n    \"prompt\": \"A cinematic night city with neon reflections and a slow camera push-in\",\n    \"resolution\": \"720p\",\n    \"duration\": 8,\n    \"aspect_ratio\": \"16:9\"\n  }\n}")

submit = requests.post(f"{API}/api/generate/submit", headers=headers, json=payload)
submit.raise_for_status()
task_id = submit.json()["data"]["task_id"]

while True:
    status = requests.get(f"{API}/api/generate/status/{task_id}", headers=headers)
    status.raise_for_status()
    data = status.json()["data"]
    if data["status"] in ("finished", "failed"):
        print(data)
        break
    time.sleep(2)
```

### JavaScript

```javascript
const headers = {
  Authorization: `Bearer ${process.env.POYO_API_KEY}`,
  "Content-Type": "application/json",
};

const submit = await fetch("https://api.poyo.ai/api/generate/submit", {
  method: "POST",
  headers,
  body: JSON.stringify({
  "model": "gemini-omni-1.2-flash",
  "input": {
    "prompt": "A cinematic night city with neon reflections and a slow camera push-in",
    "resolution": "720p",
    "duration": 8,
    "aspect_ratio": "16:9"
  }
}),
});

const submitted = await submit.json();
const taskId = submitted.data.task_id;

while (true) {
  const statusResponse = await fetch(`https://api.poyo.ai/api/generate/status/${taskId}`, { headers });
  const status = await statusResponse.json();
  if (["finished", "failed"].includes(status.data.status)) {
    console.log(status.data);
    break;
  }
  await new Promise((resolve) => setTimeout(resolve, 2000));
}
```

## Additional Resources

### Documentation

- [Model Playground](https://poyo.ai/models/gemini-omni-1-2-flash)
- [API Documentation](https://docs.poyo.ai/api-manual/video-series/gemini-omni-1.2-flash)
- [API Documentation (Markdown)](https://docs.poyo.ai/api-manual/video-series/gemini-omni-1.2-flash.md)
- [Task status](https://docs.poyo.ai/api-manual/task-management/query-task-status)
- [Webhooks](https://docs.poyo.ai/api-manual/task-management/webhooks)

### Other agent-readable surfaces

- [Platform overview](https://poyo.ai/llms.txt)
- [Documentation index](https://docs.poyo.ai/llms.txt)
- [Full documentation text](https://docs.poyo.ai/llms-full.txt)
- Any other model: `https://poyo.ai/models/<model-id>/llms.txt`
