Skip to main content

AI Token Cost Calculator

AI & APIs

Price the prompt, not the guess.

Interactive Tool
Live Calculation

AI Token Cost Calculator

Cost = input tokens ÷ 1M × input price + output tokens ÷ 1M × output price

Evaluated Formula:Cost = input tokens ÷ 1M × input price + output tokens ÷ 1M × output price
Guidance:
Prices change. Enter the current per-million-token rates from your provider rather than relying on a number baked into a calculator.
Output tokens usually cost several times more than input tokens, so a long answer can dominate the bill even when the prompt is short.
Count tokens with the provider’s own tokenizer or token-counting endpoint; a rough character-to-token ratio is not accurate enough for budgeting.
Cost per 1,000 requests (USD)
13.5

Calculated instantly

Cost per request (cents)1.35 ¢
Input cost per request (cents)0.6 ¢
Output cost per request (cents)0.75 ¢
Monthly cost (USD)135
Monthly tokens25,000,000 tokens

Embed this calculator

Put this calculator on your own site with the snippet below. The frame contains the tool only, reports its own height, and carries a visible link back to the full page. Embedding is free; keep the attribution link as it is, and do not wrap the frame in a way that hides it.

Preparing the embed code for this page...

What This Calculator Does

The AI Token Cost Calculator estimates what an LLM API call costs from its input and output token counts and the price you pay per million tokens. It is deliberately pricing-agnostic: you enter the current rates, so the result stays correct when a provider changes its price list.

How It Works

Providers price input and output tokens separately, usually per million tokens. Input cost is input tokens divided by one million, multiplied by the input price. Output cost is the same calculation with the output figures. Adding them gives the cost per request, and multiplying by monthly requests gives the running cost.

Example

A request with 2,000 input tokens and 500 output tokens, at $3 per million input and $15 per million output, costs $0.006 for input and $0.0075 for output. That is $0.0135 per request — 1.35 cents — or $13.50 per 1,000 requests and $135 a month at 10,000 requests, with an effective blended rate of $5.40 per million tokens.

Formula

Input cost
input tokens ÷ 1,000,000 × input price
Output cost
output tokens ÷ 1,000,000 × output price
Cost per request
input cost + output cost
Monthly cost
cost per request × requests per month

Reading the Results

Cost per request (cents)

The marginal API cost of one request, in cents, at the token counts and prices you entered. It excludes retries, caching discounts, and any minimum charges.

Monthly cost (USD)

The cost per request multiplied by your monthly volume. Use it as a budget baseline, then add headroom for retries, development traffic, and price changes.

Sources and References

  • OpenAI — Tokenizer and token counting

    How text is split into tokens

    Explains why token counts differ from word counts and why the provider’s tokenizer is the accurate measure.

  • Anthropic — Token counting

    Input and output token accounting

    Documents that input and output tokens are counted and priced separately.

  • Google Cloud — Gemini API pricing

    Per-million-token pricing structure

    An example of the per-million-token convention used by this calculator.

References identify the method or data behind this calculator. Where a standard or tariff changes, the current edition applies, and the assumptions stated above take precedence over a remembered figure.

Frequently Asked Questions

What is a token?

A token is a chunk of text — often a word, part of a word, or punctuation — that a language model processes as one unit. A rough English rule is about four characters per token, but the exact split depends on the provider’s tokenizer.

Why are input and output prices different?

Output generation is more computationally expensive than reading a prompt, so providers usually charge several times more per output token. Some also charge differently for cached input, batch requests, or long contexts.

Why does the calculator ask me to enter the price?

Because model prices change frequently and vary by provider, region, and tier. Hard-coding a rate would make the tool wrong the moment a price list changed. Enter the current published rate and the result stays accurate.

Does this include retries and failed requests?

No. It prices successful calls at the token counts you enter. Failed requests may still consume tokens, and retries double the cost, so add a margin if your application retries aggressively or streams partial output.