Skip to content
Main Site News Console

Video Generation (Async)

Video generation takes a long time (from tens of seconds to several minutes), so 4ALL API uses an asynchronous submit + poll protocol: first submit a task to get a task_id, then poll to query the result.

1. Submit a task

POST https://api.4allapi.com/v1/video/generations
Terminal window
curl https://api.4allapi.com/v1/video/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AIPROXY_KEY" \
-d '{
"model": "veo-3.1",
"prompt": "A drone view gliding over the coastline at dawn, cinematic, natural light",
"size": "1280x720",
"seconds": "8"
}'

Response:

{ "task_id": "video-task-xxx", "status": "submitted" }
ParameterDescription
modelVideo model, such as veo-3.1, sora-2, kling-v3, omni-flash video model
promptScene and camera movement description
sizeResolution (landscape/portrait), according to the model’s supported range
secondsDuration in seconds, according to the model’s supported range
imageFirst-frame reference image for image-to-video (supported models, URL or base64)

2. Query the result

GET https://api.4allapi.com/v1/video/generations/{task_id}
Terminal window
curl https://api.4allapi.com/v1/video/generations/video-task-xxx \
-H "Authorization: Bearer $AIPROXY_KEY"

status will go through submitted → processing → succeeded / failed; when successful, it returns the video download URL:

{
"task_id": "video-task-xxx",
"status": "succeeded",
"video_url": "https://.../result.mp4"
}

Polling recommendations

  • Poll once every 5–10 seconds; extend the total timeout according to the model duration (for example, 10 minutes);
  • The failed status will include the failure reason; for content-policy failures, adjust the prompt and submit again;
  • Video links are valid for a limited time; after generation succeeds, transfer them to your own storage as soon as possible.