Access top video generation models through a unified API -- text-to-video, motion control, and more.
Añade el encabezado Authorization a todas las solicitudes:
Authorization: Bearer YOUR_API_KEY
/api/v1/video/generationsCreate a video generation task
/api/v1/video/generations?task_id=xxxQuery task status and get video URL
/api/v1/video/p-videoSYNCP-Video dedicated sync endpoint: one request blocks ~30-60s and returns the video URL directly (no polling)
Selecciona un proveedor para ver sus parámetros y ejemplos
High-quality text-to-video generation by xAI. Supports 5s/10s/15s video with natural motion.
grok-video-3grok-video-3-10sgrok-video-3-official# Step 1: Create task
curl -X POST https://apimodels.app/api/v1/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-video-3",
"prompt": "A cat playing piano in a jazz club, cinematic lighting",
"aspect_ratio": "16:9"
}'
# Step 2: Poll status
curl "https://apimodels.app/api/v1/video/generations?task_id=TASK_ID" \
-H "Authorization: Bearer YOUR_API_KEY"{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "pending"
}
}{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "completed",
"resultUrls": ["https://cdn.example.com/video.mp4"],
"createTime": 1705123450000,
"completeTime": 1705123500000
}
}{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"state": "failed",
"failMsg": "Content policy violation"
}
}Incluye callback_url en la solicitud de creación. Cuando la tarea alcanza el estado terminal completed o failed, nuestro servidor envía un único HTTP POST a esa URL con Content-Type: application/json (sin encabezado de firma). La entrega se reintenta hasta 3 veces (retroceso exponencial 1s/2s/4s, 10s por intento); si aún no tiene éxito, un trabajo en segundo plano sigue reintentando durante hasta 30 minutos hasta que tu endpoint devuelva 2xx.
POST {your callback_url}
Content-Type: application/json
{
"code": 200,
"msg": "success",
"data": {
"taskId": "clxxx...",
"model": "<provider>/<model_name>",
"state": "completed" | "failed",
"param": "<JSON string>", // request params, JSON.parse once
"resultJson": "<JSON string> | null", // result object, JSON.parse once
"failCode": null | "string",
"failMsg": null | "string",
"costTime": 12345, // duration in ms
"completeTime": 1705123500000, // ms epoch
"createTime": 1705123450000 // ms epoch
}
}Note: data.param and data.resultJson are both JSON strings — call JSON.parse once on each.
{
"resultUrls": ["https://r2.apimodels.app/videos/xxx.mp4"],
"thumbnailUrl": "https://...jpg", // optional (some models only)
"videoSize": "1280x720", // optional
"videoDuration": 5, // optional, seconds
"videoModel": "veo3" // optional
}resultUrls is always present (length 1 in success, [] on failure). Other fields are optional and provider-dependent — read defensively. When state=failed, resultJson is typically null or {"resultUrls":[]}; do not assume a video URL is present.
app.post('/webhook/video', express.json(), (req, res) => {
const { taskId, state, resultJson, failMsg } = req.body.data
if (state === 'completed') {
const r = JSON.parse(resultJson)
console.log('video ready', taskId, r.resultUrls[0], r.videoDuration)
} else {
console.warn('video failed', taskId, failMsg)
}
res.status(200).end() // must be 2xx, otherwise we retry
})pendingEn cola, esperando para iniciarprocessingVideo is being generatedcompletedDone -- video URL availablefailedLa generación falló400Bad Request: parámetros inválidos o faltantes401Unauthorized: clave de API inválida402Payment Required: créditos insuficientes404Not Found -- ID de tarea no encontrado500Error interno del servidor