# Estimate cost

> Price an image or video request before creating it. The estimate endpoints validate the same body as generate and hold nothing.

`POST /image/generate/estimate` and `POST /video/generate/estimate` take the
same body as generate. They validate it the same way and return the price. No
task is created and nothing is held on your balance.

**REST**

```bash
curl https://api.mynth.io/image/generate/estimate \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"black-forest-labs/flux.2-pro","prompt":"A lighthouse at dusk","count":2}'
```

**CLI**

```bash
npx @mynthio/cli image generate --dry-run \
  -m black-forest-labs/flux.2-pro \
  -p "A lighthouse at dusk" \
  -c 2
```

**SDK**

```ts
import Mynth from "@mynthio/sdk";

const mynth = new Mynth();

// video only; the SDK has no image.estimate()
const quote = await mynth.video.estimate({
  model: "bytedance/seedance-2.0-mini",
  prompt: "A lighthouse beam sweeping over waves",
  duration: 5,
});
```

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

| Field           | Meaning                                                                                    |
| --------------- | ------------------------------------------------------------------------------------------ |
| `estimatedCost` | USD as a decimal string. The amount a real request would hold                              |
| `estimateKind`  | `exact` for an explicit model. `upper_bound` for image `auto`, which holds $0.20 per image |

Keep `estimatedCost` as a decimal. Parse it with a decimal library if you add
amounts up, because floats drift. `--dry-run` in the CLI prints the same
number, and `--json` prints the object. Local input files are not uploaded on
a dry run.

## Use it as a preflight

A body the model cannot serve fails here the same way it would on generate,
so the estimate also checks a request before you spend anything. Before a
batch, compare the total with `available` from `GET /balance`, which needs a
key with the `manage` scope.

The formulas behind the number, and how the hold becomes a charge, are on
[pricing](https://mynth.io/docs/pricing.md).

## Next steps

- [Pricing and billing](https://mynth.io/docs/pricing.md): the formulas, the balance, and holds.
- [Generate images](https://mynth.io/docs/guides/generate-images.md): send the body for real.
- [Video models](https://mynth.io/docs/models/video.md): the tiers and durations that set a video's price.
