Skip to content

Video Generation API

POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/veo/videos/generate

Text/Image to Video Input Parameters Example:

curl --location 'https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/veo/videos/generate' \
--header 'Authorization: Bearer {ak}' \
--header 'Content-Type: application/json' \
--data '{
    "instances": [
        {
            "prompt": "After aliens use magic, the Shanghai Oriental Pearl Tower turns into a small toy"
        }
    ],
    "parameters": {
        "durationSeconds": 8,
        "generateAudio": false,
        "negativePrompt": "Avoid dark and gloomy scenes.",
        "sampleCount": 2
    }
}'

Complete Parameter Example

{
        "instances": [{
                "prompt": string,
                "image": {
                        // Union field can be only one of the following:
                        "bytesBase64Encoded": string,
                        "gcsUri": string,
                        // End of list of possible types for union field.
                        "mimeType": string
                }
        }],
        "parameters": {
                "aspectRatio": string,
                "durationSeconds": integer,
                "enhancePrompt": boolean,
                "generateAudio": boolean,
                "negativePrompt": string,
                "personGeneration": string,
                "resolution": string, // Veo 3 models only
                "sampleCount": integer,
                "seed": uint32,
                "storageUri": string
        }
}

Return Value Example

{
    "name": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID"
}

Request Parameters

Objects in instances

Attribute Name Type Required/Optional Description
prompt string Required for text-to-video function.

Optional if an input image prompt is provided (to convert an image to a video).
A text string used to guide the first eight seconds of the video. For example:

- Quick tracking shot: depicts a bustling dystopian world under bright neon lights, flying cars and fog, night, halos, volumetric lighting

- Neon holograms of cars traveling at the speed of light, cinematic shots, incredible details, volumetric lighting

- Many spotted jellyfish pulsating underwater. Their bodies are transparent and glow in the deep sea

- Extreme close-up of shallow depth-of-field puddles on the street. Reflecting a futuristic Tokyo city, bright neon lights, night, with halos

- Time-lapse photography of dancing auroras in the Arctic sky, twinkling stars, snow-covered landscapes

- A lone cowboy riding a horse across an open plain under a beautiful sunset, soft light, warm colors
image Media Optional Optional. An image used to guide video generation, which can be a bytesBase64Encoded string of the encoded image or a gcsUri string URI of the Cloud Storage bucket location.

The following models support image-to-video:

- MaaS_veo_3_generate_preview

Media Object

Attribute Name Type Description
bytesBase64Encoded string Base64-encoded string of the bytes of an image or video file.
gcsUri string String URI pointing to the Cloud Storage bucket location.
mimeType string Required for the following objects: image, video, lastFrame. Specifies the MIME type of the video or image.

For images: The system accepts the following MIME types:

- image/jpeg

- image/png


For videos: The system accepts the following MIME types:

- video/mp4

Parameters Object

Attribute Name Type Required/Optional Description
aspectRatio string Optional Specifies the aspect ratio of the generated video. Acceptable values are 16:9 (default) or 9:16 (not supported by MaaS_veo_3_generate_preview).
durationSeconds integer Required The duration of the video file to be generated:

- MaaS_veo_3_generate_preview: 8 seconds.
enhancePrompt boolean Optional Optimize the prompt using Gemini. Acceptable values are true or false (default is true). Veo3 cannot disable this.
generateAudio boolean Required (only for MaaS_veo_3_generate_preview)

See description for details
Required parameter for MaaS_veo_3_generate_preview. Generate audio for the video. Acceptable values are true or false.
negativePrompt string Optional A text string describing what you want to prevent the model from generating. For example:

- Top lighting, bright colors

- People, animals

- Multiple cars, wind
personGeneration string Optional Safety setting to control whether person or face generation is allowed:

- allow_adult (default): only allow generation of adults

- dont_allow: prohibit including people/faces in images
resolution string Optional The resolution of the generated video. Acceptable values are 720p (default) or 1080p.
sampleCount int Optional The number of output videos requested. Acceptable values are 1-4.
seed uint32 Optional A number used to generate deterministic videos (seed value). The range is 0-4,294,967,295.
storageUri string Optional Cloud Storage bucket URI for storing output videos, in the format gs://BUCKET_NAME/SUBDIRECTORY. If not provided, video bytes encoded in Base64 will be returned.

Task Query API

POST https://genaiapi.cloudsway.net/v1/ai/{endpointPath}/veo/videos/task

Input Parameters Example

curl --location 'https://genaiapi.cloudsway.net/v1/ai/{}endpointPath/veo/videos/task' \
--header 'Authorization: Bearer {ak}' \
--header 'Content-Type: application/json' \
--data '{
    "operationName": "projects/ku4bvh-veo/locations/us-central1/publishers/google/models/veo-3.0-generate-001/operations/54fefa07-3efa-40dc-92c6-427390c91689"
}'
{
  "operationName": "projects/PROJECT_ID/locations/us-central1/publishers/google/models/MODEL_ID/operations/OPERATION_ID"
}

Return Value Example

{   "name": string,   "done": boolean,   "response":{      "@type":"type.googleapis.com/cloud.ai.large_models.vision.GenerateVideoResponse",      "raiMediaFilteredCount": integer,      "videos":[         {           "gcsUri": string,           "mimeType": string         },         {           "gcsUri": string,           "mimeType": string         },         {           "gcsUri": string,           "mimeType": string         },         {           "gcsUri": string,           "mimeType": string         },      ]   }}