{"slug": "why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than", "title": "Why 95%-Cached Coding and Security Agents Pay 10x Less on Prefix Caching Than Uncached Sticker Prices", "summary": "A developer measured a 14-minute Claude Code session and found that 96.5% of all input tokens were prefix cache hits, meaning cached-input pricing dominates the bill for multi-turn coding and security agents. Comparing two backends on the same 10M-input-token workload, the cache-optimized pricing came to $0.3825 versus $4.35 for uncached-focused pricing — more than an 11x swing — even though fresh-input prices differed by only 2.4x. The writeup recommends benchmarking real session costs with caching enabled rather than comparing uncached list prices.", "body_md": "When developers compare LLM APIs, almost everyone sorts by two columns: fresh input price and output price per 1M tokens. For one-shot chat prompts, that table works. For autonomous coding and pentest agents, it predicts the wrong winner almost every time.\n\nIn a multi-turn harness (Claude Code, Codex CLI, OpenCode, Strix, PentAGI), every step sends:\n\n`N`\nAcross a real 14-minute Claude Code session we measured and published ([full token breakdown](https://nodecode.ai/research/claude-code-deepseek)), **96.5% of all input tokens were prefix cache hits**. Fresh input and generated output together were a small fraction of the total context processed.\n\nCompare two backends serving 10M total input tokens (`9.5M` cached, `0.5M` fresh) and `100K` output tokens in a sustained tool loop:\n\n| Component | Uncached-focused pricing ( `$0.80 / $0.40 cached / $1.50` ) | Cache-optimized pricing ( `$0.33 / $0.009 cached / $1.32` ) | \n|---|---|---|\n| Cached input ( `9.5M` ) | `$3.80` | `$0.0855` | \n| Fresh input ( `0.5M` ) | `$0.40` | `$0.1650` | \n| Output ( `0.1M` ) | `$0.15` | `$0.1320` | \n| **Session total** | **`$4.35`** | **`$0.3825`** | \n\nOn the same workload, prefix cache read pricing swings the bill by **more than 11x** - even though the fresh-input prices only differed by 2.4x.\n\n`cache_salt` in the gateway keeps cache hits high per tenant while guaranteeing zero cross-org KV reuse, paired with a hard 30-minute idle KV eviction timer.\nIf you run authorized security harnesses or long-horizon coding agents on [abliterated AI models](https://nodecode.ai/abliterated), benchmark your actual session bill with cache hits turned on rather than comparing uncached list prices. You can inspect live agent-loop cost breakdowns with our [agent cost calculator](https://nodecode.ai/tools/agent-cost-calculator) or read the [Nodecode Cyber v1 specs](https://nodecode.ai/cyber).", "url": "https://wpnews.pro/news/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than", "canonical_source": "https://dev.to/nodecodeai/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than-uncached-sticker-5h8o", "published_at": "2026-12-06 01:05:56+00:00", "updated_at": "2026-12-06 01:14:39.598134+00:00", "lang": "en", "topics": ["large-language-models", "ai-agents", "ai-infrastructure", "ai-tools"], "entities": ["Claude Code", "Codex CLI", "OpenCode", "Strix", "PentAGI", "Nodecode"], "also_reported_by": [], "takeaway": "In a 14-minute Claude Code session 96.5% of input tokens were prefix cache hits, so cache-read pricing swung the bill 11x ($4.35 vs $0.3825) while fresh-input prices differed only 2.4x.", "recommendation": {"advice": "Benchmark agent session bills with prefix caching enabled instead of comparing uncached list prices, since cached input can dominate 96% of tokens.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than", "markdown": "https://wpnews.pro/news/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than.md", "text": "https://wpnews.pro/news/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than.txt", "jsonld": "https://wpnews.pro/news/why-95-cached-coding-and-security-agents-pay-10x-less-on-prefix-caching-than.jsonld"}}