#idk
1 messages · Page 1 of 1 (latest)
Hi @empty sinew. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To generate a video with Sora 2 using the API, you need to call the POST /videos endpoint with your prompt and required parameters. Here’s a basic example in JavaScript and Python, as well as a cURL example:
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)
cURL Example:
curl -X POST "<https://api.openai.com/v1/videos"> \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F prompt="Wide tracking shot of a teal coupe driving through a desert highway, heat ripples visible, hard sun overhead." \
-F model="sora-2"
- Replace the prompt with your desired scene.
- The API will return a job object with an ID and status.
- Poll the status endpoint or use webhooks to check when your video is ready.
- Once completed, download the MP4 using the video ID.
For more details and advanced options (like setting resolution, duration, or using image references), see the official Sora video generation guide and prompting tips Source Source.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@empty sinew Kapa.ai is still learning and improving, please let me know how I did by reacting below.