Skip to content
,

Gemini Omni API Tutorial: Generate Video with Python (gemini-omni-1.2-flash)

12โ€“18 minutes
Woman in a lab coat in a co-working space with plants holding a tablet with a GEMINI OMNI card, hook $0.07 per sec AI video API

Google’s video model for API-key users is now Gemini Omni Flash. The Veo previews in the Gemini API were shut down in October 2026, so any new video project with a plain API key starts here.

This tutorial shows you how to call gemini-omni-1.2-flash from Python with the google-genai SDK. You get text to video, image to video, downloads, editing, prices per second and real fixes for common errors.

TLDR

  • Model id: gemini-omni-1.2-flash (GA on 5 Nov 2026). Calls to gemini-omni-1.1-flash route to 1.2 from 3 Dec 2026.
  • How you call it: client.interactions.create() in google-genai 3.7.0 (Python 3.11+), not generate_videos().
  • Clips: 3 to 15 seconds with native audio, 16:9 or 9:16, 360p to 4K.
  • Price: about $0.07 per second at 720p, so a 15-second clip is about $1.04. No free tier.
  • Limits: Tier 1 gets 8 requests per minute and 40 per day.

What Gemini Omni Flash Is and When to Use It

Gemini Omni Flash is a multimodal model that makes video with synced sound. It takes text, images and short videos as input. It can also edit and extend a clip over several turns, like a chat.

Google’s video docs now point Gemini API users to two models. Omni Flash is for clip-based video. Genie 4 is for real-time interactive worlds. The page also says plainly that the Veo 3.1 Preview in the Gemini API has been shut down.

  • Use Omni when: you have a Gemini API key, want clips up to 15 seconds, or want to edit a clip by chatting.
  • Use Veo when: you already run on Google Cloud and need Veo’s look, 4 clips per call or negative prompts. My Veo API tutorial covers that route.
  • Use neither when: you just want a free clip by hand. Try the Google Vids free AI video guide instead.
Google AI Studio docs page Generate and edit videos with Gemini Omni Flash showing model id gemini-omni-1.2-flash and video with native audio up to 15 seconds
Official Gemini Omni Flash docs naming gemini-omni-1.2-flash (checked 3 Dec 2026).

Current Gemini Omni Model IDs (Checked 3 December 2026)

The Omni model page lists three ids. Only one is worth using in new code.

Model id Status Clip length Notes
gemini-omni-1.2-flash Stable (GA 5 Nov 2026) 3 to 15 s Current model. Upscaled 1080p and 4K
gemini-omni-1.1-flash Stable, routed 3 to 10 s From 3 Dec 2026 requests route to 1.2 and bill at 1.2 rates
gemini-omni-flash-preview Shut down n/a Change it to the 1.2 id

On Gemini Enterprise Agent Platform (the new name for Vertex AI), the same gemini-omni-1.2-flash id is GA with a retirement date of 5 November 2027 or later. The older gemini-omni-1.1-flash-preview id there is marked deprecated.

Note: Google’s 5 November blog post says 1.2 is 30% cheaper than 1.1 and adds 15-second clips, better lip-sync and fewer jump cuts. I found no newer Omni release in the last few weeks of news.

Prerequisites

  • A paid Gemini API project: Omni has no free tier. Billing must be on in Google AI Studio.
  • An API key: create one in Google AI Studio and keep it out of your code.
  • Python 3.11 or newer: google-genai 3.7.0 (released 2 Dec 2026) needs 3.11+.
  • Some disk space: Google says clips above 720p can pass 4 MB, so plan to save files, not print them.

If you are new to the SDK, start with my Gemini API Python tutorial. It covers keys, the client and the Interactions API basics.

