Reference
API documentation
Everything the buttons do is an HTTP call. One bearer token, JSON in and out.
Getting started
Your API key is in your dashboard. It is shown once at creation — we store only a one-way hash, so a lost key is replaced rather than recovered. Send it as a bearer token:
Authorization: Bearer ds_live_…
Content-Type: application/jsonBase URL: https://thinkrai.cloud
Idempotency
Every request that spends credits requires an Idempotency-Key header. Reuse the same key when retrying and you get the original result back, charged once. Without this, a reply lost to a flaky connection would be paid for twice — so it is required rather than optional.
Errors
| Status | Meaning |
|---|---|
| 401 | Unknown or missing key, or a deactivated account |
| 402 | Out of credits |
| 409 | The same idempotency key is already being processed |
| 422 | The request body cannot be used |
| 429 | Rate limited — retry shortly |
| 502 | Generation failed. The credit was refunded |
A 502 always means you were not charged — the credit is returned before the response is sent.
Endpoints
/v1/balanceHow many credits are left.
curl https://thinkrai.cloud/v1/balance \
-H "Authorization: Bearer ds_live_…"
{ "credits": 72, "lowWater": 5 }/v1/generate/description1 creditWrites a description from the product data and photographs you supply. Up to four images; more angles means less guessing.
curl https://thinkrai.cloud/v1/generate/description \
-H "Authorization: Bearer ds_live_…" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"brand": "Nike",
"title": "Free RN Flyknit Crimson",
"price": 2499,
"mrp": 3499,
"sizes": ["6","7","8","9"],
"imageUrls": ["https://…/front.jpg"]
}'
{
"description": "Nike Free RN Flyknit in Crimson. The upper is…",
"warnings": [],
"creditsCharged": 1,
"creditsRemaining": 71
}warnings lists any claim that survived our checks and could not be verified from the photographs. Show it to whoever approves the copy.
/v1/generate/descriptions/batch1 credit eachUp to 200 products at once, at half the token cost to us and the same price to you. Asynchronous — poll the returned job until it is ready.
curl https://thinkrai.cloud/v1/generate/descriptions/batch \
-H "Authorization: Bearer ds_live_…" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{ "items": [
{ "id": "sku-1", "brand": "Nike", "title": "…", "imageUrls": ["https://…"] },
{ "id": "sku-2", "brand": "Puma", "title": "…", "imageUrls": ["https://…"] }
] }'
{ "batchId": "…", "items": 2, "creditsCharged": 2, "pollAfterSeconds": 60 }curl https://thinkrai.cloud/v1/generate/descriptions/batch/{batchId} \
-H "Authorization: Bearer ds_live_…"
{
"ready": true,
"succeeded": 2,
"errored": 0,
"results": [{ "id": "sku-1", "description": "…" }],
"creditsRefunded": 0
}Charged up front, refunded per item that fails. Forty submitted and thirty-eight written costs thirty-eight.
/v1/enhance/photo5 creditsCleans up one photograph. Your original is untouched; you get a new image back. The download link expires — save the file, not the URL.
curl https://thinkrai.cloud/v1/enhance/photo \
-H "Authorization: Bearer ds_live_…" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{ "imageUrl": "https://…/front.jpg", "presetId": "white-background" }'
{
"url": "https://…",
"expiresInSeconds": 3600,
"creditsCharged": 5,
"creditsRemaining": 67
}Presets: white-background, studio-grey, cleanup. Or send customPrompt instead of presetId — up to 300 characters describing the background or design you want. Send exactly one of the two, never both. Either way the product itself is never altered — only the backdrop changes, described by you or picked from a preset.
Something missing?
Email support@thinkrai.cloud and tell us what you are building. We would rather add the endpoint than have you work around its absence.