// HOW-TO · AI VIDEO

How to use the Gemini Veo 3.1 API to generate video (2026)

Generate video with Google's Gemini Veo 3.1 API: pick a model tier, set resolution and clip length, poll the long-running job, then caption and publish.

Last verified · 2026-10-17 · by Moe Ameen

Google's Veo 3.1 is available programmatically through the Gemini API, so you can generate video with synchronized native audio from your own code instead of clicking through the Gemini app or Flow. The API is the right path when you want to batch clips, wire generation into a product, or script a repeatable pipeline. It is also the path where the small details bite — the model IDs are preview endpoints, there is no free tier, the longer resolutions are gated to 8-second clips, and generation is asynchronous, so you poll a long-running job rather than getting a file back on the same call.

This guide walks the request end to end: picking the model variant that fits your budget, setting resolution, duration, and aspect ratio correctly, adding reference images or first/last-frame control, kicking off the job, polling until it finishes, and downloading the clip. It uses the official google-genai SDK shape, but the same steps map to the REST endpoint. Verify current model IDs and per-second prices on Google's own pages before you ship — Veo is in active development and Google re-prices and renames endpoints often.

The steps

  1. Get a paid Gemini API key — there is no free tier for Veo. Create a key in Google AI Studio and make sure the project is on the paid tier. Google's pricing page lists the free-tier column for every Veo 3.1 model as "Not available," so a free key will reject video requests. Billing is per second of output, and Google only charges when a clip generates successfully, so failed renders are not billed. Store the key as an environment variable, never in client-side code.
  2. Pick the model variant and use its exact preview ID. Veo 3.1 ships in three tiers, each with its own model ID: `veo-3.1-generate-preview` (Standard, highest fidelity), `veo-3.1-fast-generate-preview` (Fast, cheaper for iteration), and `veo-3.1-lite-generate-preview` (Lite, the lowest-cost tier). Standard and Fast are roughly $0.40 and $0.10–$0.12 per second at 720p/1080p; Lite is $0.05–$0.08 and has no 4K. All three are preview endpoints, so pin the exact string and watch Google's deprecation notes — preview models get retired, and Google's own Gemini API deprecations page already lists October 22, 2026 as the earliest possible shutdown date for all three Veo 3.1 IDs, naming `gemini-omni-1.1-flash` as the replacement.
  3. Set resolution, duration, and aspect ratio in the generation config. Duration is 4, 6, or 8 seconds. This matters because the higher resolutions are gated to the 8-second length: 1080p and 4K both require an 8s clip (and reference images and scene extension do too). Resolution defaults to 720p; 4K is Standard and Fast only, never Lite. Aspect ratio is `16:9` (default) or `9:16` for vertical feeds. Output is 24fps, one video per request. Set `9:16` and 8s/1080p up front if the clip is headed for Reels, Shorts, or TikTok.
  4. Add inputs — image-to-video, reference images, or first/last frame. Text-to-video needs only a prompt. For image-to-video, pass a starting frame as `image`. To lock a character, product, or style, pass up to three reference images (Standard and Fast only — Lite does not support them). For a controlled transition, pass both `image` and `lastFrame` to pin the first and last frames. Reference-image and 8-second constraints combine, so plan the request: consistency plus 1080p means an 8-second, non-Lite clip.
  5. Kick off the job and poll the long-running operation. Video generation is asynchronous. Calling `client.models.generate_videos(...)` (or `ai.models.generateVideos(...)` in JS, or the REST `:predictLongRunning` endpoint) returns an operation object immediately, not a file. Loop on `client.operations.get(operation)` until `done` is true — Google's examples poll every 10 seconds. Latency runs from roughly 11 seconds to about 6 minutes at peak, so build a real wait loop with a timeout, not a single synchronous call.
  6. Download the clip, then extend the scene if you need length. Once `done` is true, read the result from the operation response and download the file (`client.files.download(...)`; in REST the URI is at `response.generateVideoResponse.generatedSamples[0].video.uri`). A single clip tops out at 8 seconds. If you need longer, scene extension (Standard and Fast only) adds 7 seconds per call, up to 20 times, for output as long as about 148 seconds — but the input must be a Veo-generated 720p clip, and extension output stays 720p.

