The price of every request, in the response

Cost Breakdown

Billed replies report their cost in the usage object, well beyond chat: embeddings, images, audio, search and video.

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

Beyond chat

Chat, images, audio, search and more.

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
const completion = await client.chat.completions.create({	model: "gpt-4o",	messages: [{ role: "user", content: "Hello!" }],}); console.log(completion.usage?.cost);
Read docs

More in observability & cost

All features

Start using Cost Breakdown today

One API key. Every model. Live in minutes.