How to Set Up the Gemini Omni API in 5 Steps

  1. Turn on billing. In Google AI Studio, open your project and set up a paid tier. Free projects get “Not supported” for Omni in the rate limit table.
  2. Create a key. Use Get API key in AI Studio, then copy the key once.
  3. Store the key. Run export GEMINI_API_KEY="your-key" on macOS or Linux, or setx GEMINI_API_KEY "your-key" on Windows. The SDK reads it for you.
  4. Install the SDK. Run pip install -U google-genai. Check it with pip show google-genai. I wrote this guide against version 3.7.0.
  5. Run a test. Paste Example 1 into omni_test.py and run it. A file called lantern.mp4 should appear.

Example 1: Text to Video in Python

This is the smallest useful script. It asks for an 8-second portrait clip at 720p and saves it. The SDK gives you the video as base64 in interaction.output_video.data.

import base64
from google import genai

client = genai.Client()  # reads GEMINI_API_KEY

interaction = client.interactions.create(
    model="gemini-omni-1.2-flash",
    input=(
        "Single continuous shot. A paper lantern floats up from a night market, "
        "warm light, slow camera tilt up. Sound: soft crowd chatter, no dialogue."
    ),
    response_format={
        "type": "video",
        "aspect_ratio": "9:16",   # "16:9" is the default
        "resolution": "720p",     # 360p, 720p, 1080p or 4k
        "duration": "8s",         # whole seconds from "3s" to "15s"
    },
)

video = interaction.output_video
if video is None:
    print("No video came back. Status:", interaction.status)
else:
    with open("lantern.mp4", "wb") as f:
        f.write(base64.b64decode(video.data))
    print("Saved lantern.mp4")

A few things that trip people up:

  • Default length: if you leave out duration, Omni makes a 10-second clip. That costs more than you might expect.
  • Duration wins: the value in response_format beats any length you write in the prompt.
  • Several shots: Omni likes to cut between shots. Say “single continuous shot” or “no scene cuts” if you want one take.

Tip: Describe the sound. Omni adds audio by default, so write “calm background music” or “no dialogue”. You can also time events, for example “[0-5s] she walks in, [5-8s] she waves”.

Example 2: Image to Video (and First and Last Frame)

Send an image as part of the input list. The model decides how to use it from your prompt, so be clear about the motion you want.

import base64
from pathlib import Path
from google import genai

client = genai.Client()

def b64(path):
    return base64.b64encode(Path(path).read_bytes()).decode()

interaction = client.interactions.create(
    model="gemini-omni-1.2-flash",
    input=[
        {"type": "image", "data": b64("sneaker.jpg"), "mime_type": "image/jpeg"},
        {"type": "text", "text": (
            "Use this photo as the first frame. The camera slowly orbits the sneaker "
            "on a studio turntable. Keep the product exactly the same. No dialogue."
        )},
    ],
    response_format={"type": "video", "resolution": "720p", "duration": "6s"},
)

with open("sneaker.mp4", "wb") as f:
    f.write(base64.b64decode(interaction.output_video.data))

First and last frame

Pass two images and describe the change between them. Omni animates from the first to the second. This mode supports 3 to 10 seconds only. Asking for more returns an invalid argument error.

input=[
    {"type": "image", "data": b64("day.jpg"), "mime_type": "image/jpeg"},
    {"type": "image", "data": b64("night.jpg"), "mime_type": "image/jpeg"},
    {"type": "text", "text": "A smooth time-lapse from the first image to the second."},
]

Characters and products (reference images)

You can send up to 6 reference images, with up to 3 images per character for up to 2 characters. Say in plain words what each image is for.

If the model picks the wrong mode, add generation_config={"video_config": {"task": "image_to_video"}}. Allowed tasks are text_to_video, image_to_video, reference_to_video, edit and extend. Google says to try plain prompting first, because task adds strict rules.

Example 3: Big Files, Polling and Downloading

Inline base64 is fine for short 720p clips. For files over 4 MB (most 1080p and 4K clips), set "delivery": "uri". You then get a Google-hosted file that you poll until it is ACTIVE.

