Generate videos with Veo on Vertex AI from an image Stay organized with collections Save and categorize content based on your preferences.
You can use Veo on Vertex AI to generate new videos from an image and text prompt.Supported interfaces include the Google Cloud console and the Vertex AIAPI.
For more information about writing effective text prompts for video generation,see theVeo promptguide.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
Enable the Vertex AI API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission.Learn how to grant roles.In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- Create a project: To create a project, you need the Project Creator role (
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission.Learn how to grant roles.
Enable the Vertex AI API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission.Learn how to grant roles.Set up authentication for your environment.
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
REST
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:
gcloudinit
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, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Generate videos from an image
| Sample input | Sample output |
|---|---|
| ![]() |
1 Image generated using Imagen on Vertex AI from the prompt:A Crochetelephant in intricate patterns walking on the savanna
You can generate novel videos using only an image as an input, or and image anddescriptive text as the inputs. The following samples show you basicinstructions to generate videos from image and text.
In the Google Cloud console, go to theVertex AI Studio> MediaStudio page. ClickVideo. Optional: In theSettings pane, configure the following settings: Model: choose a model from the available options. Aspect ratio: choose either16:9 or9:16. Number of results: adjust the slider or enter a value between1and4. Video length: select the desired video length from the menu. Output directory: clickBrowse to create or select aCloud Storage bucket to store output files. Optional: In theSafety section, select one of the followingPersongeneration settings: Allow (Adults only): default value. Generate adult people or facesonly. Don't generate youth or children people or faces. Don't allow: don't generate people or faces. Optional: In theAdvanced options section, enter aSeed value forrandomizing video generation. In theWrite your prompt prompt box, click Choose a local image to upload and clickSelect. In theWrite your prompt box, enter your text prompt that describes thevideos to generate. ClickGenerate. To learn more, see the SDK reference documentation. Set environment variables to use the Gen AI SDK with Vertex AI:Console
Python
Install
pip install --upgrade google-genai
# Replace the `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` values# with appropriate values for your project.exportGOOGLE_CLOUD_PROJECT=GOOGLE_CLOUD_PROJECTexportGOOGLE_CLOUD_LOCATION=globalexportGOOGLE_GENAI_USE_VERTEXAI=True
importtimefromgoogleimportgenaifromgoogle.genai.typesimportGenerateVideosConfig,Imageclient=genai.Client()# TODO(developer): Update and un-comment below line# output_gcs_uri = "gs://your-bucket/your-prefix"operation=client.models.generate_videos(model="veo-3.1-generate-001",prompt="Extreme close-up of a cluster of vibrant wildflowers swaying gently in a sun-drenched meadow.",image=Image(gcs_uri="gs://cloud-samples-data/generative-ai/image/flowers.png",mime_type="image/png",),config=GenerateVideosConfig(aspect_ratio="16:9",output_gcs_uri=output_gcs_uri,),)whilenotoperation.done:time.sleep(15)operation=client.operations.get(operation)print(operation)ifoperation.response:print(operation.result.generated_videos[0].video.uri)# Example response:# gs://your-bucket/your-prefixREST
After youset 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 theVeo on Vertex AIAPI.
Use the following command to send a video generation request. Thisrequest begins a long-running operation and stores output to aCloud Storage bucket you specify.
Before using any of the request data, make the following replacements:
PROJECT_ID: A string representing your Google Cloud project ID.MODEL_ID: A string respresenting the model ID to use. The following are accepted values:- Veo 2:
veo-2.0-generate-001 - Veo 3:
veo-3.0-generate-001 - Veo 3.1:
veo-3.1-generate-001 - Veo 3.1:
veo-3.1-fast-generate-001
- Veo 2:
TEXT_PROMPT: The text prompt used to guide video generation.INPUT_IMAGE: A base64-encoded string that represents the input image. For best quality, we recommend that the input image's resolution be 720p (1280 x 720 pixels) or higher, and have an aspect ratio of either 16:9 or 9:16. Images of other aspect ratios or sizes may be resized or centrally cropped when the image is uploaded.MIME_TYPE: A string representing the MIME type of the input image. Only the images of the following MIME types are supported:"image/jpeg""image/png"
OUTPUT_STORAGE_URI: Optional: A string representing the Cloud Storage bucket to store the output videos. If not provided, video bytes are returned in the response. For example:"gs://video-bucket/output/".RESIZE_MODE: A string that represents the resize mode to use. The following are accepted values:"crop": Crop the video to fit the new size."pad": Pad the video to fit the new size.
RESPONSE_COUNT: The number of video files to generate. The accepted range of values is1-4.DURATION: An integer representing the length of the generated video files. The following are the accepted values for each model:- Veo 2 models:
5-8. The default is8. - Veo 3 models:
4,6, or8. The default is8.
- Veo 2 models:
Additional optional parameters
Use the following optional variables depending on your use case. Add some or all of the following parameters in the
"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
The default value is
"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.
The default value is
"allow_adult".RESOLUTION: Optional: A string value that controls the resolution of the generated video. Supported byVeo 3 models only. You can use the following values:"720p""1080p"
The default value is
"720p".RESPONSE_COUNT: Optional. An integer value that describes the number of videos to generate. The accepted range of values is1-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 is0-4294967295.
HTTP method and URL:
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:predictLongRunning
Request JSON body:
{ "instances": [ { "prompt": "TEXT_PROMPT", "image": { "bytesBase64Encoded": "INPUT_IMAGE", "mimeType": "MIME_TYPE" } } ], "parameters": { "storageUri": "OUTPUT_STORAGE_URI", "sampleCount":RESPONSE_COUNT "resizeMode": "RESIZE_MODE" }}To send your request, choose one of these options:
This request returns a full operation name with a unique operation ID. Use thisfull operation name to poll that status of the video generation request.curl
Note: The following command assumes that you have logged in to thegcloudCLI with your user account by runninggcloud initorgcloud auth login, or by usingCloud Shell, which automatically logs you into thegcloudCLI . You can check the currently active account by runninggcloud auth list.Save the request body in a file named
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:predictLongRunning"PowerShell
Note: The following command assumes that you have logged in to thegcloudCLI with your user account by runninggcloud initorgcloud auth login. You can check the currently active account by runninggcloud auth list.Save the request body in a file named
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:predictLongRunning" | Select-Object -Expand Content{ "name": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/a1b07c8e-7b5a-4aba-bb34-3e1ccb8afcc8"}Optional: Check the status of the video generation long-runningoperation.
Before using any of the request data, make the following replacements:
- PROJECT_ID: Your Google Cloudproject ID.
- MODEL_ID: The model ID to use.
- OPERATION_ID: The unique operation ID returned in the original generate video request.
HTTP method and URL:
POST https://us-central1-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID:fetchPredictOperation
Request JSON body:
{ "operationName": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID"}To send your request, choose one of these options:
This request returns information about the operation, including if the operation is still runningor is done.curl
Note: The following command assumes that you have logged in to thegcloudCLI with your user account by runninggcloud initorgcloud auth login, or by usingCloud Shell, which automatically logs you into thegcloudCLI . You can check the currently active account by runninggcloud auth list.Save the request body in a file named
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
Note: The following command assumes that you have logged in to thegcloudCLI with your user account by runninggcloud initorgcloud auth login. You can check the currently active account by runninggcloud auth list.Save the request body in a file named
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 ContentResponse
{ "name": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID", "done": true, "response": { "raiMediaFilteredCount": 0, "@type": "type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse", "videos": [ { "gcsUri":"gs://BUCKET_NAME/TIMESTAMPED_FOLDER/sample_0.mp4", "mimeType": "video/mp4" } ] }}
What's next
Generate videos with Veo on Vertex AI using first and last videoframes
Understand responsible AI and usage guidelines forVeo on Vertex AI
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.

