Skip to content

Fix Claude 1-hour cache write pricing#317

Merged
AgentSeal merged 2 commits into
mainfrom
fix/claude-1h-cache-pricing
May 12, 2026
Merged

Fix Claude 1-hour cache write pricing#317
AgentSeal merged 2 commits into
mainfrom
fix/claude-1h-cache-pricing

Conversation

@AgentSeal
Copy link
Copy Markdown
Collaborator

Summary

  • Price 1-hour cache writes at 2x base input instead of the 5-minute 1.25x rate
  • Read usage.cache_creation.ephemeral_5m/1h_input_tokens split from Claude JSONL
  • Fall back to legacy all-at-5-minute-rate behavior for older sessions
  • Bump daily cache to v6 so stale cost totals are recomputed

Based on #304 by @ozymandiashh. Closes #276.

Test plan

  • 674/674 tests pass (6 new: pricing unit, integration, cache invalidation)
  • Pricing math verified: 1.6x multiplier correct across all 7 Claude models
  • All 18 existing calculateCost callers unaffected (new param is optional, defaults to 0)
  • Non-Claude providers isolated, no cross-contamination
  • Cache v5 backed up and recomputed, no data loss
  • No security issues (NaN/negative/malformed data handled at both parser and cost layers)

@AgentSeal AgentSeal merged commit c85beea into main May 12, 2026
3 checks passed
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.

1-hour cache writes priced at 5-minute rate

3 participants