1. Get Your API Key

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

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

ParameterTypeRequiredDescription
modelstringYes"veo3-fast" or "veo3-quality"quot;veo3-fast"veo3-fast" or "veo3-quality"quot;, "veo3-fast" or "veo3-quality"quot;veo3-quality"veo3-fast" or "veo3-quality"quot;, or "veo3-fast" or "veo3-quality"quot;veo3-lite"veo3-fast" or "veo3-quality"quot;
promptstringYesVideo description (max 2000 chars)
audiobooleanNoGenerate audio (default: true)
modelVersionstringNo"3.1" (default). Legacy 3.0 requests are automatically upgraded to 3.1.
imageobjectNoInput image for image-to-video generation
lastFrameobjectNoLast frame for first-and-last-frame (requires veo3-fast/quality 3.1, or veo3-lite)

Options Object:

ParameterTypeDefaultDescription
resolutionstring"1080p""720p", "1080p", or "4k" — 4K requires modelVersion "3.1" + veo3-fast/quality; Lite max 1080p
aspectRatiostring"16:9""16:9" or "9:16"
seednumberRandom0-4294967295 for deterministic results
negativePromptstring-What to avoid in the video
enhancePromptbooleantrueAI 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

ParameterTypeDescription
pagenumberPage number (default: 1)
limitnumberItems per page (max: 100, default: 20)
statusstringFilter by status
modelstringFilter 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

  • Same credit pricing as text-to-video generation
  • Supports JPEG, PNG, and WebP formats
  • Works with all active VEO 3.1 models
  • Optional prompt for controlling the motion
  • All aspect ratios supported (16:9 and 9:16)

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

ParameterTypeRequiredDescription
bytesBase64EncodedstringYesBase64-encoded image data
mimeTypestringYes"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

  • Same credit pricing as regular video generation
  • Requires VEO 3.1 models (both fast and quality)
  • Control both the start and end of your video
  • Perfect for product transformations and storytelling
  • Smooth AI-generated transitions between frames

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

ParameterTypeRequiredDescription
modelVersionstringYesMust be "3.1" for this feature
imageobjectYesFirst frame image object
lastFrameobjectYesLast 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 TypeHTTP CodeDescriptionRetryable
INVALID_API_KEY401API key is invalid or inactive❌ No
INSUFFICIENT_CREDITS400Not enough credits for generation❌ No
RATE_LIMIT_EXCEEDED429Too many requests✅ Yes
CONTENT_POLICY_VIOLATION400Content blocked by AI safety❌ No
SYSTEM_ERROR500Internal 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 VEO3Client {
  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 VEO3Client('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

  • • Store API keys securely (environment variables)
  • • Use different keys for development and production
  • • Rotate keys periodically for security
  • • Monitor key usage regularly

Rate Limiting

  • • Respect rate limits (100 requests/hour)
  • • Implement exponential backoff
  • • Monitor your usage patterns
  • • Request increases if needed

Error Handling

  • • Always handle API errors gracefully
  • • Implement retry logic for retryable errors
  • • Log errors for debugging
  • • Provide user-friendly error messages

Cost Optimization

  • • Choose the right model (fast vs quality)
  • • Only generate audio when needed
  • • Cache results when appropriate
  • • Monitor credit usage patterns

Pricing & Credits

Credit Pricing — Resolution-Aware

ModelResolutionNo AudioWith AudioTime
veo3-lite720p2 credits3 credits1-2 min
veo3-lite1080p3 credits5 credits1-2 min
veo3-fast720p / 1080p6 credits10 credits1-3 min
veo3-fast4K (3.1 only)19 credits22 credits1-3 min
veo3-quality720p / 1080p13 credits26 credits2-5 min
veo3-quality4K (3.1 only)26 credits38 credits2-5 min

🆕 Veo 3.1 Lite: Lowest credit use — from 2 credits. 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!

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