Skip to content
exoticrouter.com ↗

Videos

A video takes minutes to make, so it is made as a job: start it, ask how it is doing, and fetch the file when it is done.

POST https://api.exoticrouter.com/v1/videos

Terminal window
curl https://api.exoticrouter.com/v1/videos \
-H "Authorization: Bearer $EXOTIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax/hailuo-2.3-fast",
"prompt": "A glass ribbon turning slowly in violet light"
}'

The answer comes at once and describes the job:

{
"id": "video_8sKq…",
"object": "video",
"model": "minimax/hailuo-2.3-fast",
"status": "queued",
"progress": 0,
"created_at": 1796169600
}
  • model has to be a video model: one whose formats in the list of models has videos. The rest of the body, such as the length asked for, goes to the model; which fields a model acts on depends on the model.
  • Keep the id exactly as it came. It is long, and it is the only way back to the video.

GET https://api.exoticrouter.com/v1/videos/{id}

Returns the same object with the job’s state as it is now.

status Meaning
queued Accepted, not started yet
in_progress Being made; progress runs from 0 to 100 where the model reports it
completed Done: the file can be fetched
failed Not made. The object has an error with the code generation_failed

GET https://api.exoticrouter.com/v1/videos/{id}/content

Returns the video itself, as video/mp4 or whatever the file is. Until the status is completed it answers 409 with the code not_ready. A failed video answers the same 409 for good, so decide on the status, not on the download.

cURL
ID="video_8sKq…"
until [ "$(curl -s https://api.exoticrouter.com/v1/videos/$ID \
-H "Authorization: Bearer $EXOTIC_API_KEY" | jq -r .status)" = "completed" ]; do
sleep 10
done
curl https://api.exoticrouter.com/v1/videos/$ID/content \
-H "Authorization: Bearer $EXOTIC_API_KEY" -o video.mp4
Python
import os, time, requests
BASE = "https://api.exoticrouter.com/v1"
auth = {"Authorization": f"Bearer {os.environ['EXOTIC_API_KEY']}"}
job = requests.post(f"{BASE}/videos", headers=auth, json={
"model": "minimax/hailuo-2.3-fast",
"prompt": "A glass ribbon turning slowly in violet light",
}).json()
while job["status"] in ("queued", "in_progress"):
time.sleep(10)
job = requests.get(f"{BASE}/videos/{job['id']}", headers=auth).json()
if job["status"] == "completed":
video = requests.get(f"{BASE}/videos/{job['id']}/content", headers=auth)
open("video.mp4", "wb").write(video.content)
else:
print(job.get("error"))
TypeScript
import fs from "node:fs";
const BASE = "https://api.exoticrouter.com/v1";
const auth = { Authorization: `Bearer ${process.env.EXOTIC_API_KEY}` };
let job = await fetch(`${BASE}/videos`, {
method: "POST",
headers: { ...auth, "Content-Type": "application/json" },
body: JSON.stringify({ model: "minimax/hailuo-2.3-fast", prompt: "A glass ribbon turning slowly in violet light" }),
}).then((r) => r.json());
while (job.status === "queued" || job.status === "in_progress") {
await new Promise((r) => setTimeout(r, 10_000));
job = await fetch(`${BASE}/videos/${job.id}`, { headers: auth }).then((r) => r.json());
}
if (job.status === "completed") {
const video = await fetch(`${BASE}/videos/${job.id}/content`, { headers: auth });
fs.writeFileSync("video.mp4", Buffer.from(await video.arrayBuffer()));
}
  • Asking for a video’s status or file takes a key of the account that started it, sent in a header. Any other key, or an id that is not whole, answers 404.
  • Each status call counts toward the key’s rate limit. Asking every ten seconds or so is plenty.
  • A finished video is kept for some days, not for good. Download it once it is done.
  • There is no call to list, cancel or delete videos.

Nothing is charged when a video is started. It is charged once, when it completes; a video that fails, or is not done within 30 minutes, costs nothing.

  • Images: Make a picture, or change one.
  • Audio: Text to speech and speech to text.