---
agent:
  instructions: "Use this search API to find relevant Cook Studio content (product, pricing, FAQ, blog articles, example videos) with keywords or natural-language queries instead of crawling pages. Results are returned in Markdown."
  endpoint: "https://cookstudio.ai/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Quickstart"
description: "Get a key, check the price and order your first video in five minutes."
---
# Quickstart

## 1. Get a key

Sign in and open [API Keys](https://app.cookstudio.ai/api-keys). Create a key; it starts with `cs_live_` and is shown only once. Put it in an environment variable:

```bash
export KEY=cs_live_…   # your key
```

Check it works:

```bash
curl https://app.cookstudio.ai/api/v1/me -H "Authorization: Bearer $KEY"
```

## 2. Ask for the price

```bash
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:

```bash
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

```bash
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

```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

```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](https://cookstudio.ai/docs/videos#fields), or generate a single [image or clip](https://cookstudio.ai/docs/generations).

Canonical: https://cookstudio.ai/docs/quickstart
