Skip to content

Price 1-hour cache writes at their 2× rate in savings estimates#118

Merged
teamchong merged 1 commit into
mainfrom
fix/cache-write-tier-savings
Jul 18, 2026
Merged

Price 1-hour cache writes at their 2× rate in savings estimates#118
teamchong merged 1 commit into
mainfrom
fix/cache-write-tier-savings

Conversation

@teamchong

Copy link
Copy Markdown
Owner

Fixes #117.

The dashboard priced every cache write at the 5-minute rate, 1.25× base input.
Anthropic charges 2× for 1-hour writes, on Fable that's $20/M, not $12.50/M, and the tracker already records the split from usage.cache_creation.
The savings math just never used it.

Example: a turn writing 100k tokens to a 1-hour cache on Fable really costs $2.00, but was priced at $1.25.
Same error on both the actual side and the text-counterfactual baseline, so the savings figure was off too.

Both sides now price each tier at its real rate.
Responses that don't report the split fall back to 1.25×, same as before, conservative rather than wrong.

1-hour writes are not rare: Claude Code asks for 1-hour caching, and in my logs ~88% of tier-reported cache-write tokens are 1-hour.

So expect the savings number to go up.
Savings is a difference: what the text version would have cost minus what pxpipe actually cost.
Both sides rise, but the text version writes more cache tokens, so it rises more, and the gap widens.
The 1-hour write part of the gap scales by 2/1.25 = 1.6×; 5-minute writes, plain input, and cache reads don't move.
Old events recorded before the split was captured keep the 1.25× fallback, so history moves less than new sessions will.

The dollar figure is still a best-effort estimate, not a bill.
And the proxy isn't free: it adds some latency, and a slow turn can fall out of the 5-minute cache window and pay a write where a direct call would have paid a read.
The estimate doesn't try to price that in.

@teamchong teamchong self-assigned this Jul 18, 2026
@teamchong
teamchong merged commit 4bc30d3 into main Jul 18, 2026
1 check passed
@teamchong
teamchong deleted the fix/cache-write-tier-savings branch July 18, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Estimated savings should be calculated based on cache writes.

1 participant