Developer Maxim Khailo ran a measurement study of prompt-cache "keepalive" pings — the common practice of resending a request prefix on a timer so an LLM provider's cache doesn't expire during an agent's idle pauses (waiting on a build, test, or human approval). He tested Anthropic (Sonnet 4.5), OpenAI (GPT-5.1), Google Gemini 2.5 Pro, and DeepSeek V3.2, using idle gaps up to 10 minutes and prefixes up to 100k tokens, with three independent runs per condition.
The widely copied convention of pinging every 30 seconds turned out to cost about 8x more than necessary; the actual optimal interval is roughly 4 minutes (just under Anthropic's 5-minute TTL). A 4-minute keepalive kept 23 of 24 samples warm while costing 7.8x less than the 30-second version.
Providers fell into three distinct regimes. Anthropic has a hard TTL: caches survive 5 minutes but are dead by 10 minutes (0 of 48 baseline samples warm), making the keepalive a clear money-saver — at a 10-minute gap on a 100k-token prefix, the 4-minute keepalive cost $0.414 versus $0.667 without it, a 38% saving. DeepSeek (via DeepInfra) is "lossy": its cache leaks even with pings due to load-balancer routing across machines, so the keepalive there mainly buys faster latency (1.4–2.0s to first token vs 5.4s cold) rather than cost savings. OpenAI and Google Gemini are "sticky": their caches often survive 10 minutes unassisted (39/48 and 20/24 samples respectively), so keepalives there mostly wasted money — Gemini's 4-minute keepalive cost 40% more than doing nothing ($0.186 vs $0.131).
Khailo's break-even formula: pinging pays off only if the idle gap exceeds roughly interval × (write-cost-ratio/read-cost-ratio − 1) — about 46 minutes for Anthropic, 36 minutes for OpenAI and DeepSeek, and just 12 minutes for Google, whose cached reads cost 4x more than Anthropic's. Beyond that horizon, letting the cache expire and paying for a fresh prefill is cheaper than continued pinging.
The project was inspired by a CacheWise paper (Shubham Tiwari, Tapan Chugh, Nash Rickert, Simon Peter, Ratul Mahajan, Haiying Shen) on KV-cache management for coding agents, presented at the AgentSys conference in Bellevue. Khailo also speculates that widespread keepalive pinging creates a "noisy neighbor" problem for shared cache tiers, predicting providers will move toward billing cache residency directly by token-hour — as Google's explicit cache and Anthropic's 1-hour cache tier (at 2x write cost) already partly do. His open-source "pi" agent harness implements the policy: keepalive only during active tool batches, off by default.