You can generate Veo on Vertex AI videos by specifying the first and last frames of
the video. Supported interfaces include the Google Cloud console and the
Vertex AI API. For more information about writing effective text prompts for video generation,
see the Veo prompt
guide. In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Enable the Vertex AI API.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Enable the Vertex AI API.
Set up authentication for your environment. Select the tab for how you plan to use the samples on this page:
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
To use the REST API samples on this page in a local development environment, you use the
credentials you provide to the gcloud CLI.
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
If you're using an external identity provider (IdP), you must first
sign in to the gcloud CLI with your federated identity.
For more information, see
Authenticate for using REST
in the Google Cloud authentication documentation.
The following examples show how you can specify the first and last frames of
a Veo video: In the Google Cloud console, go to the Vertex AI > Media Studio
page. Click Video. The Video Media Studio page is displayed. In the Settings pane, configure the following settings: In the Write your prompt prompt box, click Add ending frame (Optional) is displayed next to the uploaded image. Optional: Add an end frame by clicking Add ending frame. In the
displayed dialog, select an image for the last frame. In the Write your prompt box, enter your text prompt that describes the
videos to generate. Click
To learn more, see the
SDK reference documentation.
Set environment variables to use the Gen AI SDK with Vertex AI:
After you
set up your environment,
you can use REST to test a text prompt. The following sample sends a request to the publisher
model endpoint.
For more information about the Veo API, see the Veo on Vertex AI
API. Use the following command to send a video generation request. This
request begins a long-running operation and stores output to a
Cloud Storage bucket you specify.
Before using any of the request data,
make the following replacements:
Additional optional parameters Use the following optional variables depending on your use
case. Add some or all of the following parameters in the The default value is The default value is The default value is
HTTP method and URL:
Request JSON body:
To send your request, choose one of these options:
Save the request body in a file named
Save the request body in a file named Optional: Check the status of the video generation long-running
operation.
Before using any of the request data,
make the following replacements:
HTTP method and URL:
Request JSON body:
To send your request, choose one of these options:
Save the request body in a file named
Save the request body in a file named Before you begin
Console
REST
gcloud init
Create a video from first and last frames
Console
veo-2.0-generate-001
.Python
Install
pip install --upgrade google-genai
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values
# with appropriate values for your project.
export GOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECT
export GOOGLE_CLOUD_LOCATION=global
export GOOGLE_GENAI_USE_VERTEXAI=True
REST
image/jpeg
image/png
gs://video-bucket/output/
.
"parameters": {}
object.
"parameters": {
"aspectRatio": "ASPECT_RATIO",
"negativePrompt": "NEGATIVE_PROMPT",
"personGeneration": "PERSON_SAFETY_SETTING",
// "resolution": RESOLUTION, // Veo 3 models only
"sampleCount": RESPONSE_COUNT,
"seed": SEED_NUMBER
}
ASPECT_RATIO
:
Optional: A string value that describes the aspect ratio of the generated
videos. You can use the following values:
"16:9"
for landscape"9:16"
for portrait"16:9"
NEGATIVE_PROMPT
: Optional: A string
value that describes content that you want to prevent the model from
generating.
PERSON_SAFETY_SETTING
:
Optional: A string value that controls the safety setting for generating
people or face generation. You can use the following values:
"allow_adult"
: Only allow generation of adult people and
faces.
"disallow"
: Doesn't generate people or faces.
"allow_adult"
.RESOLUTION
:
Optional: A string value that controls the resolution of the generated
video. Supported by Veo 3 models only. You can use the following
values:
"720p"
"1080p"
"720p"
.RESPONSE_COUNT
:
Optional. An integer value that describes the number of videos to generate.
The accepted range of values is 1
-4
.
SEED_NUMBER
:
Optional. An uint32 value that the model uses to generate deterministic
videos. Specifying a seed number with your request without changing other
parameters guides the model to produce the same videos. The accepted range
of values is 0
-4294967295
.
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-001:predictLongRunning
{
"instances": [
{
"prompt": "TEXT_PROMPT",
"image": {
"gcsUri": "PATH_TO_FIRST_FRAME_IMAGE,
"mimeType": "IMAGE_MIME_TYPE"
},
"lastFrame:" {
"gcsUri": "PATH_TO_LAST_FRAME_IMAGE,
"mimeType": "IMAGE_MIME_TYPE"
}
}
],
"parameters": {
"storageUri": "OUTPUT_STORAGE_URI",
"sampleCount": RESPONSE_COUNT
}
}
curl
request.json
,
and execute the following command:
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/veo-2.0-generate-001:predictLongRunning"PowerShell
request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-001:predictLongRunning" | Select-Object -Expand Content
{
"name": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/veo-2.0-generate-001/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8"
}
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation
{
"operationName": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID"
}
curl
request.json
,
and execute the following command:
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:fetchPredictOperation"PowerShell
request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation" | Select-Object -Expand ContentWhat's next
Generate videos from the first and last frames
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.