#does anyone have a sora 2 code pls help
1 messages · Page 1 of 1 (latest)
If you are looking for example code to use the Sora 2 API for video generation, OpenAI provides sample code in several languages. Here are some examples for generating a video using the Sora 2 model:
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)
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);
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" \
-F size="1280x720" \
-F seconds="8"
You will need an API key from OpenAI and appropriate access to the Sora 2 API to use these examples. If you are looking for an invite code for the Sora app, access is currently invite-only and distributed by OpenAI; there are no public codes available in the knowledge sources. You can request to be notified about access in the Sora app or on sora.com Getting started with the Sora app Video generation with Sora.