# Estimate cost

> Prices a request without running it. Takes the same body as generate, validates it the same way, and charges nothing. With `model: "auto"` the figure is an upper bound, because the model is not chosen until the task runs.

The same body as [generate](https://mynth.io/docs/api-reference/endpoints/image/generate.md),
validated the same way, priced rather than run. Nothing is created or held.
Use it to show a cost before a user commits, or to reject a request that would
break a budget.

With an explicit model the figure is exact. With `model: "auto"` it is the flat
$0.20 per image that `auto` holds, marked `upper_bound`.
[Estimate cost](https://mynth.io/docs/guides/estimate-cost.md) has the patterns.

`POST /image/generate/estimate`

**Auth:** API key or OAuth token

## Request body

- `prompt` (required, string) — Positive prompt. ≥ 1 characters, ≤ 8192 characters. Example `"Cute Cat"`.
- `model` (string) — Default `"auto"`. One of: `"alibaba/qwen-image-2.0"`, `"alibaba/qwen-image-2.0-pro"`, `"alibaba/qwen-image-3.0"`, `"alibaba/qwen-image-3.0-pro"`, `"auto"`, `"black-forest-labs/flux-1-schnell"`, `"black-forest-labs/flux.1-dev"`, `"black-forest-labs/flux.2-dev"`, `"black-forest-labs/flux.2-flex"`, `"black-forest-labs/flux.2-klein-4b"`, `"black-forest-labs/flux.2-max"`, `"black-forest-labs/flux.2-pro"`, `"bria/fibo-edit-1.5"`, `"bria/fibo-generate-1.5"`, `"bytedance/seedream-5.0-lite"`, `"bytedance/seedream-pro"`, `"circlestone-labs/anima"`, `"goofy-ai/prefect-pony-xl-lora"`, `"google/gemini-3-pro-image-preview"`, `"google/gemini-3.1-flash-image"`, `"google/gemini-3.1-flash-lite-image"`, `"imagineart/imagineart-1.5-pro"`, `"imagineart/imagineart-2.0"`, `"john6666/bismuth-illustrious-mix"`, `"klingai/kling-image-3.0"`, `"klingai/kling-image-o3"`, `"krea/krea-2-large"`, `"krea/krea-2-medium"`, `"krea/krea-2-turbo"`, `"luma/uni-1"`, `"luma/uni-1-max"`, `"maxfeifei8/one-obsession"`, `"meta/muse-image"`, `"microsoft/mai-image-2.6"`, `"microsoft/mai-image-2.6-flash"`, `"minimax/h3"`, `"openai/gpt-image-2"`, `"openai/gpt-image-2.5-flare"`, `"openai/gpt-image-2.5-sunburst"`, `"purplesmartai/pony-diffusion-v6-xl"`, `"recraft/recraft-v4"`, `"recraft/recraft-v4-pro"`, `"reve/reve"`, `"reve/reve-remix"`, `"sourceful/riverflow-2.0-pro"`, `"tongyi-mai/z-image"`, `"tongyi-mai/z-image-turbo"`, `"wan/wan2.6-image"`, `"wan/wan2.7-image"`, `"wan/wan2.7-image-pro"`, `"xai/grok-imagine-image"`, `"xai/grok-imagine-image-2.0"`, `"xai/grok-imagine-image-quality"`. Example `"black-forest-labs/flux.2-pro"`.
- `count` (number) — Default `1`. ≥ 1, ≤ 20.
- `access` (object) — Controls whether the create-task response should include a short-lived Public Access Token. That token can be passed to browser or client-side code for polling task status and task images without exposing your API key.
  - `pat` (required, object)
    - `enabled` (boolean) — Default `true`.
- `destination` (string) — ≥ 1 characters, ≤ 64 characters. Example `"bunny-prod"`.
- `inputs` ((string | object)[]) — ≤ 20 items.
  - **source + type**
    - `source` (required, object)
      - `type` (required, "url")
      - `url` (required, string)
    - `type` (required, "image")
    - `as` (string) — One of: `"auto"`, `"reference"`, `"source"`.
- `magic_prompt` (boolean)
- `metadata` (object)
- `negative_prompt` (string) — ≤ 8192 characters.
- `output` (object)
  - `format` (string) — One of: `"jpg"`, `"png"`, `"webp"`.
- `rating` (object | boolean) — One of: `true`.
  - **nsfw_sfw**
    - `mode` ("nsfw_sfw") — Default `"nsfw_sfw"`.
  - **custom**
    - `levels` (required, object[]) — ≥ 2 items, ≤ 7 items.
      - `description` (required, string) — ≥ 1 characters, ≤ 150 characters.
      - `value` (required, string) — ≥ 1 characters, ≤ 24 characters.
    - `mode` (required, "custom")
- `size` (object | string) — One of: `"16:9"`, `"16:9_4k"`, `"1:1"`, `"1:1_4k"`, `"1:2"`, `"1:2_4k"`, `"21:9"`, `"21:9_4k"`, `"2:1"`, `"2:1_4k"`, `"2:3"`, `"2:3_4k"`, `"3:2"`, `"3:2_4k"`, `"3:4"`, `"3:4_4k"`, `"4:3"`, `"4:3_4k"`, `"4:5"`, `"4:5_4k"`, `"5:4"`, `"5:4_4k"`, `"9:16"`, `"9:16_4k"`, `"auto"`, `"landscape"`, `"landscape_wide"`, `"portrait"`, `"portrait_tall"`, `"square"`.
  - **aspect_ratio**
    - `aspectRatio` (required, string) — One of: `"16:9"`, `"1:1"`, `"1:2"`, `"21:9"`, `"2:1"`, `"2:3"`, `"3:2"`, `"3:4"`, `"4:3"`, `"4:5"`, `"5:4"`, `"9:16"`.
    - `type` (required, "aspect_ratio")
    - `scale` (string) — Default `"base"`. One of: `"4k"`, `"base"`.
  - **auto**
    - `type` (required, "auto")
- `webhook` (object)
  - `custom` (object[]) — ≥ 1 items, ≤ 5 items.
    - `url` (required, string)
  - `dashboard` (boolean) — Set to false to disable dashboard-managed webhooks for this task. Request-level custom webhooks are still sent.

## Response

### 200 — Image generation request validated and cost estimated

- `data` (required, object)
  - `currency` (required, "usd")
  - `estimateKind` (required, string) — "exact" when the model is pinned; "upper_bound" for `model: "auto"`, which reserves a flat per-image ceiling until a concrete model is selected. One of: `"exact"`, `"upper_bound"`.
  - `estimatedCost` (required, string) — Estimated cost in USD for the request. Nothing is generated or charged. Example `"0.03"`.

```json
{
  "data": {
    "currency": "usd",
    "estimateKind": "exact",
    "estimatedCost": "0.03"
  }
}
```

### 400 — Validation Error

- `success` (required, false)
- `error` (required, array)
- `data` (required, any)

```json
{
  "success": false,
  "error": []
}
```

## Request samples

### cURL

```bash
curl -X POST https://api.mynth.io/image/generate/estimate \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Cute Cat",
    "model": "black-forest-labs/flux.2-pro",
    "destination": "bunny-prod"
  }'
```

### JavaScript

```ts
const response = await fetch("https://api.mynth.io/image/generate/estimate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYNTH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "prompt": "Cute Cat",
    "model": "black-forest-labs/flux.2-pro",
    "destination": "bunny-prod"
  }),
});

const { data } = await response.json();
```

The full schema for this endpoint is in the [OpenAPI document](https://api.mynth.io/openapi.json).