import time
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-omni-1.2-flash",
    input="Aerial shot over a misty pine forest at sunrise, birdsong, no dialogue.",
    response_format={
        "type": "video",
        "resolution": "1080p",
        "duration": "12s",
        "delivery": "uri",      # needs store=True, which is the default
    },
)

uri = interaction.output_video.uri
file_name = "files/" + uri.split("/")[-1]

while True:
    info = client.files.get(name=file_name)
    if info.state.name == "ACTIVE":
        break
    if info.state.name == "FAILED":
        raise RuntimeError("Video processing failed")
    print("Waiting for the file...")
    time.sleep(5)

client.files.download(file=uri, destination="forest.mp4")
print("Saved forest.mp4")

Polling the interaction itself

The Interactions API also has background mode. You pass background=True, get an id at once, then check client.interactions.get(id=...) until the status leaves in_progress. The status values are completed, failed, cancelled and requires_action.

job = client.interactions.create(
    model="gemini-omni-1.2-flash",
    input="A red kite flying over a beach, single continuous shot.",
    background=True,
)
while job.status == "in_progress":
    time.sleep(5)
    job = client.interactions.get(id=job.id)
print(job.status, job.errors if job.status == "failed" else "")

Warning: The background docs list Gemini 4 text models as examples, not Omni by name. The Omni page itself suggests background=False for the fastest results. Use background mode only if your web server would time out, and handle a 400 by falling back to the normal call. Also, background=True with store=False always returns 400.

Example 4: Edit and Extend a Clip by Chatting

This is what makes Omni different from Veo. Each call can build on the last one through previous_interaction_id. You do not need to upload the video again.

import base64
from google import genai

client = genai.Client()

first = client.interactions.create(
    model="gemini-omni-1.2-flash",
    input="A barista pours latte art in a sunny cafe, single continuous shot.",
    response_format={"type": "video", "duration": "8s"},
)

edit = client.interactions.create(
    model="gemini-omni-1.2-flash",
    previous_interaction_id=first.id,
    input="Change the cup to a blue mug. Keep everything else the same.",
)

more = client.interactions.create(
    model="gemini-omni-1.2-flash",
    previous_interaction_id=edit.id,
    input="Extend this video: the barista slides the mug to the customer.",
    response_format={"type": "video", "duration": "6s"},
)

for name, step in [("edit.mp4", edit), ("extended.mp4", more)]:
    with open(name, "wb") as f:
        f.write(base64.b64decode(step.output_video.data))
  • Editing: input videos must be 15 seconds or less. Short prompts work best. End with “Keep everything else the same”.
  • Extending: each turn adds 3 to 10 seconds, up to 30 seconds in total. The model looks at the last 10 seconds only.
  • Your own videos: upload with client.files.upload(file="clip.mp4") and pass {"type": "video", "uri": file.uri}. This is not available in the EEA, Switzerland or the UK.
  • Billing: every turn makes a new video, so every turn is billed.

curl Example (REST)

The REST endpoint is POST /v1beta/interactions. Note that output_video is an SDK shortcut. In raw JSON the video sits in the steps array, inside the model_output step.

curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-omni-1.2-flash",
    "input": "A drone shot of a mountain lake at sunrise, single continuous shot.",
    "response_format": {"type": "video", "resolution": "720p", "duration": "8s"}
  }' \
| jq -r '.steps[] | select(.type=="model_output") | .content[] | select(.type=="video") | .data' \
| base64 -d > lake.mp4

Gemini Omni Video Options

These are the parameter names from the Omni docs and the Interactions API, as checked on 3 December 2026.

Parameter Values Default and notes
response_format.aspect_ratio “16:9”, “9:16” 16:9
response_format.resolution “360p”, “720p”, “1080p”, “4k” 720p. 1080p and 4K are upscaled
response_format.duration “3s” to “15s” 10s. Max 10s for first/last frame and per extension turn
response_format.delivery “uri” Leave out for inline base64. Use uri above 4 MB
generation_config.video_config.task text_to_video, image_to_video, reference_to_video, edit, extend Inferred from the prompt. Fallback only
previous_interaction_id An interaction id For edits and extensions
store True / False True. False is faster but you cannot edit later
background, stream True / False False is the fast path for Omni

