---
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: "Estimate a generation"
description: "Credit price of a single-model generation. Nothing is charged. Fields: model, prompt, seconds, count, characters (speech only, instead of prompt), aspect_ratio, resolution."
---
# Estimate a generation

Credit price of a single-model generation. Nothing is charged. Fields: `model`, `prompt`, `seconds`, `count`, `characters` (speech only, instead of `prompt`), `aspect_ratio`, `resolution`.

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

## Request

```bash
curl https://app.cookstudio.ai/api/v1/generations/estimate -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model": "gpt-image-25", "aspect_ratio": "16:9"}'
```

## Response

```json
{"object": "estimate", "model": "gpt-image-25", "credits": 3, "balance": 1240, "enough_credits": true, "available": true}
```

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | A field is missing, unknown or out of range. `message` names the field and the allowed values. |
| 401 | `unauthorized` | Missing, wrong or revoked key. |
| 503 | `service_unavailable` | Production is paused or unreachable. Nothing was charged; retry in a few minutes. |

All errors share one shape; see [Errors](https://cookstudio.ai/docs/errors).

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