API
Videos
POST /videos/generations: an asynchronous job, polled until the video is ready, then downloaded.
Start a job
`POST /videos/generations` takes `model` (a video model id from `/models`), `prompt`, optional `duration` (seconds; each model lists its range on `/models` as `durations`, and models that take only some lengths add `duration_step`; the default is 5), `resolution` (the model's `resolutions`; the default is its first) and `aspect_ratio` (`16:9`, the default; `9:16`; `1:1`). It answers **202** with a job object whose `status` is `queued`.
Video is priced `per_second`: `/models` shows WIT per second at each resolution. The whole price (`duration` × the rate) is charged when the provider accepts the job and refunded in full if the job fails. Prompts are never stored; Allwit keeps who asked, the model, the provider's job id and the outcome, and nothing else.
{
"id": "6f1c…",
"object": "video.generation",
"created": 1794300000,
"model": "<video model id>",
"status": "queued",
"duration": 5,
"resolution": "720p",
"allwit": { "wit_charged": 95, "privacy_tier": "blind", "source": "provider_api" }
}Poll and download
`GET /videos/generations/{id}` returns the job with its current `status`: `queued`, `running`, `succeeded` or `failed`. Jobs take a minute or several; poll every 10 seconds or so. Only the wallet that owns the key that started a job can see it; any other id is 404.
When `status` is `succeeded` the object carries `content_url`: `GET /videos/generations/{id}/content` streams the MP4 straight from the provider. Allwit keeps no copy, and providers delete results after a while (Kling after 30 days, BytePlus sooner), so download promptly. When `status` is `failed`, `error.code` says why (`content_blocked_by_provider`, `rate_limited`, `provider_down`), `allwit.wit_charged` is `0` and the WIT is back in the wallet.
JOB=$(curl -s https://www.allwit.ai/api/v1/videos/generations \
-H "Authorization: Bearer $ALLWIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "<video model id>", "prompt": "A paper boat drifting on a calm pond at sunrise", "duration": 5}' | jq -r .id)
until curl -s https://www.allwit.ai/api/v1/videos/generations/$JOB -H "Authorization: Bearer $ALLWIT_API_KEY" | jq -e '.status == "succeeded" or .status == "failed"' >/dev/null; do sleep 10; done
curl https://www.allwit.ai/api/v1/videos/generations/$JOB/content -H "Authorization: Bearer $ALLWIT_API_KEY" --output boat.mp4const headers = { Authorization: `Bearer ${process.env.ALLWIT_API_KEY}`, "Content-Type": "application/json" };
const base = "https://www.allwit.ai/api/v1";
const job = await (await fetch(`${base}/videos/generations`, { method: "POST", headers, body: JSON.stringify({ model: "<video model id>", prompt: "A paper boat drifting on a calm pond at sunrise", duration: 5 }) })).json();
let status = job;
while (status.status === "queued" || status.status === "running") {
await new Promise((r) => setTimeout(r, 10_000));
status = await (await fetch(`${base}/videos/generations/${job.id}`, { headers })).json();
}
if (status.status === "succeeded") {
const video = await fetch(`${base}${status.content_url.replace("/api/v1", "")}`, { headers });
await fs.promises.writeFile("boat.mp4", Buffer.from(await video.arrayBuffer()));
}The OpenAI SDKs have no video endpoint, so these calls use plain HTTP; everything else about the key and the base URL is the same.