Hirestack
Hirestack
Chapter 7

LLM Engineering · Cost, latency, and reliability

📖 2 min read · 5 sections · May 2026

Why this matters

Demos run on $50/month. Production at 1K daily users runs on $5K-$50K/month depending on how careful you are. The difference is mostly engineering, not which model you picked.

Token economics

ModelInput $/1M tokensOutput $/1M tokens
GPT-4o$2.50$10.00
GPT-4o-mini$0.15$0.60
Claude 3.5 Sonnet$3.00$15.00
Claude 3.5 Haiku$0.80$4.00
Llama 3.1 70B (Groq)$0.59$0.79

Output tokens are 4× more expensive than input. Short, structured outputs save more money than people realise. "Respond with one word" can shave 60% off a high-volume workload.

Four cost levers that compound

  1. Model routing: cheap model first, escalate only if needed. 50-80% savings on mixed workloads.
  2. Prompt caching: providers (OpenAI, Anthropic, Gemini) cache the prefix of a prompt if it's the same. Put your stable system prompt + examples first, variables last. 50-90% reduction on cached portion.
  3. Batch inference: OpenAI Batch API costs 50% of real-time. Use for nightly evaluations, backfills, embedding generation.
  4. Open-source for high-volume: at >500K calls/month, hosting Llama 3.1 70B on Groq/Together/Fireworks is often cheaper per token than GPT-4o-mini, with comparable quality on most tasks.

The latency budget

Time-to-first-token (TTFT) is what users perceive. Total-response-time matters for non-streaming integrations. A back-of-envelope:

If perceived latency matters: stream. If you can't stream (e.g., you need to validate the full structured output): pick a smaller model, or split into multiple cheaper calls.

Reliability patterns from chapter 1, applied