Dokumentasi
Long polling
Panduan terperinci dan referensi API hanya tersedia dalam bahasa Inggris.
Wait for a job
GET /v1/generations/{id} accepts wait, the number of seconds (0 to 60) the server may hold the request open:
GET /v1/generations/0190a1b2-0000-7000-8000-0000000000aa?wait=60
Authorization: Bearer cv_live_YOUR_KEY
- If the job is already in a final status (
completed,failed,cancelled) the answer is immediate. - Otherwise the request returns as soon as the job reaches a final status, within about a second, or when
waitseconds have passed with the current state. - Values above 60 are treated as 60. A negative or non numeric value returns
422 invalid_parameters. - Loop until the status is final: send the request again, with the same
wait, as long as the status is notcompleted,failedorcancelled.
import requests
headers = {"Authorization": "Bearer cv_live_YOUR_KEY"}
url = f"https://api.cheapvids.com/v1/generations/{generation_id}"
job = requests.get(url, params={"wait": 60}, headers=headers, timeout=90).json()
while job["status"] not in ("completed", "failed", "cancelled"):
job = requests.get(url, params={"wait": 60}, headers=headers, timeout=90).json()
const url = `https://api.cheapvids.com/v1/generations/${id}?wait=60`;
const headers = { Authorization: "Bearer cv_live_YOUR_KEY" };
let job = await (await fetch(url, { headers })).json();
while (!["completed", "failed", "cancelled"].includes(job.status)) {
job = await (await fetch(url, { headers })).json();
}
Check the HTTP status before you read the body in production code, and stop on an error response instead of looping.
Limits
Each API key can hold up to 20 long polling requests at the same time. Over that, the request returns immediately with the current state and next.after_seconds, so sleep that long before asking again.
Your HTTP client timeout must be longer than the wait you ask for; 90 seconds is a safe value.

