#dsjjw
1 messages · Page 1 of 1 (latest)
Certainly! Here is an example code snippet for generating a video using the Sora 2 model via the OpenAI API in JavaScript and Python. This code is directly based on the official documentation:
JavaScript Example:
import OpenAI from 'openai';
const openai = new OpenAI();
let video = await openai.videos.create({
model: 'sora-2',
prompt: "A video of the words 'Thank you' in sparkling letters",
});
console.log('Video generation started: ', video);
Python Example:
from openai import OpenAI
openai = OpenAI()
video = openai.videos.create(
model="sora-2",
prompt="A video of a cool cat on a motorcycle in the night",
)
print("Video generation started:", video)
You can monitor the job status and download the final video once it's completed. For more details on polling and downloading, see the official documentation for video generation with Sora.
If you need a more complete workflow (including polling for completion and downloading the video), let me know!
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@cold sandal Kapa.ai is still learning and improving, please let me know how I did by reacting below.