File size: 827 Bytes
b1fc1dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// 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();