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. The model string is resolved the same way a request is, at the caller's effective price (including contract pricing); when several routes could serve it at different prices, the most expensive is returned, because the serving route 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*stringprompt?stringVideo models; required, as in POST /v1/videos.
seconds?integerVideo models.
size?stringVideo models.
[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.
"exact""upper_bound"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"}