#SOra

1 messages · Page 1 of 1 (latest)

edgy cloakBOT
#

Hi @radiant pebble. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hello! If you want to generate videos using Sora 2 via code, you can use the OpenAI API. Here’s a basic example of how to create a Sora 2 video using Python and the OpenAI SDK:

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)

Or, using curl:

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"

How it works:

  1. You send a prompt and parameters (like model, size, and duration) to the /videos endpoint.
  2. The API returns a job ID and status.
  3. You poll the job status until it’s complete, then download the MP4 video.

Note: You need an OpenAI API key and access to the Sora 2 API. There are also content restrictions (e.g., no real people or copyrighted material in prompts or images) Video generation with Sora.

If you want to use an image as the first frame, you can add it as an input_reference parameter (see the docs for details) Use image references.

Let me know if you need a more detailed example or have a specific use case in mind!

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@radiant pebble Kapa.ai is still learning and improving, please let me know how I did by reacting below.

#

Let me check the knowledge base for you again. One moment! :books:

#

Yes, the code examples I provided are for using the Sora 2 API to generate videos programmatically—they show you how to write your own code to interact with Sora 2. You do not create your own version of the Sora 2 model itself (the model is proprietary to OpenAI), but you can write your own scripts or applications that send prompts to Sora 2 and receive generated videos in response.

To summarize:

  • You can write your own code to use Sora 2 via the OpenAI API.
  • You cannot create your own Sora 2 model, but you can build custom workflows and applications that use Sora 2 for video generation.

For more details and code samples, see the official documentation on video generation with Sora.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@radiant pebble Kapa.ai is still learning and improving, please let me know how I did by reacting below.