C.W.K.
Stream
Lesson 03 of 06 · published

Token Economics & Pricing

~16 min · pricing, cost, optimization

Level 0Spark
0 XP0/35 lessons0/10 achievements
0/140 XP to next level140 XP to go0% complete

Output tokens cost more than input tokens

Gemini, like every other major LLM provider, charges asymmetrically: output tokens cost roughly 4–8× more than input tokens. Generation is autoregressive — the model runs a forward pass for every output token, so producing a 500-token reply takes 500× more compute than reading a 500-token prompt. Internalize this number and your cost intuition will line up with reality.

Gemini 2.5 pricing (per 1M tokens, as of mid-2026)

ModelInput ≤ 200KInput > 200KOutput ≤ 200KOutput > 200KCached input
2.5 Pro$1.25$2.50$10.00$15.00$0.125
2.5 Flash$0.30$0.30$2.50$2.50$0.03
2.5 Flash-Lite$0.10$0.10$0.40$0.40

Two things to notice in this table. First, Pro doubles the input rate at the 200K-token boundary. If your typical request hovers around 195K, you're one moderately-sized PDF away from 2× billing. Second, Flash-Lite is roughly 22.5× cheaper than Pro per output token. Routing 70% of traffic away from Pro is the single biggest cost lever you have.

Free tier, batch API, caching

Three tools shrink your bill that are mechanical, not creative:

  • Free tier: 5–15 RPM and 100–1,000 RPD per model with 250K TPM shared. Enough for prototyping, never enough for production. EU/UK/CH excluded.
  • Batch API: 50% off list price for offline jobs that don't need sub-minute turnaround (translations, embeddings backfill, summary pipelines).
  • Context caching: ~90% reduction on the input tokens of cached content. Pay once to cache a 100K-token doc, then ask many questions against it for cents instead of dollars.

Code

Per-call cost estimator·python
PRICES = {
    'gemini-2.5-pro':        {'in': 1.25, 'out': 10.00, 'in_long': 2.50, 'out_long': 15.00},
    'gemini-2.5-flash':      {'in': 0.30, 'out':  2.50, 'in_long': 0.30, 'out_long':  2.50},
    'gemini-2.5-flash-lite': {'in': 0.10, 'out':  0.40, 'in_long': 0.10, 'out_long':  0.40},
}

def estimate_cost_usd(model: str, prompt_tokens: int, completion_tokens: int) -> float:
    p = PRICES[model]
    in_rate  = p['in_long']  if prompt_tokens     > 200_000 else p['in']
    out_rate = p['out_long'] if completion_tokens > 200_000 else p['out']
    return (prompt_tokens / 1e6) * in_rate + (completion_tokens / 1e6) * out_rate

# 50K-token doc + 1K-token question + 800-token answer on Flash:
# (51_000/1e6 * 0.30) + (800/1e6 * 2.50) = $0.0173
Batch API: 50% off, async return·python
from google import genai
client = genai.Client()

# Submit a batch job (offline, returns minutes-to-hours later)
job = client.batches.create(
    model='gemini-2.5-flash',
    requests=[
        {'contents': 'Summarize: ' + doc} for doc in big_doc_pile
    ],
)
# Poll job.state until DONE; results land in job.results.
# Half the cost of synchronous calls. Worth it for any non-interactive pipeline.

External links

Exercise

Take a workload you actually understand — your job, a side project, a school assignment. Estimate (a) how many Gemini calls per day you'd need, (b) average prompt and response token counts, (c) cost per day on Pro vs Flash vs Flash-Lite using the formula above. Then decide which one is correct and write one sentence saying why. Most people overestimate their need for Pro.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.