POST /api/v1/estimate estimates a chat request’s cost. It is free and requires no API key. Use estimate.create in either SDK.
cURL
Parameters
Response
estimated_cents/estimated_cost— a realistic mid-point. The completion side uses a heuristic of 40% of the prompt tokens (at least 64), capped atmax_tokensor 2,048.estimated_max_cents/estimated_max— the pre-authorization hold a real request with these messages andmax_tokenswould reserve. The hold is a reserve, not a ceiling: the request settles to actual usage and the unused portion is returned. Use it to sizerouting.max_cost_usd— a cap below the hold is rejected with400 max_cost_exceeded. See Spend controls.
cheaper_alternatives lists up to three catalog models that would cost less at this exact payload, sorted by savings. model_comparison appears only when you pass models. The numbers in the sample are illustrative; the endpoint returns live values.
Limits
- 30 requests per minute per client IP (
429 rate_limit_exceededwithretry_afterand aRetry-Afterheader). - Unknown model IDs return
400 validation_errorwith the closest matching ID in the message.
Live price sheet
GET /api/v1/pricing for every model’s metered rates.Cap a request
routing.max_cost_usd turns an estimate into a hard ceiling.