---
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: "Create a generation"
description: "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."
---
# 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](https://cookstudio.ai/docs/models).

`POST https://app.cookstudio.ai/api/v1/generations`

## Request

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

```json
{"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](https://cookstudio.ai/docs/errors).

Canonical: https://cookstudio.ai/docs/reference/create-generation
