Google’s Veo models still make some of the best AI video around. But the way you call them from code changed this autumn. The old Gemini API preview ids stopped working on 22 October 2026, so many Veo tutorials online now fail with a 404.
This guide shows the route that works today. You call the GA Veo 3.1 models with the google-genai Python SDK on Gemini Enterprise Agent Platform (the new name for Vertex AI). I also cover the API-key option, which is now Gemini Omni Flash.
- Preview ids are gone:
veo-3.1-generate-preview,veo-3.1-fast-generate-previewandveo-3.1-lite-generate-previewwere shut down in the Gemini API on 22 Oct 2026. - Current Veo ids:
veo-3.1-generate-001andveo-3.1-fast-generate-001(GA), plusveo-3.1-lite-generate-001(Preview), on Gemini Enterprise Agent Platform. - Same SDK:
pip install --upgrade google-genai(I checked version 3.7.0), setGOOGLE_GENAI_USE_ENTERPRISE=True, callclient.models.generate_videos()and poll the operation. - Price: Veo 3.1 costs $0.40 per second with audio at 720p/1080p. An 8-second clip is about $3.20. Veo 3.1 Lite starts at $0.05 per second.
- API key only? Use
gemini-omni-1.2-flashin the Gemini API instead, about $0.07 per second at 720p.
What Changed with the Veo API in Late 2026
For most of 2025 and 2026 you could call Veo with a plain Gemini API key. That route used preview model ids. Google’s video page now says those previews were shut down on 22 October 2026.
The official docs point you to two replacements. You can move to Gemini Omni Flash in the Gemini API, or keep using Veo through the GA models on Gemini Enterprise Agent Platform. This tutorial covers the Veo route in depth.

Older ids were retired even earlier. The deprecations page lists veo-3.0-generate-001, veo-3.0-fast-generate-001 and veo-2.0-generate-001 with a shutdown date of 30 June 2026 in the Gemini API.
google-genai SDK in enterprise mode, and the model id veo-3.1-generate-001. If you only want an API key, use gemini-omni-1.2-flash.New to the SDK? My Gemini API Python tutorial covers the basics. The AI Studio vs Vertex AI comparison explains the two platforms.
Current Veo Model IDs (Checked 3 December 2026)
The Veo 3.1 model page calls Veo 3.1 Google’s latest line of video models. I found no official Veo 4 release in the last few weeks of news. Here are the three ids you can use now.
| Model | Model id | Stage | Output resolutions | Reference images | Retirement |
|---|---|---|---|---|---|
| Veo 3.1 | veo-3.1-generate-001 |
GA (17 Nov 2025) | 720p, 1080p, 4K | Yes (asset images) | 4 May 2027 or later |
| Veo 3.1 Fast | veo-3.1-fast-generate-001 |
GA (17 Nov 2025) | 720p, 1080p | See model page | 4 May 2027 or later |
| Veo 3.1 Lite | veo-3.1-lite-generate-001 |
Preview (2 Apr 2026) | 720p, 1080p | No | Not listed |
All three support text to video, image to video, first and last frame, video extension and sound generation. They output 24 fps MP4 files in 16:9 or 9:16.
Note: The Lite model page lists image input as “not supported” in its modality box but lists image to video as a capability. Test your own case before you build around Lite and images.
Prerequisites
- A Google Cloud project with billing turned on. Veo is not on any free tier.
- The Agent Platform API enabled in that project.
- Python 3.11 or newer and pip. google-genai 3.7.0 needs Python 3.11+.
- The gcloud CLI for login and, if you want, for copying files from Cloud Storage.
- A Cloud Storage bucket (optional). You need it for big outputs or for keeping files around.
How to Set Up the Veo API in 6 Steps
- Pick or create a project. In the Google Cloud console, open the project selector and choose a project with billing.
- Enable the API. Turn on the Agent Platform API for that project.
- Log in locally. Run
gcloud auth application-default loginso the SDK can find your credentials. No API key goes in your code. - Install the SDK. Run
pip install --upgrade google-genai. Version 3.7.0 was the newest on PyPI when I checked. - Set three environment variables.
GOOGLE_CLOUD_PROJECT(your project id),GOOGLE_CLOUD_LOCATION(the docs useglobal) andGOOGLE_GENAI_USE_ENTERPRISE=True. - Run a test script. Use Example 1 below. If it prints a file name after a minute or two, you are ready.
Here is the official sample from Google Cloud’s text-to-video page. Note the new GOOGLE_GENAI_USE_ENTERPRISE variable. Older posts use GOOGLE_GENAI_USE_VERTEXAI, which the SDK still reads too.

