Video GenerationSora
Sora 2
OpenAI Sora 2 video generation with normalized duration and aspect ratio controls.
POST /v2/videos/generate — model: "sora-2"
Sora 2 supports both text-to-video and image-to-video generation through a single normalized API.
See Video Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
soraParams.duration | integer | 4 | Video duration in seconds: 4, 8, 10, 12, or 15 |
soraParams.aspect_ratio | string | "16:9" | Output aspect ratio: "16:9" or "9:16" |
soraParams.resolution | string | "standard" | Exposed for consistency; unsupported providers may ignore it for sora-2 |
soraParams.start_image | string | — | URL of an image to use as the first frame |
Credit cost
| Variant | Credits |
|---|---|
4s | 4 |
8s | 8 |
10s | 10 |
12s | 12 |
15s | 15 |
Code examples
curl -X POST https://api.apiframe.ai/v2/videos/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a cinematic dolly shot of neon-lit Tokyo streets in the rain",
"model": "sora-2",
"soraParams": {
"duration": 12,
"aspect_ratio": "16:9"
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/videos/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "a cinematic dolly shot of neon-lit Tokyo streets in the rain",
"model": "sora-2",
"soraParams": {
"duration": 12,
"aspect_ratio": "16:9",
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/videos/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "a cinematic dolly shot of neon-lit Tokyo streets in the rain",
model: "sora-2",
soraParams: {
duration: 12,
aspect_ratio: "16:9",
},
}),
});
console.log(await response.json());Try it
POST
/v2/videos/generateTry it