Calculate

App Store

Download iCalc Photo Math Calculator

Take calculators with you and solve math faster on iPhone.

104

AI Token Cost Calculator

Estimate AI API token cost from input, cached input, and output token usage plus per-million pricing.

Sponsored

Inputs

AI Token Cost

Enter the token counts for one request and the pricing for your model in dollars per 1 million tokens.

Result

--

Result explanation

How to read this result

Visualization

Visual breakdown

Guide

Using the AI Token Cost Calculator

What the calculator does

Start here if you need to estimate AI API token cost from input, cached input, and output token usage plus per-million pricing and compare the outcome quickly.

It is especially helpful when the same question comes up often and you want one clean place to test different inputs.

Formula and calculation explanation

Enter Requests, Input tokens, Cached input tokens, Output tokens, Input price, Cached input price, and Output price. Those values let the page estimate AI API token cost from input, cached input, and output token usage plus per-million pricing.

This calculator prices each token bucket separately because many AI models bill input, cached input, and output tokens at different rates.

It first calculates the cost of one request from the entered token counts and per-million token prices, then multiplies that amount by the number of requests.

Per request cost

\[Cost_{request} = \frac{T_{in}R_{in} + T_{cache}R_{cache} + T_{out}R_{out}}{1{,}000{,}000}\]

T values are token counts and R values are prices in dollars per 1 million tokens.

Total cost

\[Cost_{total} = Requests \times Cost_{request}\]

Use the requests field to scale one-call pricing into a batch or workload estimate.

Real-world examples

  • Real-world setup: try requests 1, input tokens 150,000, cached input tokens 0, and output tokens 12,000 when you want to move from a rough question to a concrete scenario.
  • What-if example: rerun the same setup with a different input price to compare how much the headline answer moves.

Step-by-step walkthrough

  1. Enter Requests, Input tokens, Cached input tokens, Output tokens, Input price, Cached input price, and Output price.
  2. Check that each value is in the units named by the field labels.
  3. Click Calculate AI Token Cost. The calculator applies the method shown above and updates the answer instantly.
  4. Review the total cost and the supporting values for per request cost, input cost, output cost, cached input cost, and total tokens, then adjust one input at a time to compare scenarios cleanly.

FAQs

What does the total cost result mean?

The main result shown here is total cost. The calculator also returns per request cost, input cost, output cost, cached input cost, and total tokens so you can review the most useful supporting numbers at the same time.

How should I enter the inputs?

Use plain numeric values in the units or formats named by each input label.

Why might this calculator differ from another tool?

Differences usually come from rounding, unsupported inputs, or slightly different assumptions in another formula or workflow.

Common mistakes

  • Leaving a divisor, denominator, or base value at zero when the formula requires a nonzero reference.
  • Changing several inputs at once, which makes it harder to see which variable actually moved the result.

Edge cases

  • Zero denominators, undefined slopes, or impossible conversion bases can make the result undefined.
  • If a required field is left blank or contains an unsupported value, the calculator will not return a useful result until the input is corrected.

Interpretation of results

The main result shown here is total cost. The calculator also returns per request cost, input cost, output cost, cached input cost, and total tokens so you can review the most useful supporting numbers at the same time.

  • Treat the primary dollar figure as the headline answer, then use the supporting amounts to understand tradeoffs such as interest, savings, profit, or total cost.
  • The supporting metrics help you understand why the headline result looks the way it does and which tradeoffs sit behind it.
  • When you compare scenarios, change one key input at a time so you can tie each output change back to a specific assumption.

Related concepts and calculators

Related ideas for this page include unit consistency, throughput, conversions, scaling, and measurement.

Sponsored