←AI Video-Agent API
The Scrptly AI Video-Agent API allows you to create entire videos using natural language prompts. By leveraging advanced AI models, the Video-Agent can interpret your instructions and generate videos that match your vision without requiring manual editing.Creating a Video with the AI Video-Agent
To create a video using the AI Video-Agent, use the Scrptly.generateAiVideo() method. Here's a basic example:
import Scrptly from 'scrptly';
Scrptly.setApiSettings({
apiKey: 'YOUR_API_KEY_HERE', // ← Replace with your real key See: https://scrptly.com/accoutn
});
console.log(await Scrptly.generateAiVideo({
// Natural language description of the desired video. Describe everything from the content, duration, visual style...
prompt: 'Create a 20-second promotional video for a new eco-friendly water bottle.',
// Array of up to 5 context images to guide the ai agent
context: [
{
url: 'https://example.com/images/water-bottle.jpg',
description: 'Image of the eco-friendly water bottle'
}
],
// Optional but highly recommended: Maximum budget in tokens you are willing to approve for this video. Make sure to provision your account accordingly. default: 10,000 tokens
approveUpTo: 5000,
});
Parameters
prompt(string, required): A natural language description of the desired video. Be as detailed as possible about the content, duration, visual style, and any specific elements you want includedcontext(array of objects, optional): An array of up to 5 context images to guide the AI agent. Each object should contain:url(string): The URL of the image.description(string): A brief description of the image's relevance to the video.
approveUpTo(number, optional): The maximum budget in tokens you are willing to approve for this video. Default is 10,000 tokens. Ensure your account has sufficient funds to cover this amount.