estimate_cost
Estimate the price of an operation
Returns the exact USD price this API would charge for an operation on an input of the given size, without fetching or processing anything. Free. Use it before paying: send X-Max-Cost-USD on the real request to have the API refuse (412) instead of charging more than you allowed. The list price is returned even when the request could end up free (free tier, or a compress that does not shrink the file).
Responses:
200: Successful Response (Success Response) Content-Type: application/json
Example Response:
{
"operation": "Operation",
"price_usd": 1.0,
"base_usd": 1.0,
"surcharges_usd": {},
"size_multiplier": 1.0,
"within_free_tier": true,
"free_tier_remaining": 1,
"currency": "Currency",
"network": "Network"
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Requested output format; only avif changes the price. | |
| operation | Yes | Operation to price. One of resize, compress, convert, crop, optimize_for_vision, optimize_generated, pipeline. analyze is always free. | |
| operations | No | For pipeline only: the ordered operations, each {type, format?}. Volume discount applies at 3+ operations. | |
| input_bytes | Yes | Size of the input image in bytes. Get it from analyze_image (free) if you do not know it. | |
| quality_target | No | Whether the request will use quality_target (SSIM search surcharge). |