The price of every request, in the response
Cost Breakdown
Get real-time cost information for each request directly in the response's usage object.
response.usage
"usage": {"prompt_tokens": 1240,"completion_tokens": 312,"cost": 0.00467,"cost_details": {"input_cost": 0.0031,"output_cost": 0.00157,"total_cost": 0.00467}}
Real cost, per request
01
In every response
No extra API call.
02
Itemized
Input, output and cache costs.
03
Streaming too
Cost arrives with the last chunk.
04
Bill your users
Exact cost per end user.
Built for
Usage billing
Charge customers what they use
Budget guards
Stop runaway agents in code
Feature costing
Know what each feature costs
Read the cost
app.ts
1const completion = await client.chat.completions.create({2 model: "gpt-4o",3 messages: [{ role: "user", content: "Hello!" }],4});5 6console.log(completion.usage?.cost);More in observability & cost
All featuresStart using Cost Breakdown today
One API key. Every model. Live in minutes.