Skip to content

1-hour cache write cost undercounted by 37.5%: Claude

Quick fix

Update Claude Code to a version containing this fix so 1-hour cache writes are billed at 1.6 times the 5-minute cache write rate.

Error output
全部写入都按定价表的缓存写入单价计费:1000 × $6.25/M = **$0.00625**。内置 Claude 定价行填的是 5 分钟价,所以 1h 写入少算 37.5%。
English translation

All writes are billed at the cache write rate in the pricing table: 1000 × $6.25/M = **$0.00625**. The built-in Claude pricing row uses the 5-minute rate, so 1-hour writes are undercounted by 37.5%.

Claude responses and session imports read only the aggregate field `cache_creation_input_tokens` and do not distinguish between `ephemeral_5m_input_tokens` and `ephemeral_1h_input_tokens` in `usage.cache_creation`. As a result, cost calculations bill all cache writes at the 5-minute cache write rate, while 1-hour cache writes should be calculated at 1.6 times that rate.

  1. Use a CC Switch version containing this fix; the issue says only that the fix and regression tests were written, and does not provide a released version number.

ToolClaude Code
Version3.20.2(报告版本;issue 指出 main @ f2537fdf、v3.20.4 之后仍有问题)
PlatformsmacOS

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.