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

StatusCodeMeaning
400invalid_requestA field is missing, unknown or out of range. message names the field and the allowed values.
400image_requiredVideo models need a start frame: send image: {mime_type, base64}.
402insufficient_creditsNot enough credits. Nothing was reserved; balance shows what you have.
409price_changedThe price moved since your estimate. Send the new credits value returned in the error.
413payload_too_largeBody over 300 KB. Shrink the start frame.
503model_unavailableThat model is temporarily down. Nothing was charged; try again later or pick another model.

All errors share one shape; see Errors.