Some settings are not supported: system instructions, temperature, top_p, stop sequences, negative prompts and audio inputs. Put things to avoid in the prompt instead, such as “no text on screen”.

Gemini Omni API Pricing per Second (with a Worked Example)

Omni bills video as output tokens. A second of 720p video is 5,792 tokens, and video output costs $12.00 per million tokens. That works out at about $0.07 per second.

Resolution Tokens per second Price per second 8 s clip 15 s clip
360p 1,931 $0.023 $0.19 $0.35
720p 5,792 $0.07 $0.56 $1.04
1080p (upscaled) 8,688 $0.104 $0.83 $1.56
4K (upscaled) 17,376 $0.209 $1.67 $3.13

Input costs $1.50 per million tokens for text, images and video. Text output (thinking) costs $9.00 per million. Audio is bundled into the video rate. The old 1.1 model was $17.50 per million, about $0.10 per second.

Gemini Developer API pricing table for Gemini Omni 1.2 Flash showing $1.50 input, $12.00 video output per 1M tokens and about $0.07 per second at 720p
Official Gemini API pricing page, Gemini Omni 1.2 Flash section (checked 3 Dec 2026).

Worked example: a 30-second product ad

Say you want a 30-second ad made from two 15-second clips at 1080p. You also want three cheap drafts of each shot first.

  1. Drafts at 360p: 6 clips x 15 s x 1,931 tokens = 173,790 tokens. At $12 per million that is $2.09.
  2. Finals at 1080p: 2 clips x 15 s x 8,688 tokens = 260,640 tokens. That is $3.13.
  3. Inputs: two product photos and short prompts cost well under a cent. Agent Platform counts 1,120 tokens per input image.
  4. Total: about $5.21 for the full ad, drafts included.

The same 30 seconds on Veo 3.1 with audio at 1080p would be 30 x $0.40 = $12.00 before any retakes. For the text model prices, see Gemini API pricing and free tier.

Gemini Omni Limits and Rate Limits

Limit Value
Output clip length 3 to 15 s (3 to 10 s for first/last frame)
Extended video total Up to 30 s (3 to 10 s per turn)
Input video for editing 15 s or less
Reference images Up to 6
Reference videos Up to 3 for 3-10 s clips, 1 for 11-15 s clips (each up to 3 s)
Frame rate 24 fps
Input token limit 131,072 tokens
Inline delivery Use URI delivery above 4 MB
Rate limits (RPM / RPD) Free: not supported. Tier 1: 8 / 40. Tier 2: 16 / 200. Tier 3: 40 / 2,000
Language English fully supported, others not evaluated
Batch API Not supported

Rate limits apply per project, not per key. The 40 requests per day on Tier 1 is the one most people hit first. My LLM API rate limits guide explains how tiers go up.

How Omni Safety Filters and Watermarks Work

Omni checks both your prompt and the finished video against Google’s usage policies. The filters vary by region. A blocked prompt returns an error or a reply with no video.

  • Recognizable people: uploading and editing images of certain recognizable people is not supported.
  • Minors: uploading and editing images that contain minors is not supported in the EEA, Switzerland and the UK.
  • Regional features: editing or extending your own uploaded videos is not available in those regions either.
  • SynthID: every video carries an invisible SynthID watermark that tools can detect.
  • Content Credentials: the Agent Platform model page lists C2PA support.

For business work, keep prompts about your own products, places and made-up characters. When a request is blocked, change the wording rather than retrying the same text.

Gemini Omni vs Veo on Enterprise Agent Platform

Both models run on Gemini Enterprise Agent Platform. Only Omni also runs on a plain Gemini API key. Here is how they compare on 3 December 2026.

