Skip to content

Business

Instant, private, and free

AI Token Cost Calculator.

Estimate API pricing for popular LLM models like GPT-4o, Claude 3.5 Sonnet, and DeepSeek, with support for batch calls and agent loops.

On-device calculationNo signup
01

Set your values

Results update as you type.

Estimate Tokens from Text

API Cost Estimates

Cost per Run

$0.0210

Cost per Selected Period

$2.10

Total Tokens per Run

Input:2,000
Output:1,000
Total:3,000

Daily Cost

$0.07

10,000 tokens/day

Monthly Cost

$2.10

300,000 tokens/mo

Yearly Cost

$25.55

3,650,000 tokens/yr

Budget Longevity

Total runs allowed within budget

4,761 runs

Your budget will last for about 47.6 months

Model Cost Comparison (per Run)

Llama 3.1 8BMeta
$0.05/1M prompt • $0.08/1M completion
$0.00018
$0.02/mo
Gemini 1.5 FlashGoogle
$0.075/1M prompt • $0.3/1M completion
$0.00045
$0.04/mo
DeepSeek-V3DeepSeek
$0.14/1M prompt • $0.28/1M completion
$0.00056
$0.06/mo
GPT-4o miniOpenAI
$0.15/1M prompt • $0.6/1M completion
$0.00090
$0.09/mo
Llama 3.1 70BMeta
$0.59/1M prompt • $0.79/1M completion
$0.00197
$0.20/mo
DeepSeek-R1DeepSeek
$0.55/1M prompt • $2.19/1M completion
$0.00329
$0.33/mo
Claude 3.5 HaikuAnthropic
$0.8/1M prompt • $4/1M completion
$0.00560
$0.56/mo
Gemini 1.5 ProGoogle
$1.25/1M prompt • $5/1M completion
$0.00750
$0.75/mo
Llama 3.1 405BMeta
$2.66/1M prompt • $2.66/1M completion
$0.00798
$0.80/mo
GPT-4oOpenAI
$2.5/1M prompt • $10/1M completion
$0.01500
$1.50/mo
Claude 3.5 SonnetAnthropic
$3/1M prompt • $15/1M completion
$0.02100
$2.10/mo
Claude 3 OpusAnthropic
$15/1M prompt • $75/1M completion
$0.10500
$10.50/mo

FAQs

How are LLM API costs calculated?

API costs are calculated based on the number of prompt (input) tokens and completion (output) tokens, multiplied by the model's rate per million tokens.

What is a token?

A token is a basic unit of text, representing about 4 characters or 0.75 words. For example, 100 tokens is approximately 75 words.

Why do AI agents consume more tokens?

AI agents operate in loops, appending previous turn history to the prompt of the next turn. This context expansion means input tokens scale quadratically, increasing costs per run.

How does the budget longevity estimate work?

The calculator takes your monthly budget and divides it by the cost of your simulated usage, giving you the total runs and days your budget will last.

How to Use the AI API Pricing Calculator

Estimate the cost of using large language model APIs based on token usage.

  1. Select a model or enter per-token prices.
  2. Enter expected input and output tokens.
  3. Enter your request volume.
  4. See the cost per request and monthly total.

Token Cost

Request Cost

Cost = (in_tokens × in_price + out_tokens × out_price) / 1,000,000

API prices are usually quoted per million tokens.

Example:

Input: 1k in + 500 out at $3/$15 per M

Calculation: (1000×3 + 500×15)/1e6

Result: ≈ $0.0105/request

Real-World Use Cases

Budgeting

Forecast monthly LLM spend before launch.

Model Comparison

Compare cost across model tiers.

Tips

Tips

  • Output tokens often cost more than input tokens.
  • Caching and shorter prompts cut costs significantly.

Cite this calculator

Canonical URL: https://mathify.one/en/business/ai-pricing

Cite as: Mathify. (2026). AI Token Cost Calculator. https://mathify.one/en/business/ai-pricing

Use Cases

Estimate per-request API costs

For a single API call, enter the model's pricing and your token usage to see the cost of one request. Useful for budgeting individual features or comparing models.

Example: Input: 5,000 tokens, Output: 1,000 tokens, Input price $3/M, Output price $15/M → cost $0.03

Simulate AI agent loop expenses

Model an agent that makes multiple turns, each adding tokens to the context. The calculator simulates context expansion and estimates total tokens and cost for the entire loop.

Example: Initial prompt 2,000 tokens, 10 turns, +500 tokens/turn, output 200 tokens/turn → see total cost

Frequently Asked Questions

How does the AI Token Cost Calculator estimate API costs?
You input the input and output prices per 1M tokens, along with token counts for prompt and completion. The calculator multiplies these to give a per-request cost. For agent loops, it uses initial prompt tokens, tokens added per turn, and output tokens per turn to simulate context expansion and compute total token usage.
Can I use this calculator for custom AI models?
Yes. The calculator includes a 'Custom Model' option where you can manually enter the input and output prices per 1M tokens, allowing you to estimate costs for any LLM API.
What is the purpose of the 'Monthly Budget' field?
The Monthly Budget field lets you set a spending limit. The calculator can compare your estimated monthly expenses against this budget, helping you see if your projected usage stays within your planned spending.

Tips & Common Mistakes

Tips

  • Check your model's current pricing page for accurate input and output prices per 1M tokens, as they can change.
  • For agent loops, estimate the average tokens added per turn based on your use case (e.g., tool results, memory).
  • Use the Monthly Budget field to set a cap and adjust your request volume or frequency to stay within budget.
  • Remember that some models have different pricing for cached input tokens; this calculator uses standard rates.

Common Mistakes to Avoid

  • Forgetting to convert prices to per 1M tokens: if your price is per 1K tokens, multiply by 1000 before entering.
  • Not accounting for the context expansion in agent loops: the calculator uses the 'Tokens Added per Turn' to simulate growth, so leaving it at 0 will underestimate costs.
  • Confusing input and output token counts: ensure you enter the correct numbers for prompt and completion to get an accurate cost.

Last updated: August 13, 2026