← Back to articles

How Much Do Tokens Cost: Calculating OpenAI, Claude, and Gemini API Spend

The API bill often surprises more than the sticker price: the model charges per input and output token, not per “one request.” Below - how OpenAI, Claude, and Gemini billing works, how to forecast a monthly budget, and where businesses usually overpay.

  • Token - the billing unit: roughly 3-4 characters or part of a word
  • Input wins on volume, output is pricier per 1M - long context hits the bill harder than a short smart answer
  • Formula - (input_tokens / 1M) × input_price + (output_tokens / 1M) × output_price
  • July 2026 baselines - GPT-5.6 Luna/Terra/Sol, Claude Sonnet 5 / Opus 4.8 / Fable 5, Gemini 3.5 Flash / 3.1 Pro
  • Hidden costs - system prompt, chat history, RAG chunks, retries, tool calls
  • Savings - smaller model for routine, caching/batch, trimmed context, escalate to a flagship only on hard cases

What a Token Is and Why It Is Not a “Word”

A token is a text fragment after the model’s tokenizer. It is not always a whole word: “programming” may become 2-3 tokens, and spaces and punctuation count too. For rough sizing:

Language / text type Rough guide
English ~750 words ≈ 1,000 tokens
Dense prose ~1 A4 page ≈ 500-800 tokens
Code often “costlier” than words: more short tokens
Tables / JSON look compact, but tokens grow fast

Exact splits depend on the provider tokenizer - so for billing use usage in the API response, not a gut estimate. For the per-request limit, see context window.

How API Pricing Works

All three vendors share one pattern:

  1. Count input tokens (system + user + history + attachments/chunks).
  2. Count output tokens (model answer; sometimes reasoning/thinking separately).
  3. Apply a rate per 1 million tokens (1M), separately for input and output.
  4. Cost per call:
cost = (input_tokens / 1_000_000) × price_input
     + (output_tokens / 1_000_000) × price_output

Important nuances:

  • Output is almost always more expensive per 1M than input - often 4-6× - so long answers and “reasoning” inflate the bill fast.
  • Long context costs more above a threshold on some models (OpenAI GPT-5.6 above 272K; Gemini 3.1 Pro above 200K).
  • Batch API and prompt caching cut price on repeated system/RAG context - if the architecture allows it.
  • ChatGPT / Claude / Gemini Workspace seats are a different cost line - do not confuse them with per-token API. Platform comparison for people: ChatGPT vs Claude vs Gemini.

July 2026 Rates: Planning Baselines

Prices change - verify the official list before production. Below are working baselines from the July 2026 model overview (USD per 1M tokens, standard).

OpenAI (GPT-5.6)

Model Role Input / 1M Output / 1M
GPT-5.6 Sol Flagship: code, agents $5.00 $30.00
GPT-5.6 Terra Price/quality balance $2.50 $15.00
GPT-5.6 Luna High-volume and background work $1.00 $6.00

Above 272K input, GPT-5.6 uses a long-context rate (baseline: input ×2, output ×1.5).

Anthropic (Claude)

Model Role Input / 1M Output / 1M
Claude Fable 5 Coding, long agentic workflows $10.00 $50.00
Claude Opus 4.8 Enterprise, hard daily work $5.00 $25.00
Claude Sonnet 5 Text and instructions (intro until 2026-08-31) $2.00 $10.00

From 2026-09-01, Claude Sonnet 5 baseline: $3.00 / $15.00 per 1M.

Google (Gemini)

Model Role Input / 1M Output / 1M
Gemini 3.1 Pro Hard reasoning $2.00 $12.00
Gemini 3.5 Flash High traffic, long context $1.50 $9.00

Gemini 3.1 Pro above 200K tokens uses a higher rate (baseline: $4.00 / $18.00 per 1M).

Calculation Examples

Example 1. Support reply: short dialog

Per ticket:

  • input: 1,200 tokens (instructions + question + 2 history turns);
  • output: 400 tokens;
  • volume: 50,000 tickets / month.
Model Cost per ticket Per month
GPT-5.6 Luna ≈ $0.0036 $180
Gemini 3.5 Flash ≈ $0.0054 $270
GPT-5.6 Terra ≈ $0.009 $450
Claude Sonnet 5 ≈ $0.0064 $320
Claude Fable 5 ≈ $0.032 $1,600

For L1 support a flagship almost never pays off: retrieval quality and permission to say “I don’t know” beat the top benchmark.

Example 2. Contract summary with large context

Per document:

  • input: 80,000 tokens (PDF + system);
  • output: 2,000 tokens;
  • volume: 2,000 documents / month.
