Estimate request cost
Estimates what a request would cost without sending it or charging the account. Send the body you would send to the model's endpoint. Video models are priced exactly as POST /v1/videos freezes the job price, from seconds, size and media; text to speech is priced by the characters of input; chat models get an upper bound from the text of messages and max_tokens. Image models are estimated from the output tokens per image the provider publishes for the requested quality and size (listed in limits.image of GET /v1/models), times n, plus the estimated tokens of prompt; reference images of edits are not included. Image models, sizes or qualities without published numbers return confidence: unavailable with zero cost. The model string is resolved the same way a request is, at the prices your account pays; when several providers could serve it at different prices, the most expensive is returned, because the serving provider depends on availability at request time. Time-window pricing (peak/off-peak) is resolved at the current UTC time.
ApiKeyAuthAuthorization<token>application/json- body
The body you would send to the model's endpoint; fields the estimate does not read are ignored.
input?stringText to speech models, the text to read aloud.
max_completion_tokens?integermax_tokens?integermedia?array<>Video models.
messages?array<unknown>Chat models.
model*stringn?integerImage models, the number of images.
1 <= value1prompt?stringVideo models, required as in POST /v1/videos; image models, the prompt whose text tokens are estimated.
quality?stringImage models, such as low, medium or high. A missing quality or auto lets the model choose, so the estimate uses the highest published quality for the size and returns upper_bound.
seconds?integerVideo models.
size?stringVideo models; image models, one of the sizes in the model's limits.image.output_tokens, such as 1024x1024, 1536x1024 or 1024x1536. A missing size or auto gives unavailable.
[key: string]?anyCost estimate.
application/json- response
confidence*stringexact is what the request is charged (for video, the price the job freezes); upper_bound is the most it can cost; estimate is an image request whose output size is fixed by the provider's published table and whose prompt tokens are estimated, so the charge can differ slightly; unavailable means no price can be given before the request runs, and the costs and credits are zero.
"exact""upper_bound""estimate""unavailable"credits*integerThe estimate in Credits, the number in max_total_cost.
estimated_input_cost*stringestimated_input_tokens?integermax_output_cost*stringmax_output_tokens?integermax_total_cost*stringmodel*stringcurl -X POST 'https://api.ohmygpt.com/v1/cost-estimates' \ -H 'Content-Type: application/json' \ -d '{ "model": "string"}'{ "confidence": "exact", "credits": 0, "estimated_input_cost": "string", "estimated_input_tokens": 0, "max_output_cost": "string", "max_output_tokens": 0, "max_total_cost": "string", "model": "string"}