Video generation (Sora)
curl --request POST \
--url https://openp.ai/v1/videosimport requests
url = "https://openp.ai/v1/videos"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://openp.ai/v1/videos', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openp.ai/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openp.ai/v1/videos"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openp.ai/v1/videos")
.asString();require 'uri'
require 'net/http'
url = URI("https://openp.ai/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyVideo & image generation
Video generation (Sora)
POST /v1/videos — text-to-video
POST
/
v1
/
videos
Video generation (Sora)
curl --request POST \
--url https://openp.ai/v1/videosimport requests
url = "https://openp.ai/v1/videos"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://openp.ai/v1/videos', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openp.ai/v1/videos",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://openp.ai/v1/videos"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openp.ai/v1/videos")
.asString();require 'uri'
require 'net/http'
url = URI("https://openp.ai/v1/videos")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyGenerate video with Sora. It uses an asynchronous task flow: submit to get a task ID, poll until done, then download the video.
Submit a task
curl https://openp.ai/v1/videos \
-H "Authorization: Bearer $OPENPAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sora-2",
"prompt": "A red panda surfing on a giant wave at sunset, cinematic, 4K",
"seconds": 8,
"size": "1280x720"
}'
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | sora-2 / sora-2-pro, etc. |
prompt | string | ✅ | Video description |
seconds | integer | Duration (seconds), typically 5-20 | |
size | string | Resolution, e.g. 1280x720 / 1920x1080 | |
aspect_ratio | string | 16:9 / 9:16 / 1:1 | |
n | integer | Number to generate (partially supported) | |
input_reference | object | An input reference image or video |
Response (task created)
{
"id": "video_01...",
"object": "video.task",
"status": "queued",
"created_at": 1715750400,
"model": "sora-2"
}
Query task status
curl https://openp.ai/v1/videos/video_01... \
-H "Authorization: Bearer $OPENPAI_API_KEY"
{
"id": "video_01...",
"status": "completed",
"video_url": "https://...mp4",
"thumbnail_url": "https://...jpg",
"duration": 8,
"created_at": 1715750400,
"completed_at": 1715750460
}
status possible values: queued / processing / completed / failed.
Polling guidance
- Start polling after an initial delay of 5-10 seconds.
- Poll every 10-30 seconds.
- It usually completes in 1-5 minutes.
- On failure, the
failure_reasonfield explains why.