Example 1: Text to Video in Python
This script asks Veo 3.1 for one 8-second clip and saves it next to the script. If you leave out output_gcs_uri, the API returns the video bytes in the response.
import os
import time
from google import genai
from google.genai import types
# Reads GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
# and GOOGLE_GENAI_USE_ENTERPRISE from the environment.
client = genai.Client()
operation = client.models.generate_videos(
model="veo-3.1-generate-001",
prompt=(
"A slow dolly shot of a red vintage bicycle leaning on a cafe wall "
"in light rain, warm window light, soft jazz in the background"
),
config=types.GenerateVideosConfig(
aspect_ratio="16:9",
resolution="1080p",
duration_seconds=8,
generate_audio=True,
number_of_videos=1,
),
)
# Veo runs as a long-running operation. Poll until it is done.
while not operation.done:
print("Still generating...")
time.sleep(15)
operation = client.operations.get(operation)
if operation.error:
raise RuntimeError(operation.error)
result = operation.result
if not result.generated_videos:
print("No video returned. Filtered count:", result.rai_media_filtered_count)
print("Reasons:", result.rai_media_filtered_reasons)
else:
video = result.generated_videos[0].video
video.save("bicycle.mp4")
print("Saved bicycle.mp4")
A few things to know about this code:
- Polling:
generate_videos()returns at once with an operation. You refresh it withclient.operations.get(operation). Google’s sample waits 15 seconds between checks. - Saving:
video.save()only works when the response holds bytes. With Cloud Storage output it raises “Saving remote videos is not supported.” - Filtering: If safety filters block a clip,
generated_videoscomes back short and the filter fields explain why.
Tip: Write prompts like a shot list. Name the subject, camera move, light, mood and sound. Veo 3.1 makes audio by default, so describe the sound you want or say “no dialogue”.
Example 2: Image to Video (First Frame and Last Frame)
Pass an image and Veo uses it as the first frame. Add last_frame in the config and Veo animates the move between the two pictures. The input image can be up to 20 MB.
import time
from google import genai
from google.genai import types
client = genai.Client()
first = types.Image.from_file(location="product_start.png")
last = types.Image.from_file(location="product_end.png") # optional
operation = client.models.generate_videos(
model="veo-3.1-fast-generate-001",
prompt="The camera orbits the sneaker as studio lights sweep across it",
image=first,
config=types.GenerateVideosConfig(
aspect_ratio="9:16",
resolution="720p",
duration_seconds=6,
last_frame=last, # remove this line for first-frame only
generate_audio=False, # silent clip, lower price
),
)
while not operation.done:
time.sleep(15)
operation = client.operations.get(operation)
videos = operation.result.generated_videos
if videos:
videos[0].video.save("sneaker.mp4")
print("Saved sneaker.mp4")
Google’s own sample uses a Cloud Storage image instead: types.Image(gcs_uri="gs://...", mime_type="image/png"). Both forms work with the same call.
For character or product consistency, the standard Veo 3.1 model also takes reference_images. Each one is a types.VideoGenerationReferenceImage with a reference_type of asset. The model page says reference image to video only supports 8-second clips.
Example 3: Save to Cloud Storage and Download
For 1080p, 4K or several clips per request, send output straight to a bucket. Set output_gcs_uri and the result gives you a gs:// path instead of bytes.
import time
from google import genai
from google.genai import types
from google.cloud import storage # pip install google-cloud-storage
client = genai.Client()
OUT = "gs://my-video-bucket/veo/"
operation = client.models.generate_videos(
model="veo-3.1-generate-001",
prompt="Aerial shot over a misty pine forest at sunrise, birdsong",
config=types.GenerateVideosConfig(
output_gcs_uri=OUT,
number_of_videos=2,
duration_seconds=8,
seed=42,
),
)
while not operation.done:
time.sleep(15)
operation = client.operations.get(operation)
gcs = storage.Client()
for i, gv in enumerate(operation.result.generated_videos):
uri = gv.video.uri # gs://my-video-bucket/veo/....mp4
bucket_name, blob_path = uri[5:].split("/", 1)
gcs.bucket(bucket_name).blob(blob_path).download_to_filename(f"forest_{i}.mp4")
print("Downloaded", uri)
You can also copy files with the CLI: gcloud storage cp gs://my-video-bucket/veo/*.mp4 .
Warning: Do not use client.files.download() here. In enterprise or Vertex mode the SDK raises “This method is only supported in the Gemini Developer client.”
Example 4: curl with predictLongRunning
Under the SDK sits a plain REST API. First you start the job with predictLongRunning. Save this as request.json:
{
"instances": [
{ "prompt": "A paper boat drifting down a rainy street gutter, close up" }
],
"parameters": {
"storageUri": "gs://my-video-bucket/veo/",
"sampleCount": 1,
"durationSeconds": 8,
"aspectRatio": "16:9",
"resolution": "1080p",
"generateAudio": true
}
}
Then send it:
PROJECT_ID="your-project-id"
MODEL_ID="veo-3.1-generate-001"
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://us-central1-aiplatform.googleapis.com/v1/projects/$PROJECT_ID/locations/us-central1/publishers/google/models/$MODEL_ID:predictLongRunning"
The reply holds an operation name. To check it, POST {"operationName": "THAT_NAME"} to the same URL with :fetchPredictOperation at the end. Repeat until the response says it is done.
Veo Options: Aspect Ratio, Resolution, Duration and Audio
These are the GenerateVideosConfig fields in the Python SDK. The REST names are in brackets, taken from the VideoGenerationModelParams reference.
| Python field (REST) | Values | Default / notes |
|---|---|---|
aspect_ratio (aspectRatio) |
“16:9”, “9:16” | Landscape or portrait |
resolution (resolution) |
“720p”, “1080p” | 4K is listed for Veo 3.1 output and pricing, via the upscale task |
duration_seconds (durationSeconds) |
4, 6 or 8 | 8 by default. Reference images need 8 |
generate_audio (generateAudio) |
True / False | True by default. False costs less |
number_of_videos (sampleCount) |
1 to 4 | 1 by default. Each clip is billed |
negative_prompt (negativePrompt) |
Text | Things to keep out, such as “blurry, text overlay” |
seed (seed) |
Integer | Repeatable results, but not with prompt enhancement on |
enhance_prompt (enhancePrompt) |
True / False | True by default |
person_generation (personGeneration) |
“dont_allow”, “allow_adult” | “allow_adult” by default |
output_gcs_uri (storageUri) |
gs:// path | Leave out to get bytes back |
last_frame |
Image | Image-to-video only |
compression_quality (compressionQuality) |
“optimized”, “lossless” | “optimized” by default |
resize_mode (resizeMode) |
“pad”, “crop” | “pad” by default |
The SDK also has fps, pubsub_topic for progress messages, labels and mask for editing. The Veo 3.1 model page lists 24 fps as the supported frame rate.
Veo API Pricing (Per Second) with Worked Examples
Veo is billed by the second of video it makes. These are the list prices on Google Cloud’s Agent Platform pricing page on 3 December 2026. The table shows the unit as “1 count”, which matches the per-second rates Google used for Veo in the Gemini API.
| Model | Video + audio | Video only (no audio) |
|---|---|---|
| Veo 3.1 | $0.40 (720p, 1080p), $0.60 (4K) | $0.20 (720p, 1080p), $0.40 (4K) |
| Veo 3.1 Fast | $0.10 (720p), $0.12 (1080p), $0.30 (4K) | $0.08 (720p), $0.10 (1080p), $0.25 (4K) |
| Veo 3.1 Lite | $0.05 (720p), $0.08 (1080p) | $0.03 (720p), $0.05 (1080p) |
| Gemini Omni 1.2 Flash (Gemini API) | about $0.07 (720p), $0.023 (360p), $0.104 (1080p), $0.209 (4K) | Audio always included |
Worked example: a 30-second product ad
Say you need four 8-second shots at 1080p with sound, then cut them into an ad. That is 32 seconds of video.
- Veo 3.1: 32 x $0.40 = $12.80
- Veo 3.1 Fast: 32 x $0.12 = $3.84
- Veo 3.1 Lite: 32 x $0.08 = $2.56
- Veo 3.1, silent: 32 x $0.20 = $6.40
Now add retakes. If you set number_of_videos=4 on each shot to pick the best take, you pay for all 128 seconds. That is $51.20 on Veo 3.1, so draft on Lite or Fast first.
Tip: The 1 December 2026 Gemini API price change hit Gemini 4 Carbon and Argon text pricing, not video. Omni 1.2 Flash got cheaper in November (from about $0.10 to $0.07 per second at 720p). See Gemini API pricing and free tier for the text models.
Veo Limits and Quotas
| Limit | Value (Veo 3.1 family) |
|---|---|
| Clip length | 4, 6 or 8 seconds (8 for reference images) |
| Videos per prompt | Up to 4 |
| Input image size | Up to 20 MB |
| Aspect ratios | 16:9, 9:16 |
| Frame rate | 24 fps |
| Output format | video/mp4 |
| Prompt language | English (Lite marks it as preview) |
| Region listed | United States: us-central1 |
| Default quota | 50 online prediction requests per minute per base model (regional) |
| Consumption | Fixed quota or Provisioned Throughput. No batch inference |
The quota line on the model page is worded oddly (“50 tokens per minute”), so treat 50 per minute as a starting point. Check your real numbers on the Quotas page in the console. My LLM API rate limits guide explains how to ask for more.
How Veo Safety Filters Work
Every prompt and input image is checked against Google’s usage policies. Blocked requests come back with an error or a short list of videos, plus a support code you can look up.
- Whole request blocked: You get an error message that the prompt could not be submitted. Reword the prompt.
- Some clips blocked: You get fewer videos than you asked for. Check
rai_media_filtered_countandrai_media_filtered_reasons. - Support codes: Google’s Responsible AI page maps each code to a category, such as violence, hate, sexual content, third-party content or famous people.
- People settings:
person_generationcontrols whether people can appear. Generating younger-looking people needs an allowlisted project. - Provenance: The model page lists Content Credentials (C2PA) support. Google also adds an invisible SynthID watermark to its generated video.
For business use, keep prompts about your own products, places and made-up characters. That avoids most blocks.
Only Have a Gemini API Key? Use Gemini Omni Flash
If you do not want a Cloud project, Google’s video page now points API-key users to gemini-omni-1.2-flash. It went GA on 5 November 2026 and makes 3 to 15 second clips with audio. It uses the Interactions API, not generate_videos().
import base64
from google import genai
client = genai.Client() # reads GEMINI_API_KEY from the environment
interaction = client.interactions.create(
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"},
)
with open("lake.mp4", "wb") as f:
f.write(base64.b64decode(interaction.output_video.data))
Omni is a paid-tier model with no free tier. Since 3 December 2026, calls to gemini-omni-1.1-flash route to 1.2 at 1.2 prices. For a no-code option, see my Google Vids free AI video guide.
Troubleshooting: Common Veo API Errors and Fixes
| Error or symptom | Likely cause | Fix |
|---|---|---|
404 NOT_FOUND for veo-3.1-generate-preview |
Preview ids were shut down on 22 Oct 2026 | Use veo-3.1-generate-001 on Agent Platform, or switch to Omni |
| Model not found with a Gemini API key | Client is in Gemini Developer mode | Set GOOGLE_GENAI_USE_ENTERPRISE=True plus project and location |
| 403 PERMISSION_DENIED | API not enabled, no billing, or missing IAM role | Enable the Agent Platform API and check your role on the project |
| DefaultCredentialsError | No local login | Run gcloud auth application-default login |
| 400 INVALID_ARGUMENT | Bad value, such as a 10-second duration or 4K on Lite | Use 4, 6 or 8 seconds and the resolutions in the table |
| 429 RESOURCE_EXHAUSTED | Over the per-minute quota | Back off and retry, or request more quota |
| “Saving remote videos is not supported.” | You set output_gcs_uri, so there are no bytes |
Download from Cloud Storage instead |
| “This method is only supported in the Gemini Developer client.” | files.download() in enterprise mode |
Use google-cloud-storage or gcloud storage cp |
Empty generated_videos |
Safety filter blocked the output | Read the filter reasons and reword the prompt |
| Operation never finishes in your loop | You did not refresh the operation | Call client.operations.get(operation) inside the loop |
For general Gemini error codes, see Gemini API errors and fixes.
Frequently Asked Questions
Can I still use Veo with a Gemini API key?
Not with the old preview ids. Google shut down the Veo 3.1 previews in the Gemini API on 22 October 2026. Use Veo GA on Gemini Enterprise Agent Platform, or Gemini Omni Flash with your API key.
What is the latest Veo model id?
The GA ids are veo-3.1-generate-001 and veo-3.1-fast-generate-001, released 17 November 2025. veo-3.1-lite-generate-001 is in Preview.
How much does an 8-second Veo video cost?
On Veo 3.1 with audio at 720p or 1080p it is 8 x $0.40 = $3.20. The same clip costs $0.96 on Fast at 1080p and $0.64 on Lite at 1080p.
How long does Veo take to make a video?
Google does not promise a fixed time, and it depends on length, resolution and load. Plan for a minute or more, and poll the operation every 15 seconds or so.
Does Veo make sound?
Yes. Veo 3.1 makes audio by default, including speech and sound effects. Set generate_audio=False for silent clips at a lower price.
Can Veo make vertical videos for Shorts and Reels?
Yes. Set aspect_ratio="9:16". Veo 3.1 supports 9:16 and 16:9 only.
Is there a free tier for Veo?
No. Veo and Omni Flash have no free tier in the API. New Google Cloud accounts sometimes get trial credits, so check your billing page.
Sources
- Video generation in the Gemini API (Google AI Studio docs)
- Gemini API deprecations
- Veo 3.1 model page (Gemini Enterprise Agent Platform)
- Generate videos from text prompts
- Generate videos from an image
- VideoGenerationModelParams API reference
- Responsible AI for Veo
- Agent Platform pricing (Veo section)
- Gemini Developer API pricing
- Gemini Omni Flash docs
- Google blog: Introducing Gemini Omni 1.2 Flash (5 Nov 2026)
- google-genai on PyPI




