Veo offers an LLM-based prompt enhancement tool, also known as a prompt rewriter. The prompt rewriter offers the option to rewrite your prompts to add video description, camera motions, transcription, and sound effects to your prompt. More detailed prompts result in higher quality videos.
If you disable prompt enhancement, the quality of the videos and how well the output resembles the prompt that you supplied may be impacted. This feature is enabled by default for the following model versions:
veo-2.0-generate-001
veo-3.0-generate-preview
(Preview)
A rewritten prompt is delivered by API response only if the original prompt is fewer than 30 words long.
For more information about writing effective text prompts for video generation, see the Veo prompt guide.
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.
-
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:
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.
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
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.
Turn off prompt rewriter
To turn prompt enhancement off, do the following:
Console
In the Google Cloud console, go to the Vertex AI Studio > Media Studio page.
Click Veo.
In Settings, click the Enable prompt enhancement toggle.
In the Write your prompt box, enter your prompt and then click
Generate
REST
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:
- PROJECT_ID: Your Google Cloud project ID.
- MODEL_ID: The model ID to use. Available values:
veo-2.0-generate-001
(GA allowlist)veo-3.0-generate-preview
(Preview)
- TEXT_PROMPT: The text prompt used to guide video generation.
-
OUTPUT_STORAGE_URI: Optional: 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/
. - RESPONSE_COUNT: The number of video files you want to generate. Accepted integer values: 1-4.
- DURATION: The length of video files that you want to generate. Accepted integer values are 5-8.
-
ENHANCED_PROMPT: Whether to use enhanced prompts or not. You can use one of
the following:
-
True
: (default) use Gemini to enhance your prompts. -
False
: don't use Gemini to enhance your prompts.
-
-
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", "sampleCount": RESPONSE_COUNT, "seed": SEED_NUMBER }
- ASPECT_RATIO: string. Optional. Defines the aspect ratio of the generated
videos. Values:
16:9
(default, landscape) or9:16
(portrait). - NEGATIVE_PROMPT: string. Optional. A text string that describes what you want to discourage the model from generating.
- PERSON_SAFETY_SETTING: string. Optional. The safety setting that controls
whether people or face generation is allowed. Values:
allow_adult
(default value): Allow generation of adults only.disallow
: Disallows inclusion of people or faces in images.
- RESPONSE_COUNT: int. Optional. The number of output images requested. Values:
1
-4
. - SEED_NUMBER: uint32. Optional. A number to make generated videos deterministic.
Specifying a seed number with your request without changing other parameters guides the
model to produce the same videos. Values:
0
-4294967295
.
- ASPECT_RATIO: string. Optional. Defines the aspect ratio of the generated
videos. Values:
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" } ], "parameters": { "storageUri": "OUTPUT_STORAGE_URI", "sampleCount": "RESPONSE_COUNT", "durationSeconds": "DURATION", "enhancePrompt": ENHANCED_PROMPT } }
To send your request, choose one of these options:
curl
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
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" }
What's next
- Generate videos from text
- Generate videos from an image
- Learn more about prompts
- Understand responsible AI and usage guidelines for Veo on Vertex AI