Token Insights illustration

Token Insights

What is cost per million tokens, really?

Cost per million tokens is the only AI pricing number that survives real usage. Here’s how to read it, calculate it, and track it.

October 16, 2026 · 6 min read · By MyTokenTracker

Back to Blog

Cost per million tokens is the only pricing unit that lets you compare AI models without getting fooled by tiny unit prices. If you can do the math once, you can estimate any prompt, any agent run, and any monthly bill.

Why per-1M-token pricing exists

LLM APIs are metered like utilities. You are not buying a single answer, you are buying capacity across input tokens, output tokens, and sometimes cache or reasoning tokens. Quoting prices per 1,000,000 tokens keeps the numbers readable and makes cross-model comparison possible.

The trap is simple: if someone says a model costs “$0.15” without the unit, you do not know if that is input, output, blended, or a marketing hallucination. The right question is always, “$0.15 per what?” For model shopping, the answer should be per 1M tokens.

This is also why the AI Cost Index is useful. A blended index turns messy input/output rates into a single number you can use for quick comparisons, while still preserving the underlying pricing details when you need to get precise.

How the math actually works

The formula is boring, which is exactly why it matters:

cost = (tokens / 1,000,000) × price_per_1M_tokens

If a model charges separate input and output rates, calculate each side independently and add them together. That’s the only way to avoid undercounting chatty outputs or long context prompts.

Here’s the basic shape of the problem:

  • Input tokens are your prompt, system instructions, retrieved context, tool results, and conversation history.
  • Output tokens are the model’s response, including code, explanations, and structured output.
  • Some providers also report cache or reasoning tokens, which can change the final bill depending on the product.

For a quick sanity check, you can compare the same request across models using the public live model prices page, then decide whether you care about latency, quality, or raw cost.

Worked example: one coding task, three models

Let’s say your agent run uses 12,000 input tokens and 3,000 output tokens. That is a pretty normal shape for a coding session with a decent chunk of context.

Now compute the bill for three models using only the prices we know:

Model Input cost Output cost Total
gpt-4o (12,000 / 1,000,000) × $2.5 = $0.03 (3,000 / 1,000,000) × $10 = $0.03 $0.06
claude-sonnet-4-5 (12,000 / 1,000,000) × $3 = $0.036 (3,000 / 1,000,000) × $15 = $0.045 $0.081
deepseek-chat (12,000 / 1,000,000) × $0.28 = $0.00336 (3,000 / 1,000,000) × $0.42 = $0.00126 $0.00462

The takeaway is not that one model is “best.” It is that output-heavy tasks punish expensive completion rates, while input-heavy tasks punish long prompts and bloated context. Same task, different cost profile.

If you want a single blended comparison instead of separate input and output math, the AI Cost Index gives two useful anchors right now: Frontier basket at $4.64 per 1M tokens, and Budget basket at $0.74 per 1M tokens, both blended 3:1 input:output. That is a fast way to think about “expensive enough to matter” versus “cheap enough to spray around.”

Blended price vs raw model price

Raw API pricing is useful when you are optimizing a specific workflow. Blended pricing is useful when you want to compare models at a glance without doing arithmetic every time. Both are valid, but they answer different questions.

View Best for What it hides
Raw input/output rates Estimating a real request, tuning prompts, measuring agent runs Nothing, but you have to do the math
Blended per-1M-token price Quick model comparisons, dashboards, executive summaries The split between prompt-heavy and completion-heavy usage

That distinction matters because a model can look cheap on paper and still get expensive in practice if it tends to produce long responses. The reverse is also true. A pricier input rate can still be fine if the model is concise and accurate, which reduces retries and re-prompts.

For a broader market view, the State of AI page is a better lens than any single vendor page. It helps you see whether pricing movement is actually changing the economics of daily development.

What developers usually miss

The biggest mistake is treating token cost like a static property of the model. In reality, your bill depends on how you use the model. A short prompt with a short answer is cheap. A long agent loop with tool calls, retries, and copied context can get expensive fast.

  • Long system prompts compound across every turn.
  • Conversation history grows unless you trim it.
  • Tool output can dominate input tokens if you paste logs or JSON blobs.
  • Retries multiply both input and output spend.

That is why “cheap model” and “cheap workflow” are not the same thing. A cheaper model can still cost more if it causes more retries, or if it needs a longer prompt to get the same quality. Cost per million tokens is necessary, but not sufficient. You also need to know cost per task, per project, and per successful outcome.

If you care about the data itself, the open dataset is published under CC BY 4.0, which makes it easier to inspect trends instead of trusting screenshots.

How to track this in your own stack

The fastest way to see what you actually spend is to run npx mytokentracker. It reads the usage logs coding agents already keep locally and prints a 30-day cost table at API prices, with usage data staying on your machine.

If you want a dashboard, create a free account and run npx mytokentracker init. It asks for the API token, uploads history, then syncs every 30 minutes. It works with Claude Code, Codex, GitHub Copilot CLI, Antigravity, OpenCode, Amp, Qwen Code and more. Only daily totals per agent and model are uploaded, never prompts, code, or file names.

For app code that calls providers directly, MyTokenTracker also ships wrappers that auto-capture usage for OpenAI, Anthropic, Gemini, and Mistral. In Python that means functions like track_openai, track_anthropic, track_google, and track_mistral. In Node, the equivalents are trackOpenAI and friends. If your provider is something else, a single POST to the events API is enough.

The useful part is not just cost. You also get input, output, cache, and reasoning tokens, latency, success, and breakdowns by provider, model, platform, and use-case. That is the difference between “I think this is expensive” and “this workflow costs $X per successful run.”

FAQ

Is per-million-token pricing the same as cost per request?

No. Per-million-token pricing is the unit price. Cost per request depends on how many input and output tokens that specific request uses. Two prompts against the same model can have wildly different costs if one is short and the other drags in a huge context window.

Why do some models show separate input and output prices?

Because input and output are different products economically. The model has to read your prompt and then generate new tokens. Providers often price those two directions differently, so you need both numbers to estimate a real bill accurately.

What’s the fastest way to compare models without doing math by hand?

Use a blended benchmark like the AI Cost Index for a quick read, then drill into the raw model prices when you are estimating a real workload. If you need live pricing for specific models, the models page is the place to start.

If you want to see what your own agents are actually costing, try MyTokenTracker.