Model Cost per document Per month
Gemini 3.5 Flash ≈ $0.138 $276
GPT-5.6 Luna ≈ $0.092 $184
GPT-5.6 Terra ≈ $0.23 $460
Claude Sonnet 5 ≈ $0.18 $360
Claude Opus 4.8 ≈ $0.45 $900
Claude Fable 5 ≈ $0.90 $1,800

Here the main cost is input. It is cheaper not to “answer shorter,” but not to ship the whole PDF when relevant chunks via RAG are enough.

Example 3. Tool-using agent: the hidden multiplier

One “user request” for an agent is often 5-20 model calls (plan → tool → observe → plan again). If every step carries the full system + history:

agent_cost ≈ cost_of_one_call × number_of_steps

10 steps at 8K input / 500 output on Terra is no longer “one chat for a few cents,” but real dollars per hard case. Budget agent traces, not UI messages.

Where Businesses Overpay

  1. One flagship for everything. Sol / Fable 5 for email classification and FAQ is a classic budget leak.
  2. Fat system prompt + full history on every call. Repeated context without caching multiplies input.
  3. Unbounded RAG chunks. Ten “just in case” chunks cost more than two relevant ones - and quality drops.
  4. Retries and fallback uncounted. Timeout → retry → second model = double bill for one user click.
  5. Long output “just in case.” High max_tokens + vague prompt = the model writes a novel.
  6. Seat vs API confusion. A Team subscription does not cancel token bills for product, bots, and automations.
  7. Ignoring long-context rates. Cross the 200K/272K threshold - the rate jumps while the dashboard still shows an “average” price.

How to Build a Monthly Budget

A practical template for finance and CTOs:

  1. Split traffic into scenarios (support chat, summarization, agent, embeddings separately).
  2. For each scenario take the median input/output from logs (not a perfect demo request).
  3. Multiply by monthly request / agent-step volume.
  4. Add a 20-40% buffer for retries, peaks, and experiments.
  5. Plan model switching: pilot on a smaller model + escalate to a larger one by rules.

Mini planning table:

Scenario Requests / mo Median input Median output Model $ / mo
L1 chat 80,000 1,500 350 Luna / Flash
PDF review 3,000 40,000 1,500 Sonnet / Terra
Agent (steps) 15,000 steps 6,000 400 Terra / Opus
Total + 30% reserve

Without such a table, picking the “smartest model” is a lottery, not finance.

How to Cut Spend Without Losing Quality

  • Model routing. Classification and drafts - Luna / Flash / Sonnet; hard code and long agentic chains - Sol / Fable 5.
  • Context engineering. Trim history, keep system short, do not duplicate the same instructions. See context engineering.
  • RAG instead of “stuff everything in the prompt.” Less input - lower bill and less hallucination risk from noise.
  • Prompt caching and batch. Repeated instructions and overnight batch jobs are often cheaper than realtime.
  • Hard output limits. Structured output (JSON) instead of essays; explicit length caps.
  • Escalate, don’t default. Cheap model first; expensive model on low confidence or hard task types.
  • Observability. Log usage by feature/tenant - otherwise there is nothing to optimize.

Bottom Line

Token cost is not “the model price from the rate card,” but input volume × rate + output volume × rate × number of calls. In 2026 a sensible business stack is usually: a cheap fast model for volume, mid-tier for working documents, flagship only pointwise. Count from real-log scenarios, include agent chains and retries - then the API stops being a month-end surprise.

Frequently Asked Questions

How do input tokens differ from output on price?

Output is almost always more expensive per 1M, sometimes 4-6×. But the final bill is often inflated by input: long documents, chat history, and RAG chunks. Watch both parts of usage, not only “how much the model wrote.”

How many tokens are in an average user message?

A short English question is often 20-80 tokens. With system prompt, policies, and 10 history turns, one “chat” easily becomes 1,000-5,000+ input before the answer. For budgeting, measure the full request, not only the customer phrase.

What is better for high traffic: Gemini Flash, GPT Luna, or Claude Sonnet?

For mass classification, FAQ, and short answers, Gemini 3.5 Flash and GPT-5.6 Luna often win. Claude Sonnet 5 is chosen when style, instruction-following, and careful text matter at still-moderate price. Confirm with A/B on your dataset, not only the price table.

Should you always pick the most expensive model “just in case”?

No. An expensive model pays off on hard tasks: long code, agentic chains, strict reasoning needs. On a stream of similar requests the overpay is wasted - use routing and rule-based escalation instead.

How can you estimate a monthly bill if there are no logs yet?

Take 20-50 real prompts, run them through the API, capture usage, average input/output, multiply by forecasted request volume, and add 30% for retries and growth. After 1-2 weeks replace the estimate with production medians - the error usually drops by multiples.

Contacts