Get started
Quickstart
1. Get a key
Sign in and open API Keys. Create a key; it starts with cs_live_ and is shown only once. Put it in an environment variable:
export KEY=cs_live_… # your keyCheck it works:
curl https://app.cookstudio.ai/api/v1/me -H "Authorization: Bearer $KEY"2. Ask for the price
curl https://app.cookstudio.ai/api/v1/videos/estimate -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"topic": "Why the Mary Celeste was found empty", "duration_min": 1, "language": "en"}'
# → {"object": "estimate", "credits": 50, "enough_credits": true, …}3. Order it
Send the same fields plus the credits value you just got:
curl https://app.cookstudio.ai/api/v1/videos -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: my-first-video-001" \
-d '{"topic": "Why the Mary Celeste was found empty", "duration_min": 1, "language": "en", "credits": 50}'
# → 201 {"id": "6f1c…", "status": "queued", …}4. Wait and download
curl https://app.cookstudio.ai/api/v1/videos/6f1c… -H "Authorization: Bearer $KEY" # poll about once a minute until "status": "done"
curl https://app.cookstudio.ai/api/v1/videos/6f1c…/download -H "Authorization: Bearer $KEY" # → {"url": "https://…", "expires_at": "…"}The same in Node.js
const API = "https://app.cookstudio.ai/api/v1";
const h = { Authorization: `Bearer ${process.env.KEY}`, "Content-Type": "application/json" };
const body = { topic: "Why the Mary Celeste was found empty", duration_min: 1, language: "en" };
const est = await (await fetch(`${API}/videos/estimate`, { method: "POST", headers: h, body: JSON.stringify(body) })).json();
const video = await (await fetch(`${API}/videos`, { method: "POST", headers: { ...h, "Idempotency-Key": crypto.randomUUID() },
body: JSON.stringify({ ...body, credits: est.credits }) })).json();
let v = video;
while (!["done", "failed", "cancelled", "abandoned"].includes(v.status)) {
await new Promise((r) => setTimeout(r, 60_000));
v = await (await fetch(`${API}/videos/${video.id}`, { headers: h })).json();
}
if (v.status === "done") console.log((await (await fetch(`${API}/videos/${video.id}/download`, { headers: h })).json()).url);The same in Python
import os, time, uuid, requests
API = "https://app.cookstudio.ai/api/v1"
h = {"Authorization": f"Bearer {os.environ['KEY']}"}
body = {"topic": "Why the Mary Celeste was found empty", "duration_min": 1, "language": "en"}
est = requests.post(f"{API}/videos/estimate", headers=h, json=body).json()
video = requests.post(f"{API}/videos", headers={**h, "Idempotency-Key": str(uuid.uuid4())},
json={**body, "credits": est["credits"]}).json()
while (v := requests.get(f"{API}/videos/{video['id']}", headers=h).json())["status"] not in ("done", "failed", "cancelled", "abandoned"):
time.sleep(60)
if v["status"] == "done":
print(requests.get(f"{API}/videos/{video['id']}/download", headers=h).json()["url"])Next: all video fields, or generate a single image or clip.