Skip to main content
POST
Text-to-video: submit a video generation task from text
The interactive Playground on the right supports live debugging. Set your API Key in the Authorization field (format: Bearer sk-xxx), enter a prompt, choose model / size / seconds, and send.
Scope: This page covers “generate video from text only” — no input_reference, request body is application/json. To animate from a reference image (image-to-video), use the Image-to-Video endpoint (same path + multipart upload).
⚠️ Three-step async flow — this page only covers step 1 (submission)
  • Step 1 (this page): POST /v1/videos → returns video_id + status: "queued"
  • Step 2: Poll GET /v1/videos/{video_id} until status: "completed"
  • Step 3: Download from GET /v1/videos/{video_id}/content (returns the MP4 file)
The POST itself takes a few seconds and does not block until generation finishes. Full flow shown in the Python sample below.

Code Samples

Python (OpenAI SDK Drop-In)

Python (Raw requests)

cURL

Node.js (fetch)

Browser JavaScript

Parameters Quick Reference

Detailed parameter constraints, allowed values, and examples are visible in the right-hand Playground — all enum fields offer dropdowns. For image-to-video parameters (input_reference upload), see the Image-to-Video endpoint.

Response Format

Step 1 — Immediate Submit Response

Step 2 — Polling While Running

Step 2 — Polling After Completion

⚠️ Response field gotchas
  • No direct video_url field — the video file must be downloaded from GET /v1/videos/{id}/content (returns a video/mp4 binary stream). Don’t expect a CDN URL in the JSON response.
  • progress is not strictly linear — it can jump (e.g. 0 → 45 → 80 → 100)
  • On status: "failed", an error field is not always present — most failures are content-policy or capacity issues, just retry or revise the prompt
  • Video content is retained on OpenAI for 1 day only/content returns 404 after expiration
This endpoint is the async-task entry point. Billing settles by seconds rate when the task completes (see pricing table). The POST submission, status polling, and content download themselves are not billed, and failed tasks are not billed.

Authorizations

Authorization
string
header
required

API Key from the APIYI console (must use Sora2官转 group + usage-based billing)

Body

application/json
model
enum<string>
default:sora-2
required

Model ID. sora-2 supports 720p only; sora-2-pro supports 720p / 1024p / 1080p tiers

Available options:
sora-2,
sora-2-pro
prompt
string
required

Video generation prompt; describe scene, camera motion, style, lighting, and character actions in detail

Example:

"A serene Japanese garden with cherry blossoms, koi pond, traditional bridge, golden hour, ultra detailed"

seconds
enum<string>
default:4

Video duration as a string enum (not a number):

  • "4" — 4 seconds (default), ideal for short demos, single shots, fast prompt iteration
  • "8" — 8 seconds, standard short-form video, most common
  • "12" — 12 seconds, long shots and continuous action

Passing "10" / "15" or the integer 4 returns 400

Available options:
4,
8,
12
size
enum<string>
default:720x1280

Output resolution. sora-2 and sora-2-pro support different tiers:

  • sora-2 (720p only): 720x1280 (portrait, default) / 1280x720 (landscape)
  • sora-2-pro additionally supports:
    • 1024x1792 / 1792x1024 (1024p, $0.50/sec)
    • 1080x1920 / 1920x1080 (1080p, $0.70/sec)

Passing 1024p / 1080p sizes to sora-2 returns 400

Available options:
720x1280,
1280x720,
1024x1792,
1792x1024,
1080x1920,
1920x1080

Response

Task submitted, returns video_id with queued status

id
string

Task ID for subsequent polling and download

Example:

"video_abc123def456"

object
string

Object type, fixed video

Example:

"video"

model
string

Model ID used for this task

Example:

"sora-2"

status
enum<string>

Task status:

  • queued — submitted, waiting in queue
  • in_progress — generating
  • completed — done, ready to download (/v1/videos/{id}/content)
  • failed — failed (not billed), safe to retry
Available options:
queued,
in_progress,
completed,
failed
Example:

"queued"

progress
integer

Generation progress percentage (0–100), not strictly linear

Example:

0

created_at
integer

Task creation Unix timestamp (seconds)

Example:

1712697600

completed_at
integer

Task completion Unix timestamp (seconds), present only on completed status

Example:

1712697900

size
string

Actual output resolution (matches the requested size)

Example:

"1280x720"

seconds
string

Actual duration generated (matches the requested seconds)

Example:

"8"

quality
string

Quality tier (standard for sora-2, high for sora-2-pro)

Example:

"standard"