Sora2 Video Generator API documentation
Generate a video with Sora2 from a prompt, optionally conditioned on an image.
Endpoints
| Contract item | Value |
|---|---|
| Capability | sora2 |
| Submit | POST https://vidmage.ai/api/v1/sora2/submit |
| Query | POST https://vidmage.ai/api/v1/sora2/query |
| Task identifier | taskId |
| Result field | videoUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: Sora 2 API
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
prompt | string | Yes | Not specified | Text description of the video to generate. |
imageUrl | string | No | Not specified | Optional conditioning image URL (must be http/https). |
duration | number | No | Not specified | Requested duration in seconds. Defaults to 4 and is normalized to the nearest supported value: 4, 8, or 12. |
size | string | No | "720*1280" | Output size for text-to-video. Image-to-video infers its orientation from the input image. Values: "720*1280", "1280*720" |
Example request
{
"prompt": "A tiny service robot delivers flowers through a lively open-air market, cinematic natural motion",
"size": "720*1280"
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/sora2/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"prompt":"A tiny service robot delivers flowers through a lively open-air market, cinematic natural motion","size":"720*1280"}'
# -> { "success": true, "taskId": "...", "creditsConsumed": ... }Task results and recovery
URL of the generated video. Read videoUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/sora2/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "videoUrl": "https://..." } }Submission and task queries report the available task and usage information. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| Video duration | 10 credits / second | 10 credits |
Duration is normalized to a supported video length before calculating the charge.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
