Upload examples/sora2_example.js with huggingface_hub
Browse files- examples/sora2_example.js +29 -0
examples/sora2_example.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Sora 2 Video Generation API Example via NexaAPI
|
| 2 |
+
// Get your free API key at: https://nexa-api.com
|
| 3 |
+
// Install: npm install nexaapi
|
| 4 |
+
|
| 5 |
+
import NexaAPI from 'nexaapi';
|
| 6 |
+
|
| 7 |
+
const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });
|
| 8 |
+
|
| 9 |
+
async function main() {
|
| 10 |
+
// Generate a short video
|
| 11 |
+
const video = await client.videos.generate({
|
| 12 |
+
model: 'sora-2',
|
| 13 |
+
prompt: 'A timelapse of a blooming flower in a garden, cinematic quality',
|
| 14 |
+
duration: 5
|
| 15 |
+
});
|
| 16 |
+
console.log('Sora 2 - Generated Video URL:');
|
| 17 |
+
console.log(video.data[0].url);
|
| 18 |
+
|
| 19 |
+
// Marketing clip
|
| 20 |
+
const marketingVideo = await client.videos.generate({
|
| 21 |
+
model: 'sora-2',
|
| 22 |
+
prompt: 'A robot walking through a neon-lit city at night, futuristic aesthetic',
|
| 23 |
+
duration: 8
|
| 24 |
+
});
|
| 25 |
+
console.log('\nMarketing Video URL:');
|
| 26 |
+
console.log(marketingVideo.data[0].url);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
main();
|