Skip to content
Built in Lahore, PakistanHow we check the math
mathbehind

AI API Cost Calculator

Estimate the cost of OpenAI, Claude and Gemini API calls per request and per month, from tokens, words, code lines or characters, with prompt caching and batch discounts.

By Muhammad Ahmad, Software EngineerLinkedIn· figures checked

Your numbers

Prices and fees in this tool are in US dollars.

Standard prices, checked 29 September 2026 against each provider's pricing page.

Word and line conversions are estimates; each model's tokenizer differs.

System prompt, documents and conversation sent with each call.

The length of the reply the model writes.

For daily volume, multiply calls per day by 30.

%

The repeated part of each request, such as a fixed system prompt or a document you query many times.

%

Check your provider's current cache pricing. Some also charge extra to write to the cache.

%

Check the provider's current batch pricing for your model.

Cost per request

$0.02000

Projected monthly cost

$200.00

Input tokens per request
5,000
Output tokens per request
1,000
Input cost per request
$0.01000
Output cost per request
$0.01000
Monthly saving from caching and batch
$0.00
Total tokens per month
60,000,000
The math behind it
  1. Input

    5,000 × $2.00 ÷ 1Mequals$0.01000

  2. Output

    1,000 × $10.00 ÷ 1Mequals$0.01000

  3. Per month

    $0.02000 × 10,000equals$200.00

AI pricing pages quote a rate per million tokens, which doesn't answer the budgeting question: what does one call cost, and what will it cost at your volume? This calculator converts each model's published rates into a per-request and monthly cost. You can enter sizes in tokens, words, lines of code or characters, and model prompt caching and batch processing, which is where large-document workloads save the most.

Figures checked by Muhammad Ahmad against OpenAI API pricing, Claude API pricing and Gemini API pricing. Prices and rules change, so confirm with the official source before relying on them. How we check the math

How it works

Providers bill input tokens (everything you send: instructions, documents, conversation) and output tokens (the reply) at different rates. Cost per request = input tokens × input price + output tokens × output price, with both prices quoted per 1,000,000 tokens.

If you enter words, lines or characters, they're converted to tokens first. English averages about 1.33 tokens per word; Arabic and Urdu take roughly 2 to 3, because tokenizers are trained mostly on English. Code varies with the language and line length. For exact counts, use the provider's token counter and enter tokens.

Prompt caching charges a much lower rate for input the provider has seen recently, such as a long system prompt or a contract you ask many questions about. Enter the share of each request that repeats and the cached price as a share of the normal price. Batch processing trades speed for a discount on requests that can wait, like overnight document runs.

Monthly cost = cost per request × requests per month. Prices change often: the model list here was checked against official pricing pages on the date shown, and the cache and batch rates are yours to set from the provider's current page.

A worked example

Summarising a 10,000-word English document into a 1,000-word answer is about 13,300 input and 1,330 output tokens. On Claude Sonnet 5 ($2 input, $10 output per million), each call costs $0.0399, or $239.40 a month at 200 calls a day (6,000 a month). If half the input is served from cache at 10% of the input price, the cost drops to $0.02793 per call and $167.58 a month.

More examples

The default 10,000 requests (5,000 input and 1,000 output tokens each) cost $10 a month on GPT-6 Luna, $200 on GPT-6 Sol or Claude Sonnet 5, and $400 on Claude Opus 5.5.

With 80% of each prompt cached, GPT-6 Sol falls from $200 to $128, and output becomes most of the bill.

Common mistakes

  • Comparing input prices and ignoring output, which usually costs several times more.
  • Forgetting reasoning tokens, billed as output.
  • Using old prices; GPT-6 Sol and Luna halved OpenAI's mid and low tiers on 22 September 2026.
  • Ignoring caching and batch discounts.

Questions people ask

How many tokens is a word?

In English, about 1.33 tokens per word on average, or roughly 4 characters per token. Short common words are often one token; long or rare words split into several. Arabic, Urdu and many other languages use more tokens per word.

Why do output tokens cost more than input tokens?

Input tokens are processed together in one pass, but output tokens are generated one at a time, each needing its own pass through the model. That extra compute is why output is typically priced several times higher than input.

How much does prompt caching save?

It depends on how much of each request repeats and the provider's cache price. Cached input is often charged at a small fraction of the normal rate, so a workload that resends a long document or system prompt can cut its input cost by more than half. Some providers also charge to write to the cache.

Why are Arabic and Urdu more expensive per word?

Most tokenizers learned their vocabulary mainly from English text, so words in other scripts are split into more pieces. The price per token is the same, but each word costs more tokens, often two to three times as many.

When should I use batch processing?

For work that doesn't need an instant answer: summarising a document archive, tagging support tickets overnight, or running evaluations. Batch requests are usually returned within a day at a discount on the standard price.

Guides

In the news