# Price it first

`POST /v1/generations/quote` takes the same body as a submit and answers with what it would cost. It is free: nothing is created and nothing is held. Quote the exact request, then pass the quote as `max_cost_usd`.

```bash cURL
curl -s -X POST https://vidlab.ai/v1/generations/quote \
  -H "Authorization: Bearer $VIDLAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seedance-2.5",
    "input": { "resolution": "720p", "duration": 5, "aspect_ratio": "9:16" }
  }'
```

```python Python
import os, requests

r = requests.post(
    "https://vidlab.ai/v1/generations/quote",
    headers={"Authorization": f"Bearer {os.environ['VIDLAB_API_KEY']}"},
    json={
        "model": "seedance-2.5",
        "input": {"resolution": "720p", "duration": 5, "aspect_ratio": "9:16"},
    },
)
quote = r.json()["data"]
print(quote["quoted_usd"], quote["enough_credit"])
```

```js JavaScript
const res = await fetch("https://vidlab.ai/v1/generations/quote", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VIDLAB_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "seedance-2.5",
    input: { resolution: "720p", duration: 5, aspect_ratio: "9:16" },
  }),
});
const { data: quote } = await res.json();
console.log(quote.quoted_usd, quote.enough_credit);
```

```json
{
  "data": {
    "object": "quote",
    "model": "seedance-2.5",
    "variant": "720p",
    "unit": "per_second",
    "units": 5,
    "price_usd": 1.05,
    "quoted_usd": 1.05,
    "reserved_usd": 1.05,
    "estimated_seconds": 90,
    "available_usd": 25,
    "enough_credit": true
  }
}
```

| Field | Type | What it is |
| - | - | - |
| `quoted_usd` | number | What a success is charged. |
| `reserved_usd` | number | What a submit would hold on your balance while it runs. Released if it fails. |
| `estimated_seconds` | number | How long the model usually takes. Compare it with `max_wait_s`. |
| `available_usd` | number | What your balance can spend now. |
| `enough_credit` | boolean | Whether `available_usd` covers `reserved_usd`. |
| `variant`, `unit`, `units` | | The priced option, what one unit is, and how many units the request counts. See [Model list](/vidlab-api/docs/model-list#units). |

Content fields (`prompt`, `images`, `video`) may be left out: they do not change the price. A request the model would refuse answers the same `400` or `422` as a submit.

## No key yet

`POST /v1/estimate` answers the same price without a key and without your balance. Free, and rate limited per address.

```bash cURL
curl -s -X POST https://vidlab.ai/v1/estimate \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-image-2", "input": {"resolution": "1k", "n": 1}}'
```

```json
{ "data": { "model": "gpt-image-2", "variant": "1k", "unit": "per_image", "units": 1, "price_usd": 0.03 } }
```
