Video API documentation

Generate Veo 3.1 videos from your own code: authenticate with an API key, submit a job, then poll for the result.

Quick Start

LLM Integration Guide

1. Get Your API Key

First, you need an API key to authenticate your requests:

Get API Key

2. Generate Your First Video

Make a POST request to generate a video:

curl -X POST https://api.veo3gen.app/api/generate \
  -H "Authorization: Bearer veo_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo3-fast",
    "modelVersion": "3.1",
    "prompt": "A majestic eagle soaring over snow-capped mountains",
    "audio": true,
    "options": {
      "aspectRatio": "9:16",
      "resolution": "1080p"
    }
  }'

Response:

{
  "success": true,
  "taskId": "veo_1704067200000_abc123",
  "status": "pending",
  "model": "veo3-fast",
  "creditsRequired": 10,
  "resolution": "1080p",
  "estimatedTime": "1-3 minutes"
}

3. Check Generation Status

Use the taskId to check your video's progress:

curl -H "Authorization: Bearer veo_your_api_key_here" \
  https://api.veo3gen.app/api/status/veo_1704067200000_abc123

Authentication

The API supports three authentication methods:

1. Authorization Header (Recommended)

Authorization: Bearer veo_your_api_key_here

2. X-API-Key Header

X-API-Key: veo_your_api_key_here

3. Query Parameter (Not recommended)

?api_key=veo_your_api_key_here

API Endpoints

POST /api/generate

Generate a new video

Parameter Type Required Description
model string Yes "veo3-fast", "veo3-quality" or "veo3-lite"
prompt string Yes Video description (max 2000 chars)
audio boolean No Generate audio (default: true)
modelVersion string No "3.1" (default). Legacy 3.0 requests are automatically upgraded to 3.1.
image object No Input image for image-to-video generation
lastFrame object No Last frame for first-and-last-frame (requires veo3-fast/quality 3.1, or veo3-lite)

Models

Options Object:

Parameter Type Default Description
resolution string "1080p" "720p", "1080p", or "4k" — 4K requires modelVersion "3.1" + veo3-fast/quality; Lite max 1080p
aspectRatio string "16:9" "16:9" or "9:16"
seed number Random 0-4294967295 for deterministic results
negativePrompt string - What to avoid in the video
enhancePrompt boolean true AI prompt enhancement

GET /api/status/:taskId

Check the status of a video generation task

Completed Response:

{
  "success": true,
  "taskId": "veo_1704067200000_xyz789",
  "status": "completed",
  "result": {
                        "videoUrl": "https://storage.googleapis.com/veo3videosave/video_xyz789.mp4",
                    "duration": 8,
                    "resolution": "1080p",
                    "aspectRatio": "9:16",
                    "hasAudio": true,
    "processingTimeSeconds": 187
  },
  "credits": {
    "required": 30,
    "charged": 30,
    "refunded": 0
  }
}

GET /api/logs

Retrieve your generation history with filtering and pagination

Parameter Type Description
page number Page number (default: 1)
limit number Items per page (max: 100, default: 20)
status string Filter by status
model string Filter by model

🖼️ Image-to-Video Generation

Generate videos from an input image. Works with all active Veo 3.1 Quality, Fast, and Lite models. Perfect for bringing static images to life with motion and animation.

Key Features

Request Format

POST /api/generate

{
  "model": "veo3-quality",
  "modelVersion": "3.1",
  "prompt": "A serene lake with gentle waves and birds flying overhead",
  "audio": true,
  "image": {
    "bytesBase64Encoded": "base64_encoded_image_data_here",
    "mimeType": "image/jpeg"
  },
  "options": {
    "resolution": "1080p",
    "aspectRatio": "16:9"
  }
}

Image Object Parameters

Parameter Type Required Description
bytesBase64Encoded string Yes Base64-encoded image data
mimeType string Yes "image/jpeg", "image/png", or "image/webp"

💰 Pricing: Image-to-video uses the same credit pricing as text-to-video. No additional cost for using images!

💡 Tip: The prompt is optional for image-to-video, but providing one gives you better control over the motion and animation style.

🎞️ First-and-Last-Frame Generation

Generate a video that smoothly transitions between two images (first and last frame). Requires Veo 3.1 models. Perfect for creating transformations, before/after sequences, and precise video keyframing.

Key Features

Request Format

POST /api/generate

{
  "model": "veo3-quality",
  "modelVersion": "3.1",  // REQUIRED for first-and-last-frame
  "prompt": "A smooth cinematic transition from sunrise to sunset",
  "audio": true,
  "image": {
    "bytesBase64Encoded": "base64_encoded_first_frame_here",
    "mimeType": "image/jpeg"
  },
  "lastFrame": {
    "bytesBase64Encoded": "base64_encoded_last_frame_here",
    "mimeType": "image/jpeg"
  },
  "options": {
    "resolution": "1080p",
    "aspectRatio": "16:9"
  }
}

