OhMyGPT
Billing

Estimate request cost

POST
/v1/cost-estimates

Estimates the upper-bound request cost without sending a provider request or charging the account. The model string is resolved the same way a request is, and the estimate uses the most expensive of the routes that could serve it at the caller's effective price (including contract pricing), because the serving route depends on availability at request time. Time-window pricing (peak/off-peak) is resolved at the current UTC time, so the estimate uses the tier that a request would be billed at right now.

授权

ApiKeyAuth
headerAuthorization<token>

请求主体

application/json
  1. body
max_completion_tokens?integer
max_tokens?integer
messages?array<unknown>
model*string

响应主体

Cost estimate.

application/json
  1. response
confidence*string
estimated_input_cost*string
estimated_input_tokens?integer
max_output_cost*string
max_output_tokens?integer
max_total_cost*string
model*string
示例请求
curl -X POST 'https://api.ohmygpt.com/v1/cost-estimates' \  -H 'Content-Type: application/json' \  -d '{  "model": "string"}'
示例响应
{  "confidence": "string",  "estimated_input_cost": "string",  "estimated_input_tokens": 0,  "max_output_cost": "string",  "max_output_tokens": 0,  "max_total_cost": "string",  "model": "string"}