#Where to get sora code
1 messages · Page 1 of 1 (latest)
Hi @stuck cliff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
If by “Sora code” you mean example code for using Sora via the OpenAI API:
- Sora is exposed through the Videos API using the
sora-2andsora-2-promodels. The official docs include ready‑to‑use code samples (JavaScript, Python, curl) for creating and downloading videos.[Video generation guide; Sora 2 model]
Example from the docs (creating a video):
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)
And downloading the result:
content = openai.videos.download_content(video.id, variant="video")
content.write_to_file("video.mp4")
You can find these and more examples (including polling for job completion) in the Video generation with Sora section of the OpenAI API docs.[Video generation guide; Retrieve results]
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@stuck cliff Kapa.ai is still learning and improving, please let me know how I did by reacting below.