AI Image & Video Generation
/api/v1/generate/video/
Create a new video generation task using Veo3. Credits are deducted immediately when generation starts.
Authentication Required: This endpoint requires authentication via Bearer or API Key.
Faster generation, supports both text-to-video and image-to-video.
Higher quality, supports both text-to-video and image-to-video.
Description of the video you want to generate. Max 1000 characters.
Video generation model to use. Defaults to 'veo3_fast' if not specified.
Array of image URLs to use as source for image-to-video generation. Supported with both 'veo3_fast' and 'veo3' models.
Video aspect ratio for different screen formats. Controls the width-to-height ratio of the generated video.
{
"prompt": "A cat playing in a garden with colorful flowers, sunny day",
"video_model": "veo3_fast",
"aspect_ratio": "16:9"
}
{
"prompt": "A beautiful sunset over mountains with birds flying",
"aspect_ratio": "9:16"
}
Note: Perfect for social media content like Instagram Stories, TikTok
{
"prompt": "The cat starts running and jumping through the garden",
"video_model": "veo3_fast",
"source_image_urls": [
"https://example.com/cat-in-garden.jpg"
],
"aspect_ratio": "16:9"
}
Note: veo3_fast now supports image-to-video at 240 credits vs 500 for veo3
{
"prompt": "A cat gracefully jumping through tall grass in slow motion",
"video_model": "veo3",
"aspect_ratio": "9:16"
}
{
"prompt": "The cat starts running and playing with the flowers",
"video_model": "veo3",
"source_image_urls": [
"https://example.com/cat-in-garden.jpg"
],
"aspect_ratio": "16:9"
}
veo3_fast video generation started successfully
{
"success": true,
"data": {
"generation_id": "uuid-here",
"status": "processing",
"generation_type": "video",
"video_model": "veo3_fast",
"estimated_time": "45-60 seconds",
"credits_used": 240,
"credits_remaining": 260,
"mode": "text-to-video",
"message": "Video generation started successfully"
}
}
veo3 text-to-video generation started successfully
{
"success": true,
"data": {
"generation_id": "uuid-here",
"status": "processing",
"generation_type": "video",
"video_model": "veo3",
"estimated_time": "60-90 seconds",
"credits_used": 500,
"credits_remaining": 0,
"mode": "text-to-video",
"message": "Premium video generation started successfully"
}
}
veo3 image-to-video generation started successfully
{
"success": true,
"data": {
"generation_id": "uuid-here",
"status": "processing",
"generation_type": "video",
"video_model": "veo3",
"estimated_time": "90-120 seconds",
"credits_used": 500,
"credits_remaining": 0,
"mode": "image-to-video",
"source_images_count": 1,
"message": "Premium image-to-video generation started successfully"
}
}
Insufficient credits for veo3_fast model
{
"success": false,
"error": "Insufficient credits. Need 240, have 100",
"credits_needed": 240,
"credits_balance": 100,
"video_model": "veo3_fast",
"generation_type": "video"
}
Insufficient credits for veo3 premium model
{
"success": false,
"error": "Insufficient credits. Need 500, have 250",
"credits_needed": 500,
"credits_balance": 250,
"video_model": "veo3",
"generation_type": "video"
}
Invalid request parameters
{
"success": false,
"error": "Prompt is required",
"details": {
"prompt": "This field is required"
}
}
Video generation costs vary by model selection and features:
Model | Credits | Supported Modes | Generation Time | Quality |
---|---|---|---|---|
veo3_fast | 240 | Text-to-video + Image-to-video | 45-60 seconds | Standard |
veo3 | 500 | Text-to-video + Image-to-video | 60-120 seconds | Premium |
For comparison, image generation costs 24 credits regardless of size (1:1, 3:2, or 2:3).
Complete example showing video generation and status checking:
// Generate with veo3_fast (standard, 240 credits)
const generateVideoFast = async (aspectRatio = "16:9") => {
const response = await fetch('/api/v1/generate/video/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token YOUR_TOKEN_HERE'
},
body: JSON.stringify({
prompt: 'A cat playing in a colorful garden on a sunny day',
video_model: 'veo3_fast', // Or omit for default
aspect_ratio: aspectRatio
})
});
const data = await response.json();
if (data.success) {
console.log('veo3_fast generation started:', data.data.generation_id);
console.log('Credits used:', data.data.credits_used);
console.log('Model:', data.data.video_model);
console.log('Aspect ratio:', aspectRatio);
return data.data.generation_id;
} else {
console.error('Error:', data.error);
return null;
}
};
// Generate with veo3 premium (500 credits, supports image-to-video)
const generateVideoPremium = async (sourceImageUrls = null, aspectRatio = "16:9") => {
const requestBody = {
prompt: 'A cat gracefully jumping through tall grass in slow motion',
video_model: 'veo3',
aspect_ratio: aspectRatio
};
// Add source images if provided (image-to-video mode)
if (sourceImageUrls) {
requestBody.source_image_urls = sourceImageUrls;
}
const response = await fetch('/api/v1/generate/video/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Token YOUR_TOKEN_HERE'
},
body: JSON.stringify(requestBody)
});
const data = await response.json();
if (data.success) {
console.log('veo3 premium generation started:', data.data.generation_id);
console.log('Credits used:', data.data.credits_used);
console.log('Mode:', data.data.mode);
console.log('Aspect ratio:', aspectRatio);
return data.data.generation_id;
} else {
console.error('Error:', data.error);
return null;
}
};
// Check status (same endpoint as images)
const checkStatus = async (generationId) => {
const response = await fetch(`/api/v1/generate/${generationId}/`, {
headers: {
'Authorization': 'Token YOUR_TOKEN_HERE'
}
});
const data = await response.json();
if (data.generation_type === 'video') {
console.log('Model used:', data.video_model);
if (data.status === 'completed' && data.video_url) {
console.log('Video ready:', data.video_url);
return data;
} else if (data.status === 'processing') {
console.log('Still processing... checking again in 10 seconds');
setTimeout(() => checkStatus(generationId), 10000);
}
}
};
// Usage examples
// Landscape video (16:9) - great for YouTube, presentations
const landscapeId = await generateVideoFast("16:9");
if (landscapeId) checkStatus(landscapeId);
// Portrait video (9:16) - perfect for social media
const portraitId = await generateVideoFast("9:16");
if (portraitId) checkStatus(portraitId);
// Premium landscape text-to-video (500 credits)
const premiumLandscapeId = await generateVideoPremium(null, "16:9");
if (premiumLandscapeId) checkStatus(premiumLandscapeId);
// Premium portrait image-to-video (500 credits)
const imageToVideoPortraitId = await generateVideoPremium(['https://example.com/cat.jpg'], "9:16");
if (imageToVideoPortraitId) checkStatus(imageToVideoPortraitId);