WealthPulse.
Interactive guide · Business & Tech

How to Calculate AI API Cost

Token spend per request, per user and at scale, including cache savings.

Open as a plain tool
42,180
The formula

How this number is built

cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000
Step by step

Calculating it yourself

Step 1

Measure real token counts from a sample of production requests.

Step 2

Separate input from output — they are priced very differently.

Step 3

Apply prompt caching to the stable portion of your context.

Step 4

Divide by requests and by active users to get the two unit numbers that matter.

Step 5

Model a traffic multiple so a growth spike does not surprise the budget.

Questions

What people ask next

How do I reduce cost fastest?

Shorten outputs, cache the static prompt prefix, and route simple requests to a smaller model.

Are tokens the same as words?

No. English text averages roughly three-quarters of a word per token, and code is denser than prose.

Search intent

Searches this page answers

Related searchGoes to
openai python sdkAI API Cost Calculator
openai gpt-4.1 pricingAI API Cost Calculator
openai codex githubAI API Cost Calculator
openreviewAI API Cost Calculator
Keep going

Tools that follow from this one

Estimates, not advice. Every figure here is produced from the inputs you enter and the formula printed on the page. Rules differ by state, carrier, lender and contract, so use these numbers to prepare for a conversation with a qualified professional rather than to replace one. See our full disclaimer.