The Magic of AI

Guides

Twelve pieces on the mechanics behind the numbers. Each one is written to be useful on its own, and each links to the calculator that turns it into a figure for your workload.

How LLM token pricing actually worksWhat a token is, why input and output are billed separately, how cached and batch tiers work, and a full worked example priced on two models. Why output tokens cost more than input tokensPrefill runs in parallel, decode runs one token at a time against memory bandwidth. That mechanical difference is what the 5:1 price ratio is pricing. Eleven ways to cut your LLM bill without switching modelOrdered by how much they actually return: context surgery, caching, batching, routing, output caps and the instrumentation that finds the rest. Prompt caching explained, with the real break-evenThe byte-identical prefix rule, write premiums, cache lifetime, and the hit rate below which caching costs more than it saves on Claude Sonnet 5. Batch API processing: when the 50% discount is worth itA feature-by-feature audit of which AI workloads tolerate a 24-hour batch window, priced at real rates, plus what vendors promise and what fails. How to choose a model tier without guessingBuild a 50-example eval set, run the price ladder from cheapest upward, and stop at the first model that passes. With the full cost spread worked out. RAG vs long context: run the crossover mathsStuffing a 239,000-token corpus costs $0.072 a query on Gemini 2.5 Flash. Retrieval costs $0.0012. Here is where the crossover actually falls, and why. The real cost of self-hosting an open-weight modelA two-H100 deployment costs $4,803 a month whether you use it or not. Worked against Llama 3.3 70B on Together, with the overheads nobody budgets for. The hidden costs of AI that never reach your price cardAn API dashboard reading $1,120 a month for a support feature that really costs $12,400 to run, with retries, evals, guardrails and review sized. Estimating tokens before launch, with no traffic yetRules of thumb, a representative sample, why the 95th percentile beats the median, a worked support-summarisation estimate and four costly omissions. LLM cost forecasting for a bill that has not happenedThree scenarios instead of one, unit cost per business event, why AI unit cost stays flat with scale, and the four things that cause a step change. Embedding model selection, quality first and price lastEmbedding a 25,000-document corpus costs under two dollars, so choose on retrieval quality and dimensions. What actually costs money is downstream.

Where to start

If you are new to per-token billing, read how LLM token pricing actually works first, then why output tokens cost more — between them they explain most of what looks arbitrary on a vendor price card.

If you already have a bill you want to reduce, go straight to eleven ways to cut an LLM bill, which is ordered by size of effect rather than by ease.

If you are making an architecture decision, RAG or a million-token context window and the real cost of self-hosting cover the two that cost the most to get wrong.