Welcome to Veo3 API
This guide will walk you through making your first API calls to generate videos, upload files, and check your account status. You’ll be up and running in minutes!
Step 1: Authentication Setup
All API requests require Bearer token authentication. Here’s how to set it up:
const apiKey = 'YOUR_API_KEY' ;
const headers = {
'Authorization' : `Bearer ${ apiKey } ` ,
'Content-Type' : 'application/json'
};
Replace YOUR_API_KEY
with your actual API key. Never expose your API key in client-side code or public repositories.
Step 2: Check Your Credits
Before generating videos, let’s check your available credits:
const response = await fetch ( 'https://api.veo3api.ai/api/v1/common/credit' , {
method: 'GET' ,
headers: {
'Authorization' : `Bearer ${ apiKey } `
}
});
const data = await response . json ();
console . log ( `Remaining credits: ${ data . data } ` );
{
"code" : 200 ,
"msg" : "success" ,
"data" : 100
}
Step 3: Generate Your First Video
Now let’s create a video from a text prompt:
Text-to-Video Generation
const generateVideo = async () => {
const response = await fetch ( 'https://api.veo3api.ai/api/v1/veo/generate' , {
method: 'POST' ,
headers: headers ,
body: JSON . stringify ({
prompt: "A golden retriever playing fetch in a sunny park, slow motion, cinematic lighting" ,
model: "veo3" ,
aspectRatio: "16:9" ,
watermark: "MyBrand"
})
});
const result = await response . json ();
return result . data . taskId ;
};
const taskId = await generateVideo ();
console . log ( `Video generation started. Task ID: ${ taskId } ` );
{
"code" : 200 ,
"msg" : "success" ,
"data" : {
"taskId" : "veo_task_abcdef123456"
}
}
Image-to-Video Generation
You can also animate existing images. First, upload an image:
// Upload image first
const formData = new FormData ();
formData . append ( 'file' , imageFile );
formData . append ( 'uploadPath' , 'images/user-uploads' );
const uploadResponse = await fetch ( 'https://veo3apiai.redpandaai.co/api/file-stream-upload' , {
method: 'POST' ,
headers: {
'Authorization' : `Bearer ${ apiKey } `
},
body: formData
});
const uploadResult = await uploadResponse . json ();
const imageUrl = uploadResult . data . downloadUrl ;
// Then generate video from image
const videoResponse = await fetch ( 'https://api.veo3api.ai/api/v1/veo/generate' , {
method: 'POST' ,
headers: headers ,
body: JSON . stringify ({
prompt: "The person in the image starts walking forward with confident steps" ,
imageUrls: [ imageUrl ],
model: "veo3" ,
aspectRatio: "16:9"
})
});
Step 4: Check Video Status
Video generation takes time. Use the task ID to check progress:
const checkVideoStatus = async ( taskId ) => {
const response = await fetch (
`https://api.veo3api.ai/api/v1/veo/record-info?taskId= ${ taskId } ` ,
{
method: 'GET' ,
headers: {
'Authorization' : `Bearer ${ apiKey } `
}
}
);
const result = await response . json ();
return result . data ;
};
// Check status periodically
const checkStatus = async () => {
const status = await checkVideoStatus ( taskId );
if ( status . successFlag === 1 ) {
console . log ( 'Video generated successfully!' );
console . log ( 'Video URLs:' , status . response . resultUrls );
} else if ( status . successFlag === 0 ) {
console . log ( 'Still generating...' );
setTimeout ( checkStatus , 30000 ); // Check again in 30 seconds
} else {
console . log ( 'Generation failed:' , status . errorMessage );
}
};
checkStatus ();
{
"code" : 200 ,
"msg" : "success" ,
"data" : {
"taskId" : "veo_task_abcdef123456" ,
"successFlag" : 1 ,
"response" : {
"resultUrls" : [
"https://example.com/generated-video.mp4"
]
},
"completeTime" : "2024-03-20T10:30:00Z"
}
}
Step 5: Get 1080P Version (Optional)
For 16:9 aspect ratio videos, you can get a high-definition 1080P version:
const get1080pVideo = async ( taskId ) => {
const response = await fetch (
`https://api.veo3api.ai/api/v1/veo/get-1080p-video?taskId= ${ taskId } &index=0` ,
{
method: 'GET' ,
headers: {
'Authorization' : `Bearer ${ apiKey } `
}
}
);
const result = await response . json ();
return result . data . resultUrl ;
};
const hdVideoUrl = await get1080pVideo ( taskId );
console . log ( '1080P video URL:' , hdVideoUrl );
File Upload Methods
The platform supports three different file upload methods:
Stream Upload Base64 Upload URL Upload Perfect for direct file uploads from your application:
const formData = new FormData ();
formData . append ( 'file' , fileInput . files [ 0 ]);
formData . append ( 'uploadPath' , 'images/user-uploads' );
formData . append ( 'fileName' , 'my-image.jpg' );
const response = await fetch ( 'https://veo3apiai.redpandaai.co/api/file-stream-upload' , {
method: 'POST' ,
headers: {
'Authorization' : `Bearer ${ apiKey } `
},
body: formData
});
Best Practices
Be Specific : Include details about lighting, camera angles, and style
Use Action Words : Describe movement and dynamics clearly
Set the Scene : Mention environment, weather, and atmosphere
Specify Duration : For longer videos, break into scenes
Example: “A majestic eagle soaring through mountain clouds at sunset, cinematic wide shot, golden hour lighting, slow motion flight”
Always implement proper error handling:
try {
const response = await fetch ( apiUrl , options );
const data = await response . json ();
if ( data . code !== 200 ) {
throw new Error ( `API Error: ${ data . msg } ` );
}
return data ;
} catch ( error ) {
console . error ( 'Request failed:' , error . message );
}
Monitor Credits : Check your balance regularly
Implement Queuing : For high-volume applications
Use Callbacks : Set up webhook endpoints for completion notifications
Retry Logic : Implement exponential backoff for failed requests
Next Steps
Congratulations! You’ve successfully made your first API calls. Continue exploring our documentation to unlock the full potential of the Veo3 API platform.