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.

Guide

How LLM token pricing actually works

What 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.

Guide

Why output tokens cost more than input tokens

Prefill 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.

Guide

Eleven ways to cut your LLM bill without switching model

Ordered by how much they actually return: context surgery, caching, batching, routing, output caps and the instrumentation that finds the rest.

Guide

Prompt caching explained, with the real break-even

The byte-identical prefix rule, write premiums, cache lifetime, and the hit rate below which caching costs more than it saves on Claude Sonnet 5.

Guide

Batch API processing: when the 50% discount is worth it

A 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.

Guide

How to choose a model tier without guessing

Build 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.

Guide

RAG vs long context: run the crossover maths

Stuffing 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.

Guide

The real cost of self-hosting an open-weight model

A 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.

Guide

The hidden costs of AI that never reach your price card

An 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.

Guide

Estimating tokens before launch, with no traffic yet

Rules of thumb, a representative sample, why the 95th percentile beats the median, a worked support-summarisation estimate and four costly omissions.

Guide

LLM cost forecasting for a bill that has not happened

Three 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.

Guide

Embedding model selection, quality first and price last

Embedding 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.