Guides
Video generation
74 video models cover text-to-video, image-to-video, and video editing. Video takes longer than an image, so the SDK lets you either block on generate() or submit a job and poll.
Standard parameters
The parameters most video models share. Exact params vary per model — each model page lists its full schema.
| Parameter | Type | Description |
|---|---|---|
promptrequired | string | Text description of what to generate. |
duration | number | Length in seconds. |
aspectRatio | string | Output aspect ratio, e.g. 16:9, 1:1, 9:16. |
resolution | string | Output resolution, e.g. 720p, 1080p. |
generateAudio | boolean | Also generate a matching audio track. |
imageUrls | string[] | Input / reference image URLs. |
startFrame | string | First-frame image URL. |
endFrame | string | Last-frame image URL. |
Text to video
Set the prompt, duration (seconds), and aspectRatio. Prefer submit() + result()so a slow job can't time out.
// Video is long-running — submit the job, then poll for the result.
const handle = await ai.submit('veo-3.1', {
prompt: 'A drone shot flying over a canyon at sunrise',
duration: 8,
aspectRatio: '16:9',
});
const result = await ai.result(handle, 'veo-3.1');
console.log(result.url); // video URLUsing start/end frame
Give the model a first and/or last keyframe and it fills in the motion between them. Pass each frame as a URL via startFrame and endFrame.
// Animate between two keyframes — pass each as an image URL.
const handle = await ai.submit('kling-v3', {
prompt: 'Smooth cinematic transition between the two frames',
startFrame: 'https://cdn.example.com/first.jpg',
endFrame: 'https://cdn.example.com/last.jpg',
duration: 5,
});
const result = await ai.result(handle, 'kling-v3');
console.log(result.url);Using reference images
Animate a still or steer the subject/style with one or more reference images passed through imageUrls. The CLI uploads a local file for you.
// Animate a still / guide the subject with one or more reference images.
const handle = await ai.submit('veo-3.1', {
prompt: 'Slow zoom out, gentle wind in the trees',
imageUrls: ['https://cdn.example.com/frame.jpg'],
duration: 5,
});
const result = await ai.result(handle, 'veo-3.1');
console.log(result.url);Track progress
Subscribe to a submitted job for live status and progress updates before reading the final result.
// Stream live status while a job runs.
const handle = await ai.submit('kling-v3', {
prompt: 'a fox running through autumn leaves',
duration: 5,
});
for await (const update of ai.subscribe(handle)) {
console.log(update.status, update.progress);
}
const result = await ai.result(handle, 'kling-v3');
console.log(result.url);