Parameters

Parameter Type Required Description
modelVersion string Yes Must be "3.1" for this feature
image object Yes First frame image object
lastFrame object Yes Last frame image object

Important: First-and-last-frame generation uses Veo 3.1 models. Legacy 3.0 requests are automatically upgraded to 3.1.

✨ Pro Tip: Use descriptive prompts to guide the transition between frames. For example: "smooth transformation" or "dramatic cinematic transition".

Error Handling

Common Error Types

Error Type HTTP Code Description Retryable
INVALID_API_KEY 401 API key is invalid or inactive ❌ No
INSUFFICIENT_CREDITS 400 Not enough credits for generation ❌ No
RATE_LIMIT_EXCEEDED 429 Too many requests ✅ Yes
CONTENT_POLICY_VIOLATION 400 Content blocked by AI safety ❌ No
SYSTEM_ERROR 500 Internal server error ✅ Yes

Error Response Format

{
  "success": false,
  "error": "User-friendly error message",
  "errorType": "ERROR_TYPE_CONSTANT",
  "details": {
    "field": "specific field that caused the error"
  }
}

Retry Strategy Example:

async function retryableRequest(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      const isRetryable = [
        'RATE_LIMIT_EXCEEDED',
        'QUOTA_EXCEEDED', 
        'SYSTEM_ERROR'
      ].includes(error.errorType);

      if (!isRetryable || i === maxRetries - 1) {
        throw error;
      }

      // Exponential backoff
      const delay = Math.min(1000 * Math.pow(2, i), 30000);
      await new Promise(resolve => setTimeout(resolve, delay));
    }
  }
}

Code Examples

const axios = require('axios');

class VideoClient {
  constructor(apiKey, baseURL = 'https://api.veo3gen.app') {
    this.apiKey = apiKey;
    this.baseURL = baseURL;
    this.client = axios.create({
      baseURL,
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    });
  }

  async generateVideo(prompt, options = {}) {
    try {
      console.log('Starting video generation...');
      console.log(`Prompt: ${prompt}`);
      console.log(`Model: ${options.model || 'veo3-fast'}`);

      const response = await this.client.post('/api/generate', {
        model: options.model || 'veo3-fast',
        prompt,
        audio: options.audio !== false,
        options: {
          resolution: options.resolution || '720p',
          aspectRatio: options.aspectRatio || '16:9', // '16:9' or '9:16'
          ...options.veo3Options
        }
      });

      console.log(`Generation started with task ID: ${response.data.taskId}`);
      return response.data;
    } catch (error) {
      console.error('Generation request failed:', error.message);
      throw new Error(`Generation failed: ${error.response?.data?.error || error.message}`);
    }
  }

  async pollStatus(taskId, maxWaitTime = 300000) {
    const startTime = Date.now();
    console.log(`Starting to poll status for task: ${taskId}`);

    while (Date.now() - startTime < maxWaitTime) {
      try {
        const response = await this.client.get(`/api/status/${taskId}`);
        const status = response.data;

        console.log(`Status check: ${status.status}`);

        if (status.status === 'completed') {
          console.log('Video generation completed successfully!');
          return status;
        } else if (status.status === 'failed') {
          console.log('Video generation failed');
          throw new Error(status.error.message);
        }

        console.log('Video still processing, waiting 10 seconds...');
        // Wait 10 seconds before next poll
        await new Promise(resolve => setTimeout(resolve, 10000));
      } catch (error) {
        console.error('Error during status check:', error.message);
        throw new Error(`Status check failed: ${error.response?.data?.error || error.message}`);
      }
    }

    console.log('Video generation timed out');
    throw new Error('Video generation timed out');
  }

  async generateAndWait(prompt, options = {}) {
    const generation = await this.generateVideo(prompt, options);
    const result = await this.pollStatus(generation.taskId, options.maxWaitTime);
    return result;
  }
}

// Usage
const client = new VideoClient('veo_your_api_key_here');

