OhMyGPT
Billing

Estimate request cost

POST
/v1/cost-estimates

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.

Authorization

ApiKeyAuth
headerAuthorization<token>

Request Body

application/json
  1. body

The body you would send to the model's endpoint; fields the estimate does not read are ignored.

input?string

Text to speech models, the text to read aloud.

max_completion_tokens?integer
max_tokens?integer
media?array<>

Video models.

messages?array<unknown>

Chat models.

model*string
prompt?string

Video models; required, as in POST /v1/videos.

seconds?integer

Video models.

size?string

Video models.

[key: string]?any

Response Body

Cost estimate.

application/json
  1. response
confidence*string

exact is what the request is charged (for video, the price the job freezes); upper_bound is the most it can cost.

Value in"exact""upper_bound"
credits*integer

The estimate in Credits, the number in max_total_cost.

estimated_input_cost*string
estimated_input_tokens?integer
max_output_cost*string
max_output_tokens?integer
max_total_cost*string
model*string
Example Request
curl -X POST 'https://api.ohmygpt.com/v1/cost-estimates' \  -H 'Content-Type: application/json' \  -d '{  "model": "string"}'
Example Response
{  "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"}