How Token Pricing Works Across Large Language Models

Large language models meter API usage by splitting every prompt you send and every response the model writes into text chunks called tokens, which average about four characters or three-quarters of an English word. Providers apply asymmetric token pricing per million tokens (MTok), charging three to ten times more for generated output tokens than for input tokens because writing new text requires sequential memory reads for each token. Your final bill per API call also depends on hidden reasoning tokens billed at output rates, multimodal file conversions, long-context tier thresholds, and prompt caching discounts of up to 95%.

How are words and multimodal files converted into tokens?

Before a model processes a request, its tokenizer breaks your raw text into characters, sub-words, or whole words. According to OpenAI’s tokenizer documentation (2026), one token equals roughly four characters of common English text, so 100 tokens correspond to about 75 words. Iternal’s 2026 API pricing analysis notes that 1,000 English words convert into approximately 1,333 tokens.

Non-text files are metered by converting pixels or seconds into fixed token equivalents. Under Google AI Studio documentation (2026) for the Gemini API, an image measuring 384×384 pixels or smaller counts as 258 tokens, where 100 tokens equal 60 to 80 English words. Larger images are divided into 768×768 pixel tiles that each add 258 tokens, while audio is metered at 32 tokens per second and static video counts as 263 tokens per second at one frame per second.

How do large language models calculate token pricing per call?

API providers publish rates per one million tokens, written as $/1M tokens or $/MTok, and bill each API request separately. As detailed in BenchLM’s 2026 guide, “How LLM Token Pricing Works: A Complete Guide to API Costs”, the standard formula for an uncached text call is (input tokens / 1,000,000 × input rate) + (output tokens / 1,000,000 × output rate). Because APIs are stateless, every call in a multi-turn chat re-sends the prior conversation history and any tool or function declarations as fresh input tokens.

Output tokens cost three to ten times more than input tokens across major providers, according to 2026 data from Iternal and OpenReplay. When a model reads your input prompt, it processes all input tokens in parallel during a single forward pass. Generating output is slower and more hardware-intensive because the model decodes one token at a time sequentially, reading its parameters from memory for every new token it produces.

Per-million-token rates vary widely by model size as of 2026, so check your provider’s current pricing table before deploying to production:

Model Tier (2026)Input Rate (per 1M Tokens)Output Rate (per 1M Tokens)Source
OpenAI GPT-5 nano$0.05$0.40OpenReplay (2026)
Anthropic Claude Haiku 5.5 (up to 100K tokens)$0.10$0.50Anthropic (2026)
Anthropic Claude Opus 5.5$5.00$25.00Anthropic (2026)
OpenAI GPT-5.5$5.00$30.00OpenReplay (2026)

To see how the math works on a real request, take Anthropic’s Claude pricing documentation (2026) for Claude Opus 5.5, which charges $5.00 per million input tokens and $25.00 per million output tokens. Sending 50,000 uncached input tokens and generating 2,000 output tokens costs (50,000 / 1,000,000 × $5.00) + (2,000 / 1,000,000 × $25.00), or $0.25 + $0.05 for a total of $0.30. If those same 50,000 input tokens are read from a prompt cache on the next turn at Claude Opus 5.5’s 0.05x cache-read multiplier ($0.25 per million tokens), the input cost drops to $0.0125, lowering the total call cost from $0.30 to $0.0625.

Why do reasoning tokens and long context windows raise API bills?

Two mechanisms frequently catch developers off guard when forecasting API budgets: internal reasoning tokens and tiered context thresholds. Reasoning models generate internal chain-of-thought tokens before writing a visible reply. Even if you ask for a 50-token answer, the model may produce thousands of hidden thinking tokens that are all billed at the higher output token rate, according to 2026 documentation from Google AI Studio and OpenReplay.

Passing massive documents in a single prompt can also trigger long-context surcharges. On Anthropic’s Claude Haiku 5.5 (2026), prompts up to 100,000 input tokens cost $0.10 per million input tokens and $0.50 per million output tokens, but crossing 100,000 input tokens raises the rate to $0.50 input and $2.50 output per million tokens. Across other frontier models tracked by OpenReplay and Google Cloud in 2026, prompts exceeding 200,000 or 272,000 input tokens typically charge 2x the base input rate and 1.5x the base output rate.

How does prompt caching cut repeated input costs?

Prompt caching stores recurring prompt prefixes, such as long system instructions, tool definitions, or reference documents, so you do not pay full input rates on every call. Each provider structures cache billing differently:

  • OpenAI automatically caches matching prompt prefixes of 1,024 tokens or longer at a discounted read rate, according to OpenAI Developer Community documentation (2024).
  • Under Anthropic’s prompt caching guide (2026), writing a prefix to a 5-minute cache costs 1.25x the base input rate and writing to a 1-hour cache costs 2x the base input rate, while cache reads cost 0.1x the base input rate across standard models or 0.05x on Claude Opus 5.5 and Sonnet 5.5.
  • According to Gemini Developer API pricing (2026), Google charges both a reduced read rate for cached tokens and an hourly storage fee of $0.50 to $1.00 per million tokens per hour depending on the promotional period.

Cached tokens still occupy space inside the model’s context window. On models with tiered long-context pricing, Anthropic’s 2026 documentation notes that cached token reads and writes still count toward the prompt-length threshold that triggers higher rates.

How can you count tokens and audit API usage step by step?

You can measure token counts before sending requests and verify exact charges afterward using the tools built into OpenAI, Anthropic, and Google SDKs as of 2026:

  1. Count your input tokens locally before calling the API by running OpenAI’s open-source tiktoken package in Python for GPT models or calling the pre-flight count_tokens method in the Google AI Studio SDK for Gemini models.
  2. Verify that your combined system prompt, tools declarations, and conversation history stay below the model’s long-context boundary (100,000, 200,000, or 272,000 tokens); if the pre-flight count crosses that threshold or fails with a context-length error, truncate older chat turns or split large documents into smaller chunks before sending.
  3. Place unchanging content (tools definitions first, followed by system instructions) at the very top of your request payload and attach Anthropic’s cache_control parameter or keep prefixes above 1,024 tokens on OpenAI; if cache hits fail to register on subsequent calls, check that no dynamic timestamps or changing variables appear near the start of the prompt.
  4. Inspect the usage metadata object returned in the API response, such as total_input_tokens, total_output_tokens, total_thought_tokens, and total_cached_tokens in the Gemini API, to separate visible response costs from internal reasoning tokens and cached reads.

Frequently asked questions

Are consumer subscriptions like ChatGPT Plus or Claude Pro billed by the token?

No. Consumer chat plans charge a flat monthly subscription with message rate limits, whereas per-token metering applies to developers and businesses calling models through an API or cloud platform, according to 2026 documentation from Alibaba Cloud.

How does token billing work when buying Claude through AWS or Azure Marketplace?

According to Anthropic’s 2026 pricing documentation, token usage billed through AWS Marketplace or Azure Marketplace is calculated in US dollars using standard per-million-token rates and converted into Claude Consumption Units (CCUs) at a fixed rate of $0.01 USD per CCU reported hourly.

Recent Articles

Related News

Leave A Reply

Please enter your comment!
Please enter your name here