Video

Sora Video Generation

Generate videos using OpenAI's Sora model. Submit a prompt, poll for status, and download the finished video.

Create Generation

POST/v1/videos/generations

Body Parameters

modelstringrequired

Model ID — "sora" or "sora-1.0-turbo"

promptstringrequired

Text description of the desired video

aspect_ratiostring

Video aspect ratio

Options: 16:9, 9:16, 1:1

durationinteger

Video duration in seconds

Options: 5, 10, 15, 20

ninteger

Number of videos to generate

Default: 1

cURL
curl -X POST https://api.metriqual.com/v1/videos/generations \
  -H "Authorization: Bearer mql_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora",
    "prompt": "A timelapse of a flower blooming in a garden"
  }'
TypeScript SDK
const generation = await mql.video.create({
  model: 'sora',
  prompt: 'A timelapse of a flower blooming in a garden',
  aspect_ratio: '16:9',
  duration: 10
});

console.log(generation.id); // Use to poll status
Python SDK
gen = mql.video.create(
    model="sora",
    prompt="A timelapse of a flower blooming in a garden",
    aspect_ratio="16:9",
    duration=10,
)
print(gen["id"])

# Or create and wait for completion
result = mql.video.create_and_wait(
    model="sora",
    prompt="A timelapse of a flower blooming in a garden",
)

# Or create, wait, and download in one step
video = mql.video.create_and_download(
    model="sora",
    prompt="A timelapse of a flower blooming in a garden",
)

Check Status

GET/v1/videos/generations/:id

Poll this endpoint to check if the video generation is complete. The status transitions from pendingprocessingcompleted.

TypeScript SDK
const status = await mql.video.getStatus(generation.id);

if (status.status === 'completed') {
  const content = await mql.video.download(generation.id);
  // content contains the video data
}
Python SDK
status = mql.video.get_status(gen["id"])
if status["status"] == "completed":
    content = mql.video.download(gen["id"])

Download Video

GET/v1/videos/:id/content

Download the generated video content once the generation status is completed.