Gemini Omni Flash Preview
Use gemini-omni-flash-preview through the UniAll.ai Gemini Interactions API to generate videos from text, one image, multiple images, one video, or a supported combination of images and video.
Base URL
All examples on this page use:
https:
If the UniAll.ai console provides a dedicated API address for your account, use the address shown in the console.
Quick Start
Generate a video:
POST /v1beta/interactions
Authenticate with:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Minimal text-to-video request:
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": "A cinematic robot walking through rain at night.",
"response_format": {
"type": "video",
"aspect_ratio": "16:9"
},
"generation_config": {
"video_config": {
"task": "text_to_video",
"resolution": "720p",
"duration_seconds": 4
}
}
}'
Supported Capabilities
| Capability | task | Input |
|---|---|---|
| Text to video | text_to_video | A prompt with no image or video |
| Image to video | image_to_video | A prompt and exactly one image |
| Reference generation | reference_to_video | A prompt plus images, one video, or a supported image-and-video combination |
The following inputs and operations are not currently supported:
- audio reference assets;
- first-frame and last-frame interpolation;
- continuation or editing based on an earlier
interaction_id; - video extension;
- Base64,
inline_data, or multipart file uploads; - custom resolution, width, or height.
Request Parameters
Top-Level Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be gemini-omni-flash-preview. |
input | string / object / array | Yes | Prompt and optional public image or video URLs. |
response_format | object | Yes | Output type and aspect ratio. |
generation_config | object | Recommended | Video generation settings. Pass it explicitly for predictable results. |
timeout_seconds | integer | No | Maximum time the server waits for a result. Default: 300. This is not the video duration. |
POST /v1beta/interactions waits for generation to finish before returning. Set the client-side HTTP timeout higher than timeout_seconds; use 600 seconds or more for reference-video requests.
response_format
| Parameter | Type | Required | Supported values | Default |
|---|---|---|---|---|
type | string | Yes | video | None |
aspect_ratio | string | No | 16:9, 9:16 | 16:9 |
16:9creates a landscape video.9:16creates a portrait video.
generation_config.video_config
| Parameter | Type | Required | Supported values | Description |
|---|---|---|---|---|
task | string | Recommended | text_to_video, image_to_video, reference_to_video | Pass explicitly so the requested input mode is unambiguous. |
resolution | string | No | 720p | The only supported resolution. Default: 720p. |
duration_seconds | integer | No | 4, 6, 8, 10 | Requested duration. Default: 4. |
When a request includes a video reference, the model may choose the final duration based on that reference. duration_seconds does not guarantee the exact output duration in that case. Inspect the returned video file when exact duration matters.
Task And Asset Combinations
task | Images | Videos | Allowed input |
|---|---|---|---|
text_to_video | 0 | 0 | Prompt only |
image_to_video | 1 | 0 | Exactly one image |
reference_to_video | 0-7 | 0-1 | Images, multiple images, one video, or images plus one video; at least one asset is required |
If task is omitted, the API infers it from the supplied assets:
- no image or video:
text_to_video; - exactly one image:
image_to_video; - multiple images or any video:
reference_to_video.
For stable production behavior, always pass task explicitly.
Input Formats
Text
For text-to-video generation, input can be a string:
{
"input": "A paper boat sailing through a neon city during heavy rain."
}
Content Array
The array format is the clearest option and is recommended for requests with reference assets:
{
"input": [
{
"type": "text",
"text": "Animate the subject with a slow cinematic camera push-in."
},
{
"type": "image",
"url": "https://example.com/subject.webp"
},
{
"type": "video",
"url": "https://example.com/motion-reference.mp4"
}
]
}
type | Field | Description |
|---|---|---|
text | text | Text prompt |
image | url | Publicly accessible image URL |
video | url | Publicly accessible video URL |
Object Shorthand
You can also provide an object with URL fields:
{
"input": {
"text": "Use the references to create one cohesive cinematic shot.",
"image_urls": [
"https://example.com/character.png",
"https://example.com/environment.jpg"
],
"video_urls": [
"https://example.com/camera-motion.mp4"
]
}
}
| Field | Type | Description |
|---|---|---|
text | string | Prompt |
image_url | string | One image URL |
image_urls | string[] | Multiple image URLs |
video_url | string | One video URL |
video_urls | string[] | Video URL array; currently limited to one video |
Prompt And Asset Limits
Prompt
- Every task should include a non-empty prompt.
- The maximum prompt length is
20000characters. - Multiple text items are combined in order.
- Describe the subject, action, camera movement, scene, lighting, pacing, and style.
- For reference generation, explain the intended role of each asset.
Example:
Use the first image for the character appearance, the second image for the
environment, and the video for camera motion. Create one continuous cinematic
shot with natural movement and consistent lighting.
Images
- Supported formats: JPEG, PNG, and WEBP.
- Maximum size:
20 MBper image. - Each URL must be directly reachable from the public internet without cookies, login state, or custom headers.
- Up to seven images are allowed when no video is supplied.
image_to_videorequires exactly one image.
Video
- A request can include at most one reference video.
- Maximum file size:
100 MB. - Maximum input duration:
30seconds. - MP4 is recommended for broad compatibility.
- The model uses at most the first 10 seconds of the reference.
- The URL must be directly reachable from the public internet.
Reference Asset Quota
Each image uses one asset unit and each video uses two. The total must not exceed seven:
image count + video count * 2 <= 7
| Images | Videos | Allowed |
|---|---|---|
| 7 | 0 | Yes |
| 5 | 1 | Yes |
| 6 | 1 | No |
| 0 | 1 | Yes |
| 0 | 2 | No |
Request Examples
The following examples pass the task and video settings explicitly.
Landscape Text To Video
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": "A wide cinematic shot of an astronaut walking through a field of glowing flowers at dusk, gentle wind, slow dolly-in camera movement.",
"response_format": {
"type": "video",
"aspect_ratio": "16:9"
},
"generation_config": {
"video_config": {
"task": "text_to_video",
"resolution": "720p",
"duration_seconds": 6
}
},
"timeout_seconds": 600
}'
Portrait Text To Video
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": [
{
"type": "text",
"text": "Vertical fashion film, a model walking through a minimalist white gallery, soft shadows, smooth handheld camera, premium editorial style."
}
],
"response_format": {
"type": "video",
"aspect_ratio": "9:16"
},
"generation_config": {
"video_config": {
"task": "text_to_video",
"resolution": "720p",
"duration_seconds": 10
}
},
"timeout_seconds": 600
}'
Image To Video
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": [
{
"type": "image",
"url": "https://example.com/portrait.webp"
},
{
"type": "text",
"text": "Keep the character appearance consistent. Add subtle breathing and blinking, hair moving gently in the wind, and a slow camera push-in."
}
],
"response_format": {
"type": "video",
"aspect_ratio": "9:16"
},
"generation_config": {
"video_config": {
"task": "image_to_video",
"resolution": "720p",
"duration_seconds": 4
}
},
"timeout_seconds": 600
}'
Multiple Image References
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": {
"text": "Use the first image for the character, the second for clothing, and the third for the environment. Create one continuous shot of the character entering the cafe and looking toward the camera.",
"image_urls": [
"https://example.com/character.png",
"https://example.com/outfit.jpg",
"https://example.com/cafe.webp"
]
},
"response_format": {
"type": "video",
"aspect_ratio": "16:9"
},
"generation_config": {
"video_config": {
"task": "reference_to_video",
"resolution": "720p",
"duration_seconds": 8
}
},
"timeout_seconds": 600
}'
One Video Reference
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": [
{
"type": "video",
"url": "https://example.com/dance-motion.mp4"
},
{
"type": "text",
"text": "Create a cinematic dancer performance using the reference for body movement and rhythm. Use dramatic blue stage lighting and a slowly orbiting camera."
}
],
"response_format": {
"type": "video",
"aspect_ratio": "16:9"
},
"generation_config": {
"video_config": {
"task": "reference_to_video",
"resolution": "720p",
"duration_seconds": 8
}
},
"timeout_seconds": 600
}'
Mixed Image And Video References
curl -X POST "https://api.uniall.ai/v1beta/interactions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-omni-flash-preview",
"input": {
"text": "Use the character image for appearance, the city image for the environment, and the video for camera motion. Keep the character identity and clothing consistent throughout the shot.",
"image_urls": [
"https://example.com/character.png",
"https://example.com/night-city.jpg"
],
"video_urls": [
"https://example.com/camera-reference.mp4"
]
},
"response_format": {
"type": "video",
"aspect_ratio": "16:9"
},
"generation_config": {
"video_config": {
"task": "reference_to_video",
"resolution": "720p",
"duration_seconds": 10
}
},
"timeout_seconds": 600
}'
Python
import requests
api_url = "https://api.uniall.ai/v1beta/interactions"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"model": "gemini-omni-flash-preview",
"input": [
{
"type": "image",
"url": "https://example.com/product.png",
},
{
"type": "text",
"text": (
"Create a premium product film with a slow 360-degree camera "
"move, soft studio reflections, and a dark background."
),
},
],
"response_format": {
"type": "video",
"aspect_ratio": "16:9",
},
"generation_config": {
"video_config": {
"task": "image_to_video",
"resolution": "720p",
"duration_seconds": 6,
}
},
"timeout_seconds": 600,
}
response = requests.post(
api_url,
headers=headers,
json=payload,
timeout=660,
)
response.raise_for_status()
result = response.json()
print(result["interaction_id"])
print(result["response"]["video"]["uri"])
JavaScript
const response = await fetch("https://api.uniall.ai/v1beta/interactions", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gemini-omni-flash-preview",
input: "A tiny red train crossing a snowy mountain bridge at sunrise.",
response_format: {
type: "video",
aspect_ratio: "16:9",
},
generation_config: {
video_config: {
task: "text_to_video",
resolution: "720p",
duration_seconds: 4,
},
},
timeout_seconds: 600,
}),
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.error?.message ?? "Video generation failed");
}
console.log(result.interaction_id);
console.log(result.response.video.uri);
Success Response
A successful request returns a Gemini Interactions-style response:
{
"interaction_id": "task_xxx",
"model": "gemini-omni-flash-preview",
"response": {
"video": {
"uri": "https://api.uniall.ai/media/generated-video.mp4"
}
}
}
| Field | Description |
|---|---|
interaction_id | Unique generation ID that can be used to query the result |
model | Public model name used for the request |
response.video.uri | Generated video URL |
Download and store the generated result promptly. Do not assume that the video URL remains available indefinitely.
Task Status And Result
POST /v1beta/interactions normally waits for the interaction result. When a follow-up query is needed, save interaction_id and call GET /v1/videos/generations/{interaction_id} instead of the default task route. See Video Generation Overview for the shared terminal statuses, error contract, and result fields.
Errors And Troubleshooting
Errors use a consistent structure:
{
"error": {
"code": 400,
"message": "`duration_seconds` must be one of 4, 6, 8, or 10",
"status": "INVALID_ARGUMENT"
}
}
| HTTP status | error.status | Meaning |
|---|---|---|
400 | INVALID_ARGUMENT | Invalid parameter, asset count, or task mode |
400 | FAILED_PRECONDITION | Request did not pass safety checks |
401 | UNAUTHENTICATED | Missing or invalid API key |
404 | NOT_FOUND | Model or query ID does not exist |
429 | RESOURCE_EXHAUSTED | Request rate is too high |
503 | UNAVAILABLE | Service is temporarily unavailable |
504 | DEADLINE_EXCEEDED | No result was returned within timeout_seconds |
Billing Notes
Pricing and billing rules can change. Use the current model price and usage records shown in the UniAll.ai console as the source of truth. Keep the interaction_id when reconciling a request or contacting support.
Recommendations
- Pass
task,resolution,duration_seconds, andaspect_ratioexplicitly. - Use HTTPS asset URLs and verify that each URL downloads without authentication.
- Set the client HTTP timeout 30-60 seconds higher than
timeout_seconds. - Treat the output file as the source of truth for the duration of video-reference results.
- Explain the role of every asset in the prompt for reference-generation requests.
- Retry
429and503responses with exponential backoff. - Never expose an API key in logs, frontend code, or a public repository.