API reference
Create a generation
Generate one video clip, image, voiceover or music track with one model. Fields: model, prompt (required), seconds, count, aspect_ratio, resolution, image (video models), credits. Allowed values per model are on each model page.
POST https://app.cookstudio.ai/api/v1/generations
Request
curl https://app.cookstudio.ai/api/v1/generations -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"model": "gpt-image-25", "prompt": "A red fox in fresh snow, golden hour", "aspect_ratio": "16:9"}'Response
{"id": "a91e…", "object": "generation", "model": "gpt-image-25", "type": "image", "status": "running", "credits": 3, "error_type": null, "test_mode": false, "created_at": "…", "balance": 1237}Without credits the current price is accepted automatically. Send the value from /generations/estimate to lock it.
Errors
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A field is missing, unknown or out of range. message names the field and the allowed values. |
| 400 | image_required | Video models need a start frame: send image: {mime_type, base64}. |
| 402 | insufficient_credits | Not enough credits. Nothing was reserved; balance shows what you have. |
| 409 | price_changed | The price moved since your estimate. Send the new credits value returned in the error. |
| 413 | payload_too_large | Body over 300 KB. Shrink the start frame. |
| 503 | model_unavailable | That model is temporarily down. Nothing was charged; try again later or pick another model. |
All errors share one shape; see Errors.