async function example() {
  try {
          const result = await client.generateAndWait(
        'A majestic eagle soaring over mountains',
        {
          model: 'veo3-quality',
          audio: true,
          resolution: '1080p',
          aspectRatio: '9:16'  // Portrait video
        }
      );

    console.log('Video generated!', result.result.videoUrl);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

example();

Best Practices

API Key Management

Rate Limiting

Error Handling

Cost Optimization

Pricing & Credits

Credit Pricing — Resolution-Aware

Each request is charged a fixed number of credits, set by model, options.resolution, audio and options.duration (4, 6, 8 seconds; default 8). At current list prices one credit costs $0.213 (Studio subscription) to $0.250 (Basic Pack), so the dollar range under each price is credits × that range, before taxes. Promotional and free credits are not included.

Model Resolution Audio 4 seconds 6 seconds 8 seconds Time
veo3-lite 720p No audio 1 credit$0.21–$0.25$0.053–$0.062/s 2 credits$0.43–$0.50$0.071–$0.083/s 2 credits$0.43–$0.50$0.053–$0.062/s 1-2 min
veo3-lite 720p With audio 2 credits$0.43–$0.50$0.107–$0.125/s 3 credits$0.64–$0.75$0.107–$0.125/s 3 credits$0.64–$0.75$0.080–$0.094/s 1-2 min
veo3-lite 1080p No audio 2 credits$0.43–$0.50$0.107–$0.125/s 3 credits$0.64–$0.75$0.107–$0.125/s 3 credits$0.64–$0.75$0.080–$0.094/s 1-2 min
veo3-lite 1080p With audio 3 credits$0.64–$0.75$0.160–$0.187/s 4 credits$0.85–$1.00$0.142–$0.167/s 5 credits$1.07–$1.25$0.133–$0.156/s 1-2 min
veo3-fast 720p No audio 3 credits$0.64–$0.75$0.160–$0.187/s 5 credits$1.07–$1.25$0.178–$0.208/s 6 credits$1.28–$1.50$0.160–$0.187/s 1-3 min
veo3-fast 720p With audio 5 credits$1.07–$1.25$0.267–$0.312/s 8 credits$1.71–$2.00$0.284–$0.333/s 10 credits$2.13–$2.50$0.267–$0.312/s 1-3 min
veo3-fast 1080p No audio 3 credits$0.64–$0.75$0.160–$0.187/s 5 credits$1.07–$1.25$0.178–$0.208/s 6 credits$1.28–$1.50$0.160–$0.187/s 1-3 min
veo3-fast 1080p With audio 5 credits$1.07–$1.25$0.267–$0.312/s 8 credits$1.71–$2.00$0.284–$0.333/s 10 credits$2.13–$2.50$0.267–$0.312/s 1-3 min
veo3-fast 4K (3.1 only) No audio 10 credits$2.13–$2.50$0.533–$0.624/s 15 credits$3.20–$3.75$0.533–$0.624/s 19 credits$4.05–$4.75$0.507–$0.593/s 1-3 min
veo3-fast 4K (3.1 only) With audio 11 credits$2.35–$2.75$0.587–$0.687/s 17 credits$3.63–$4.25$0.604–$0.708/s 22 credits$4.69–$5.49$0.587–$0.687/s 1-3 min
veo3-quality 720p No audio 7 credits$1.49–$1.75$0.373–$0.437/s 10 credits$2.13–$2.50$0.356–$0.416/s 13 credits$2.77–$3.25$0.347–$0.406/s 2-5 min
veo3-quality 720p With audio 13 credits$2.77–$3.25$0.693–$0.812/s 20 credits$4.27–$5.00$0.711–$0.833/s 26 credits$5.55–$6.49$0.693–$0.812/s 2-5 min
veo3-quality 1080p No audio 7 credits$1.49–$1.75$0.373–$0.437/s 10 credits$2.13–$2.50$0.356–$0.416/s 13 credits$2.77–$3.25$0.347–$0.406/s 2-5 min
veo3-quality 1080p With audio 13 credits$2.77–$3.25$0.693–$0.812/s 20 credits$4.27–$5.00$0.711–$0.833/s 26 credits$5.55–$6.49$0.693–$0.812/s 2-5 min
veo3-quality 4K (3.1 only) No audio 13 credits$2.77–$3.25$0.693–$0.812/s 20 credits$4.27–$5.00$0.711–$0.833/s 26 credits$5.55–$6.49$0.693–$0.812/s 2-5 min
veo3-quality 4K (3.1 only) With audio 19 credits$4.05–$4.75$1.013–$1.186/s 29 credits$6.19–$7.24$1.031–$1.207/s 38 credits$8.11–$9.49$1.013–$1.186/s 2-5 min

Per-second prices: the API does not bill by the second. A per-second figure is a generation's dollar cost divided by its length, shown on the second line under each price. For example, veo3-fast at 1080p with audio for 8 seconds costs 10 credits: $2.13–$2.50, or $0.267–$0.312 per second. The credit price in this table is what your API key is charged.

🆕 Veo 3.1 Lite: Lowest credit use — from 1 credit. Limited to 720p/1080p and no 4K. Set model: "veo3-lite".

✨ 4K Resolution: Available for veo3-fast/quality with modelVersion: "3.1". Set options.resolution: "4k". Not supported by veo3-lite.

💰 All generation types (text-to-video, image-to-video, first-and-last-frame) cost the same credits. No extra charge for image inputs!

Models

Rate Limits

Generation Requests

100/hour

Per API key

Status Checks

1000/hour

Per API key

Ready to Start?

Get your API key and start generating videos with free welcome credits

Get API KeyLLM Guide