Common gotchas

  • 1080p, 4K, reference images, and scene extension all require an 8-second clip — a 4s or 6s request silently caps you at 720p with none of those features.
  • The model IDs end in `-preview` for a reason: Google retires preview endpoints. The Gemini API deprecations page already lists October 22, 2026 as the earliest possible shutdown date for all three Veo 3.1 IDs, naming `gemini-omni-1.1-flash` as the replacement — pin the exact ID, log the version you shipped, and monitor that page so a silent retirement does not break your pipeline.
  • There is no free tier. A free-tier key will reject Veo requests outright; you need billing enabled before the first call.
  • Native audio is always on, but social feeds autoplay muted — a Veo clip that speaks still needs a burned-in caption track before it performs in-feed.
  • Scene extension only works on a video Veo itself generated (≤141s, 720p, 16:9 or 9:16). You cannot extend arbitrary uploaded footage, and extended output does not reach 1080p.
  • Veo 3.1 Lite has no 4K and no reference images — if your pipeline depends on either, it must run on Standard or Fast, at the higher per-second rate.
Legal note

Veo outputs carry Google's SynthID watermark, and some regions and platforms require you to label AI-generated or synthetic media. YouTube, Meta, and TikTok all have altered/AI-content disclosure rules. Check each destination platform's current labeling policy and your local rules before publishing API-generated video, especially for ads or anything depicting a real person.

Where Kompozy fits

The API hands you back one thing: a short MP4 and a polling loop you had to write yourself. That is the whole job it does, and it is a good one — but it is also where most teams discover the real work starts after the clip exists. An 8-second render has no captions for muted autoplay, lives in a single aspect ratio, carries no brand frame or hook card, and is not scheduled or posted anywhere. If you only wire the API, you have also signed up to build the assembly step, the per-platform reframing, and the scheduler, and to keep all of it alive every time a preview endpoint is deprecated.

[Kompozy](/) is that after-the-clip layer, built so you do not maintain it. Drop a Veo export into Kompozy and [Clipped Shorts](/glossary/clipped-short) cuts it to vertical 9:16 with word-synced, on-brand captions — the track your clip needs because feeds play silent. From the same source it fans the idea into formats the API will never produce: a brand-exact carousel via [HyperFrames](/glossary/hyperframes), [quote graphics](/glossary/output-buckets) of the key line, a blog recap, and a newsletter, all held to your [Persona Brief](/glossary/persona-brief) so the copy stays on-voice. Then [Autopilot](/glossary/autopilot) schedules and publishes the set across eight social platforms plus blog and email from one review pipeline. You keep the API for raw generation; Kompozy turns each clip into a week of platform-native posts without a line of orchestration code. For a deeper look at Google's video stack, see the [Google Veo 3 workflow guide](/guides/google-veo-3-content-workflow) and the [Veo 3.1 API tool page](/ai-tools/veo-3-1-api).

Frequently asked questions

What does the Veo 3.1 API cost?

Billing is per second of output on the paid Gemini API tier. At the time of writing, Veo 3.1 Standard is about $0.40/second at 720p and 1080p and $0.60 at 4K; Fast is about $0.10–$0.12 at 720p/1080p and $0.30 at 4K; Lite is about $0.05–$0.08 with no 4K. An 8-second Standard clip is roughly $3.20. There is no free tier, and Google only bills successful generations. Google re-prices often, so confirm live rates before budgeting.

What are the Veo 3.1 API model IDs?

They are preview endpoints: `veo-3.1-generate-preview` (Standard), `veo-3.1-fast-generate-preview` (Fast), and `veo-3.1-lite-generate-preview` (Lite). The older Veo 3 IDs (`veo-3.0-generate-001`) are deprecated, and Google's own deprecations page already lists October 22, 2026 as the earliest possible shutdown date for all three Veo 3.1 IDs too, pointing to `gemini-omni-1.1-flash` as the replacement. Because these are preview models, pin the exact ID and watch Google's deprecation notes.

How long can a Veo 3.1 API clip be?

A single generation is 4, 6, or 8 seconds, and the longer resolutions require the 8-second length. Scene extension on the Standard and Fast tiers adds 7 seconds per call, up to 20 times, so a chained sequence can reach roughly 148 seconds — but only on a Veo-generated 720p source, and the extended output stays 720p.

Does the Veo 3.1 API generate audio?

Yes. Native audio is always on for all three variants — the model generates dialogue, sound effects, and ambient audio synchronized to the video and lip-synced to speaking characters, in the same pass. You do not add a separate audio step.

Is there a free tier for the Veo 3.1 API?

No. Google's pricing page marks the free tier as unavailable for every Veo 3.1 model, so you need a billing-enabled paid key. Generation is billed per second of successful output.

Related tutorials

← All how-to guides · Get Started