API pricing

AI API Pricing Explained: What "Per Million Tokens" Actually Means

If you've ever stared at "$3 per million input tokens" and had no idea what that meant for your actual bill, this is for you.

8 min readยทUpdated July 2026

Every major model provider prices API access the same fundamental way: by the token. But most people building on these APIs for the first time have no intuition for what a token costs them in practice. Here's the breakdown.

What's a token, roughly?

A token is a chunk of text โ€” on average, about ยพ of a word in English. "The quick brown fox" is roughly 5 tokens. A 500-word blog post is roughly 650โ€“700 tokens. A typical chat message might be 20โ€“100 tokens; a long document could be tens of thousands.

Why input and output are priced differently

Every model charges more for output tokens than input tokens โ€” often 4 to 8 times more. Generating text is computationally heavier than reading it. This matters a lot in practice: a chatbot that reads long documents but gives short answers is cheap to run; one that writes long reports from short prompts is expensive.

Current pricing for major models

ModelInput / 1M tokensOutput / 1M tokens
GPT-5.2$1.75$14
GPT-4.1 Mini$0.40$1.60
Claude Opus 4.6$5.00$25
Claude Sonnet 4.6$3.00$15
Claude Haiku 4.5$1.00$5.00
Gemini 3 Pro$2.00$10
Gemini 3 Flash$0.10$0.40
DeepSeek V3.2$0.27$1.10

A worked example

Say you're building a customer-support assistant on Claude Sonnet 4.6. Each conversation reads roughly 2,000 tokens of context (chat history + knowledge base snippets) and writes a 300-token reply.

At 10,000 conversations a month, that's roughly $105/month โ€” a number that's easy to miss when you're only looking at the per-token price and not multiplying it out against real volume.

Batch API: the discount most people miss

Nearly every provider now offers a "batch" mode โ€” you submit requests asynchronously and get results within 24 hours, in exchange for roughly a 50% discount on both input and output tokens. For anything that doesn't need a live response (nightly data processing, bulk content generation, embeddings re-indexing), batch mode effectively halves your bill for free.

Context caching: the other discount

If you're sending the same large system prompt or document repeatedly, most providers offer cached input pricing โ€” often 50โ€“90% cheaper than standard input tokens for content the model has "seen" recently. This is one of the highest-leverage optimizations for RAG systems and coding assistants that resend the same context on every call.

Rule of thumb

Output tokens dominate the bill for most chat-style products. If your costs are higher than expected, check whether your model is writing longer responses than it needs to โ€” that's usually the biggest lever, more than switching models.

โ†’ Estimate your own monthly API bill

Picking a model by cost per task

The cheapest model per token isn't always the cheapest per completed task โ€” a weaker, cheaper model that needs three retries to get a correct answer can cost more than a stronger model that gets it right the first time. When comparing models on price, compare cost-per-successful-task, not just the sticker price per million tokens.