Text to Video API documentation
Generate a video from a text prompt.
Endpoints
| Contract item | Value |
|---|---|
| Capability | text-to-video |
| Submit | POST https://vidmage.ai/api/v1/text-to-video/submit |
| Query | POST https://vidmage.ai/api/v1/text-to-video/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: AI Video Generation API for Text and Images
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
prompt | string | Yes | Not specified | Text description of the video to generate. |
duration | string | No | "5" | Video duration in seconds. Values: "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" |
ratio | string | No | "adaptive" | Aspect ratio. Values: "adaptive", "16:9", "4:3", "1:1", "3:4", "9:16", "21:9" |
resolution | string | No | "720p" | Output resolution. Values: "480p", "720p", "1080p", "2k", "4k" |
Example request
{
"prompt": "A vintage red convertible drives along a coastal road at golden hour, smooth cinematic tracking shot",
"duration": "5",
"ratio": "adaptive",
"resolution": "720p"
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/text-to-video/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"prompt":"A vintage red convertible drives along a coastal road at golden hour, smooth cinematic tracking shot","duration":"5","ratio":"adaptive","resolution":"720p"}'
# -> { "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/text-to-video/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 |
|---|---|---|
| 480p | 10 credits / second | — |
| 720p | 20 credits / second | — |
| 1080p | 25 credits / second | — |
| 2k | 30 credits / second | — |
| 4k | 35 credits / second | — |
Charge = duration × the selected resolution rate.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
