| // Sora 2 Video Generation API Example via NexaAPI | |
| // Get your free API key at: https://nexa-api.com | |
| // Install: npm install nexaapi | |
| import NexaAPI from 'nexaapi'; | |
| const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' }); | |
| async function main() { | |
| // Generate a short video | |
| const video = await client.videos.generate({ | |
| model: 'sora-2', | |
| prompt: 'A timelapse of a blooming flower in a garden, cinematic quality', | |
| duration: 5 | |
| }); | |
| console.log('Sora 2 - Generated Video URL:'); | |
| console.log(video.data[0].url); | |
| // Marketing clip | |
| const marketingVideo = await client.videos.generate({ | |
| model: 'sora-2', | |
| prompt: 'A robot walking through a neon-lit city at night, futuristic aesthetic', | |
| duration: 8 | |
| }); | |
| console.log('\nMarketing Video URL:'); | |
| console.log(marketingVideo.data[0].url); | |
| } | |
| main(); | |