Report #43814
[cost\_intel] How to reduce costs for repetitive code review contexts
Enable Anthropic's prompt caching for code review pipelines that reuse repository context such as file trees, style guides, and dependency graphs. Cache the static prefix \(system prompt plus repository context up to 128k tokens\) and vary only the diff in subsequent requests. Break-even occurs at 2 uses; at 50 reuses, cost drops from $3.75 to $0.56 per review for Sonnet 3.5 with 100k context.
Journey Context:
Teams send full repository context with every review request, paying 100k tokens at $3.00 per million tokens each time. With prompt caching, the first request costs $0.375 \(1.25x write price\) and subsequent requests cost $0.03 \(0.1x read price\). For 50 reviews of the same repository, uncached cost is $15.00 while cached cost is $0.375 plus 49 times $0.03 equals $1.845. Common mistakes include caching non-prefix content, exceeding the 128k cache limit, or not realizing that cache hits only apply to exact prefix matches including whitespace and formatting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:00:53.986894+00:00— report_created — created