Inference engineering, live

Inference Ladder

Five levels for squeezing more out of a language model at serving time — from the API call you already send, up to designing a model that serves cheaply on purpose. Every level has a running simulation, built on representative mock numbers, that you can push around like a real one.

Level 01 · Basics

Use the API you already have

For every engineer building on Claude, GPT, or Gemini.

You don't own the GPUs, but the request you send still decides most of the bill. The biggest lever is prompt caching: a provider can reuse a prefix of a prompt if it's identical to one it just processed. Put whatever never changes — system prompt, tool schemas, reference documents — first, and the part that changes every call, the user's message, last. Anthropic prices a cache hit at roughly 90% less than a fresh input token. Edit a single character inside that cached prefix and the whole thing misses on the very next call — ordering isn't a style choice, it's the mechanism.

Prompt cache simulator

One request, 2,600 stable tokens (system + tools + docs) and 300 fresh tokens (the user's message)

Stable content first
ON — cache-friendly order
2,600cached tokens
300fresh tokens
81%cost saved vs. no caching
Cost per 1,000 calls — this order$1.68
Cost per 1,000 calls — no caching$8.70
Try this

Flip the switch. On, the blue blocks are what an identical second call gets for ~10% price. Off, the user's message sits before the stable content, so nothing downstream can match a previous prefix — the whole 2,900 tokens are billed fresh, every single call.

Lever 2 — stream the response
~260msto first token, streamed
~4.1sto see anything, unstreamed

Same total time — the user just isn't staring at a blank screen for it.

Lever 3 — route to the smallest model that passes
$0.0002Haiku-class router step
$0.0083same step on a flagship model

A yes/no classification rarely needs the biggest model on the menu.