Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 99 additions & 6 deletions src/content/docs/docs/integrations/google-genai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ The Google AI plugin provides access to video generation capabilities through th

### Available Models

**Veo 3.1 Series** - Latest generation with native audio and high fidelity:
**Veo 3.1 Series** - Latest generation with native audio and high fidelity. Supports 4K resolution, landscape/portrait aspect ratios, video extension, and interpolation.
- `veo-3.1-generate-preview` - High-quality video and audio generation
- `veo-3.1-fast-generate-preview` - Fast generation with high quality

Expand Down Expand Up @@ -724,9 +724,11 @@ async function downloadVideo(video: MediaPart, path: string) {
}
```

#### Video Generation from Photo Reference
#### Image-to-Video and Interpolation

To use a photo as reference for the video using the Veo model (e.g. to make a static photo move), you can provide an image as part of the prompt.
Veo models can use a photo as a reference to generate video (image-to-video), or transition between two photos (interpolation).

**Image-to-Video:**

```typescript
const startingImage = fs.readFileSync('photo.jpg', { encoding: 'base64' });
Expand All @@ -752,6 +754,84 @@ let { operation } = await ai.generate({
});
```

**Interpolation:**

To generate a video that transitions between a starting image and an ending image, use the `image` parameter for the first frame and the `lastFrame` config for the final frame.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The explanation for interpolation could be clearer. It mentions using an image parameter for the first frame, but the code example provides the starting image as a media part within the prompt array. To avoid confusion, I suggest rephrasing this to better match the code example.

To generate a video that transitions between a starting image and an ending image, provide the starting image as a `media` part in the `prompt` and the ending image in the `lastFrame` config parameter.


```typescript
const firstImage = fs.readFileSync('first.jpg', { encoding: 'base64' });
const lastImage = fs.readFileSync('last.jpg', { encoding: 'base64' });

let { operation } = await ai.generate({
model: googleAI.model('veo-3.1-generate-preview'),
prompt: [
{ text: 'A ghostly woman swinging gently on a rope swing beneath a massive tree fades away, vanishing completely.' },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if this example fed into the extending one...

{
media: {
contentType: 'image/jpeg',
url: `data:image/jpeg;base64,${firstImage}`,
},
},
],
config: {
lastFrame: {
contentType: 'image/jpeg',
url: `data:image/jpeg;base64,${lastImage}`,
},
},
});
```

#### Extending Veo Videos

Veo 3.1 can extend videos that were previously generated with Veo by 7 seconds. Provide the `video` object from a previous generation to the `video` configuration parameter.

```typescript
// Assume 'previousOperation' is an operation from a previous Veo generation
const previousVideo = previousOperation.output?.message?.content.find((p) => !!p.media);

let { operation } = await ai.generate({
model: googleAI.model('veo-3.1-generate-preview'),
prompt: 'Track the butterfly into the garden as it lands on an orange origami flower.',
config: {
video: previousVideo.media,
resolution: '720p',
},
});
```

#### Using Reference Images

Veo 3.1 can use up to 3 reference images to guide the appearance of a person, character, or product in the generated video.

```typescript
const personImage = fs.readFileSync('person.jpg', { encoding: 'base64' });
const dressImage = fs.readFileSync('dress.jpg', { encoding: 'base64' });

let { operation } = await ai.generate({
model: googleAI.model('veo-3.1-generate-preview'),
prompt: 'A woman in a magnificent flamingo dress walks through a sun-drenched lagoon.',
config: {
referenceImages: [
{
media: {
contentType: 'image/jpeg',
url: `data:image/jpeg;base64,${personImage}`,
},
referenceType: 'asset',
},
{
media: {
contentType: 'image/jpeg',
url: `data:image/jpeg;base64,${dressImage}`,
},
referenceType: 'asset',
},
],
},
});
```

The Veo models support various configuration options:

- **negativePrompt** _string_
Expand Down Expand Up @@ -782,14 +862,25 @@ The Veo models support various configuration options:
- `2`: Supported in Veo 2 only.

- **durationSeconds** _number_ (Veo 2 only)

Length of each output video in seconds (5 to 8). Not configurable for Veo 3.1/3.0 (defaults to 8 seconds).
- **durationSeconds** _number_
Comment on lines 864 to +865
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There appears to be a duplicated entry for durationSeconds. The version-specific entry on line 864 is redundant as the new, more detailed entry starting on line 865 covers all cases. I recommend removing the old entry to avoid confusion.

- **durationSeconds** _number_

Length of each output video in seconds.
- **Veo 3.1 / 3.0**: Defaults to `8` seconds. Must be `8` when using extension, reference images, 1080p, or 4k resolutions.
- **Veo 2.0**: `5` to `8` seconds.

- **resolution** _string_ (Veo 3.1 only)

Resolution of the generated video.
- `"720p"` (default)
- `"1080p"` (Available for 16:9 aspect ratio)
- `"1080p"` (Available for 8s duration)
- `"4k"` (Available for 8s duration)

- **video** _object_ (Veo 3.1 only)

A video object from a previous generation to be extended.

- **lastFrame** _object_ (Veo 3.1 only)

An image object to use as the final frame for interpolation.

- **seed** _number_ (Veo 3.1/3.0 only)

Expand All @@ -798,6 +889,8 @@ The Veo models support various configuration options:
- **referenceImages** _object[]_ (Veo 3.1 only)

Provides up to 3 reference images to guide the video's content or style.
- **media** _object_: The image to use as reference.
- **referenceType** _string_: The type of reference (e.g., `'asset'`).

- **enhancePrompt** _boolean_ (Veo 2 only)

Expand Down