Hello World
Your first generation in under 2 minutes
Prefer a typed client? Use the TypeScript SDK or Python SDK for typed requests, upload helpers, and built-in polling.
Get your API key
Create an API key in Settings → API Keys and export it:
export THANKYOU_API_KEY="tk_your_key_here"Create your first generation
curl -X POST https://api.thankyouai.com/open/v1/generate \
-H "Authorization: Bearer $THANKYOU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana/pro/text-to-image",
"input": {
"prompt": "A futuristic cityscape with flying cars, 8k",
"aspect_ratio": "1:1"
}
}'import os, time, requests
API = "https://api.thankyouai.com/open/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['THANKYOU_API_KEY']}"}
# Submit
generation = requests.post(
f"{API}/generate",
headers={**HEADERS, "Content-Type": "application/json"},
json={
"model": "google/nano-banana/pro/text-to-image",
"input": {
"prompt": "A futuristic cityscape with flying cars, 8k",
"aspect_ratio": "1:1",
},
},
).json()
# Poll until complete
while generation["status"] not in ("succeeded", "failed", "cancelled"):
time.sleep(2)
generation = requests.get(
f"{API}/generations/{generation['id']}",
headers=HEADERS,
).json()
print(generation["output"][0]["url"])const API = "https://api.thankyouai.com/open/v1";
const headers = {
Authorization: `Bearer ${process.env.THANKYOU_API_KEY}`,
"Content-Type": "application/json",
};
// Submit
let generation = await fetch(`${API}/generate`, {
method: "POST",
headers,
body: JSON.stringify({
model: "google/nano-banana/pro/text-to-image",
input: {
prompt: "A futuristic cityscape with flying cars, 8k",
aspect_ratio: "1:1",
},
}),
}).then((r) => r.json());
// Poll until complete
while (!["succeeded", "failed", "cancelled"].includes(generation.status)) {
await new Promise((r) => setTimeout(r, 2000));
generation = await fetch(`${API}/generations/${generation.id}`, {
headers: { Authorization: headers.Authorization },
}).then((r) => r.json());
}
console.log(generation.output[0].url);Response
Every call returns the same generation envelope:
{
"id": "gen_8f3k2m9x",
"status": "succeeded",
"model": "google/nano-banana/pro/text-to-image",
"output": [
{
"url": "https://assets.thankyou.ai/gen/8f3k2m9x.png",
"mime_type": "image/png",
"width": 1024,
"height": 1024
}
],
"error": null,
"usage": {
"credits_consumed": 0.5,
"currency": "points"
},
"progress": 1.0,
"created_at": "2026-03-29T10:00:00Z",
"started_at": "2026-03-29T10:00:01Z",
"finished_at": "2026-03-29T10:00:03Z"
}output is an array — each item has a mime_type field to identify the media type, along with type-specific metadata like width, height, duration.
Long-running generations
Video and some audio workloads take longer. ThankYou returns a generation id immediately — poll the status endpoint or use webhooks.
# Step 1: submit
curl -X POST https://api.thankyouai.com/open/v1/generate \
-H "Authorization: Bearer $THANKYOU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bytedance/seedance/v2/text-to-video",
"input": {
"prompt": "A cat playing piano in a jazz club",
"duration": 5,
"aspect_ratio": "16:9"
}
}'
# → {"id":"gen_abc123","status":"queued", ...}
# Step 2: poll lightweight status
curl https://api.thankyouai.com/open/v1/generations/gen_abc123/status \
-H "Authorization: Bearer $THANKYOU_API_KEY"
# Step 3: fetch the full entity when done
curl https://api.thankyouai.com/open/v1/generations/gen_abc123 \
-H "Authorization: Bearer $THANKYOU_API_KEY"Use GET /generations/{id}/status for high-frequency polling (returns only id, status, progress). Use GET /generations/{id} when you need the full output.
Next steps
TypeScript SDK
Recommended JavaScript/TypeScript client with typed resources and polling helpers.
Python SDK
Official Python client with typed resources and polling helpers.
API Overview
Endpoints, lifecycle, and model selector rules.
Async Inference
Polling, cancel, retry, and webhook delivery.
Models
Model catalog and input schemas.