Feature Gemini Omni 1.2 Flash Veo 3.1 (GA)
Model id gemini-omni-1.2-flash veo-3.1-generate-001 (plus Fast and Lite)
Gemini API key Yes No (previews shut down 22 Oct 2026)
Agent Platform Yes, GA, Standard PayGo and Provisioned Throughput Yes, GA
SDK call client.interactions.create() client.models.generate_videos()
Clip length 3 to 15 s, any whole second 4, 6 or 8 s
Price, 720p with audio About $0.07/s $0.40/s (Fast $0.10, Lite $0.05)
Resolutions 360p, 720p, 1080p, 4K 720p, 1080p, 4K
Silent option No, audio bundled Yes, cheaper
Videos per request 1 Up to 4
Chat-style editing Yes No
Negative prompt field No Yes
Reference images Up to 6 Yes (asset images)
Free tier No No
Quick answer: Pick Omni for API-key projects, longer clips, low cost and chat edits. Pick Veo on Agent Platform if your pipeline already uses generate_videos(), needs silent clips or wants 4 takes per call.

Not sure which platform suits you? Read Google AI Studio vs Vertex AI.

Troubleshooting: Common Gemini Omni API Errors

Error or symptom Likely cause Fix
400 INVALID_ARGUMENT Duration over 15 s, or over 10 s with two frames Use “3s” to “15s”, and 10 s max for first/last frame
400 with background=True store=False was also set Keep store=True for background jobs
400 on an edit turn Previous interaction is still in_progress Wait for completed before chaining
404 NOT_FOUND Old id such as gemini-omni-flash-preview or a Veo preview Use gemini-omni-1.2-flash
429 RESOURCE_EXHAUSTED Over 8 RPM or 40 RPD on Tier 1, or a free-tier project Back off, turn on billing, or move up a tier
403 PERMISSION_DENIED Bad or restricted key Make a new key in AI Studio and check its limits
500 INTERNAL, 503 UNAVAILABLE, 504 DEADLINE_EXCEEDED Busy servers or a slow long clip Retry with backoff. Try a shorter or lower-res clip
AttributeError: 'Client' object has no attribute 'interactions' Old google-genai version Run pip install -U google-genai on Python 3.11+
output_video is None Blocked by a filter, or a text-only reply Read the text in steps and reword the prompt
Huge or slow response Big inline base64 video Set "delivery": "uri" and download the file
Upload edit fails in Europe Feature not offered in EEA, CH, UK Edit clips Omni made instead

For general Gemini error codes, see Gemini API errors and fixes.

Frequently Asked Questions

Is Gemini Omni the same as Veo?

No. Omni is a separate multimodal model that makes and edits video through the Interactions API. Veo is Google’s dedicated video model family, now offered through Gemini Enterprise Agent Platform.

What is the latest Gemini Omni model id?

It is gemini-omni-1.2-flash, GA since 5 November 2026. From 3 December 2026, calls to gemini-omni-1.1-flash route to 1.2 automatically.

How much does a Gemini Omni video cost?

About $0.07 per second at 720p, so an 8-second clip is about $0.56 and a 15-second clip about $1.04. 360p is $0.023 per second and 4K is $0.209 per second.

Is there a free tier for Gemini Omni?

No. The pricing and rate limit pages list Omni as not available on the free tier. You need a paid Gemini API project.

How long can a Gemini Omni video be?

One generation is 3 to 15 seconds. By extending a clip several times you can reach up to 30 seconds in total.

Does Gemini Omni make sound?

Yes. It makes native audio with every clip, including speech, music and effects. Describe the sound you want in the prompt, or write “no dialogue”.

Can I use Gemini Omni in Google Cloud?

Yes. gemini-omni-1.2-flash is GA on Gemini Enterprise Agent Platform with Standard PayGo and Provisioned Throughput, in the global region.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman in a lab coat in a co-working space with plants holding a tablet with a GEMINI OMNI card, hook $0.07 per sec AI video API