Veo 3.1
Veo 3.1 is Google's flagship video model in the Veo 3.1 generation on AI Gateway, the quality ceiling of that generation, with strong motion fidelity, native audio-visual synchronization, and image-to-video support for professional production workflows.
View API reference- Price
- $0.20, Per secondLowest available configuration
import { experimental_generateVideo as generateVideo } from 'ai';
const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: 'A serene mountain lake at sunrise.'});Copy link to headingPlayground
Try out Veo 3.1 by Google. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.
Your generated video will appear here.
Copy link to headingProviders
Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.
| Provider |
|---|
Getting started
Generate videos with Veo 3.1 using the experimental_generateVideo function from AI SDK 6 or later. AI Gateway handles routing and polls until the video is ready.
Install the AI SDK (pnpm add ai dotenv), create an API key from the API Keys page, and set it as AI_GATEWAY_API_KEY in your environment. Full setup is covered in the video generation quickstart.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: 'A pangolin curled on a mossy stone in a glowing bioluminescent forest', generateAudio: true, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);Top-level parameters
Load the supported top-level parameters: prompt, aspectRatio, duration, resolution, and generateAudio.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: 'A pangolin curled on a mossy stone in a glowing bioluminescent forest', aspectRatio: '16:9', duration: 8, resolution: '1080p', generateAudio: true, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | No | Text description of the video to generate. |
duration | 4 | 6 | 8 | No | Video length in seconds. 4 or 6 or 8 seconds. |
resolution | string | No | Resolution ('1280x720', '1920x1080', '3840x2160'). |
aspectRatio | string | No | Aspect ratio ('16:9', '9:16'). |
generateAudio | boolean | No | Generate synchronized audio with the video. |
frameImages | Array<{ image: string; frameType: 'first_frame' | 'last_frame' }> | No | First and last frames of the clip. A first_frame entry replaces prompt.image and wins when both are set, and adding a last_frame makes Veo animate from the first frame toward the last. |
inputReferences | Array<string> | No | Reference images that guide the assets and style of the scene you describe in the prompt. They are not used as the first frame, and there is no prompt syntax for addressing them individually. Images only. |
Input limits
| Input | Formats | Sources | Max count | Max size | Limits |
|---|---|---|---|---|---|
| Image | jpg, jpeg, png | url, base64 | 3 | 20 MB | — |
| Video | mp4 | url | 1 | — | — |
Provider options
Pass Veo-specific options under providerOptions.vertex. This call loads every text-to-video option that combines in a single request. resizeMode is image-to-video only (see below), while referenceImages and gcsOutputDirectory change the inputs/output destination and are omitted here.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: 'A pangolin curled on a mossy stone in a glowing bioluminescent forest', generateAudio: true, providerOptions: { vertex: { enhancePrompt: true, negativePrompt: 'blurry, low quality, distorted', personGeneration: 'allow_adult', compressionQuality: 'optimized', sampleCount: 1, seed: 42, pollIntervalMs: 5000, pollTimeoutMs: 600000, }, }, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);Pass Veo-specific options under providerOptions.vertex in your generateVideo call.
| Parameter | Type | Required | Description |
|---|---|---|---|
enhancePrompt | boolean | No | Use Gemini to enhance prompts. Defaults to true. |
negativePrompt | string | No | What to discourage in the generated video. |
personGeneration | 'dont_allow' | 'allow_adult' | 'allow_all' | No | Whether to allow person generation. Defaults to 'allow_adult'. |
compressionQuality | 'optimized' | 'lossless' | No | Compression quality. Defaults to 'optimized'. |
sampleCount | number | No | Number of output videos (1-4). |
seed | number | No | Seed for deterministic generation (0-4,294,967,295). |
gcsOutputDirectory | string | No | Cloud Storage URI to store the generated videos. |
referenceImages | array | No | Reference images for style or asset guidance. Legacy alternative to the top-level inputReferences, used only when inputReferences is omitted. |
resizeMode | 'pad' | 'crop' | No | Image-to-video only: how to resize the input image to fit video dimensions. Defaults to 'pad'. |
pollIntervalMs | number | No | How often to check task status. Defaults to 5000. |
pollTimeoutMs | number | No | Maximum wait time. Defaults to 600000 (10 minutes). |
Duration and resolution
1080p and 4K require duration: 8. At 720p, you can use 4, 6, or 8 seconds.
Frames take priority over references
Frames and references are mutually exclusive. When frameImages is set, inputReferences and the legacy providerOptions.vertex.referenceImages are ignored.
The top-level parameters win over their provider-option equivalents: frameImages overrides prompt.image, and inputReferences overrides providerOptions.vertex.referenceImages.
Image to video
Animate a starting image by passing prompt as an object with image and an optional text field.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: { image: 'https://example.com/landscape.png', text: 'Camera slowly pans across the scene as clouds drift by', }, duration: 8, resolution: '1080p', generateAudio: true, providerOptions: { vertex: { resizeMode: 'crop', }, }, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);First and last frame
Transition between a starting and ending image. Pass both frames through the top-level frameImages, tagging one first_frame and one last_frame. Veo animates from the first frame toward the last.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: '360 pan from the first frame to the last frame', frameImages: [ { image: 'https://example.com/start.png', frameType: 'first_frame' }, { image: 'https://example.com/end.png', frameType: 'last_frame' }, ], aspectRatio: '16:9', resolution: '720p', duration: 8, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);Reference to video
Guide the assets and style of a generated scene with reference images passed through the top-level inputReferences. The references are not used as the first frame, and Veo has no prompt syntax for addressing them individually — describe how they should appear in the scene instead.
import { experimental_generateVideo as generateVideo } from 'ai';import fs from 'node:fs';import 'dotenv/config';
async function main() { const result = await generateVideo({ model: 'google/veo-3.1-generate-001', prompt: 'The video opens with a medium shot of a woman in a high-fashion flamingo dress walking through a lagoon', inputReferences: [ 'https://example.com/dress.png', 'https://example.com/glasses.png', 'https://example.com/woman.png', ], aspectRatio: '16:9', duration: 8, generateAudio: true, });
// Save the generated video fs.writeFileSync('output.mp4', result.videos[0].uint8Array);
console.log('Video saved to output.mp4');}
main().catch(console.error);Copy link to headingAbout Veo 3.1
Veo 3.1 represents the top of the Veo 3.1 generation on AI Gateway. This 3.1 standard-quality configuration applies full generation compute to each request. The Veo 3.1 generation improved motion physics accuracy, object coherence across frames, and prompt adherence relative to 3.0. In standard-quality mode, these improvements are most apparent: frame-to-frame consistency is tighter, object boundaries hold through complex motion, and audio-visual synchronization is more precise.
This is the endpoint for video workflows that have moved through the iteration phase and are generating final deliverables. A typical production workflow uses Veo 3.1 Fast for prompt exploration (generating many variations quickly), then routes the validated direction to Veo 3.1 for the final render. Both configurations share the same generation architecture; the distinction is how much compute each generation receives.
Image-to-video generation is fully supported for workflows that animate reference assets: product photography in motion, character illustrations brought to life, or architectural visualizations with simulated lighting. Native audio generation covers ambient sound, effects, and synchronized dialogue without post-production audio work.
Copy link to headingWhat To Consider When Choosing a Provider
- Configuration: For professional media and branded content workflows, verify with your provider that the generation quality and output format meet your distribution requirements before scaling production.
- Zero Data Retention: Zero Data Retention is available for this model. It is offered on a per-provider and model basis. See the documentation for details.
- Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.
Copy link to headingWhen to Use Veo 3.1
Best for
- Final production renders: After prompt direction is validated in the fast tier, Veo 3.1 produces the highest-quality output for final distribution and delivery
- Professional media and branded content: Advertising, corporate video, documentary segments, and branded social content where frame quality and motion consistency determine whether the output is usable
- Reference image animation at maximum fidelity: Animating product shots, character art, or architectural renders where the source asset quality must carry through to the output with minimal artifact introduction
- Synchronized audio for finished content: Scenes requiring precise dialogue timing, music beat alignment, or ambient environment audio in the final cut without separate audio production
Consider alternatives when
- Iteration and prompt exploration are ongoing: Veo 3.1 Fast provides comparable generation at reduced cost and latency for the exploration phase
- You have validated production prompts on Veo 3.0: If your pipeline is tuned to the 3.0 generation and output consistency is a priority, validate 3.1 output before migrating to Veo 3.1
- Speed or cost is the binding constraint: For high-volume generation where output quality is secondary to throughput, the fast tier is more economical
Copy link to headingConclusion
Veo 3.1 is the final render endpoint for Veo-based video production, the quality ceiling of the Veo 3.1 generation for teams whose workflows require strong motion fidelity and audio-visual synchronization within that lineup.
Copy link to headingFrequently Asked Questions
What improved in the Veo 3.1 generation over Veo 3.0?
The 3.1 generation delivers improvements in motion physics accuracy, frame-to-frame object coherence, and audio-visual synchronization precision. In standard-quality mode, these improvements are most pronounced in scenes with complex motion or precise audio timing requirements.
How does the fast vs standard quality difference manifest in output?
Standard Generate applies more generation compute per request, resulting in tighter frame consistency, more accurate motion physics, and better audio-visual alignment on complex scenes. For simple scenes, the difference may be minimal. The gap is most visible on content with fast motion, fine detail, or precise audio timing.
What audio generation capabilities does Veo 3.1 include?
The model generates ambient environment audio, sound effects, and dialogue synchronized to visual events from text prompt descriptions. Audio and video are generated in a single pass without post-production audio assembly.
Does Veo 3.1 support image-to-video?
Yes, provide a reference image alongside a text description to animate it. The model generates video that begins from the reference image with motion described in the prompt.
What resolution does Veo 3.1 support?
Up to 1080p, with duration and aspect ratio options depending on the provider. See the Specs table on this page for the full list.
How do I use Veo 3.1 on AI Gateway?
Use the identifier
google/veo-3.1-generate-001with the generateVideo interface in the AI SDK. AI Gateway handles provider selection and failover automatically.