Prompt caching explained: 20x cheaper per turn, but one system-prompt edit kills it

Saboo_Shubham_ · x · 2026-12-06

A visual explainer on prompt caching and agent costs: an agent re-sends the same 50,000 tokens every turn; on Gemini 4 Neon that's $0.15/turn uncached vs $0.0075 cached (20x cheaper), cutting a 100-turn session from $15.00 to $0.89. The provider diffs each request against the previous one from the first token — everything before the first difference is billed at 5% of full price. Best practices: stable system prompt and tools first, append-only chat history, volatile content (dates) in the newest message. Anything that breaks the prefix — editing the system prompt, timestamps, reordering tools, trimming history, switching models, long gaps — forces a full-price turn.

Original post →

More from coding & agent

coding & agent channel →