Skip to content

Published: · newsletter.posthog.com · Ian Vanagas

This post will save you tokens

Explore proven techniques for reducing LLM expenses via improved caching strategies, model routing, context engineering, and observability practices implemented at scale.

Read the original on newsletter.posthog.com ↗

What the article covers

The article outlines a strategic shift from unrestricted token consumption to rigorous cost optimization within production AI systems. Before attempting any reductions, teams must establish a comprehensive baseline by tracking flat-rate subscriptions, team automations, and customer-facing AI features using observability tools. Without this visibility, organizations risk missing significant waste hidden within workflow scaling or inefficient agent configurations, which ultimately undermines the goal of maintaining product quality while controlling expenditure.

Furthermore, the text details specific engineering tactics to reduce context window bloat, such as refining AGENTS.md files to exclude obvious defaults and pruning MCP server tool definitions that inflate session costs. A critical section addresses caching mechanics, explaining that cache writes are significantly more expensive than reads and require careful prompt structuring to maximize hit rates. Developers are advised to prioritize stable tokens at the start of prompts and avoid unnecessary context clearing unless the savings outweigh the rewrite penalties associated with fresh cache initialization.

Beyond infrastructure tweaks, the analysis emphasizes intelligent model routing and memory management as key levers for efficiency. By assigning tasks to appropriate models based on complexity rather than defaulting to frontier options, teams can achieve substantial savings without sacrificing output quality. Finally, the guide warns against over-optimizing low-volume prototypes, suggesting that resources should instead target high-frequency workflows where even minor per-run reductions compound into meaningful financial impact over time.