Skip to content

Fix Claude 1-hour cache write pricing#304

Closed
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/claude-1h-cache-pricing
Closed

Fix Claude 1-hour cache write pricing#304
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/claude-1h-cache-pricing

Conversation

@ozymandiashh
Copy link
Copy Markdown
Contributor

@ozymandiashh ozymandiashh commented May 11, 2026

Summary

  • parse Claude Code's usage.cache_creation.ephemeral_5m_input_tokens and usage.cache_creation.ephemeral_1h_input_tokens split when present
  • price 5-minute cache writes at the existing LiteLLM cache-write rate and 1-hour cache writes at 1.6x that rate, matching Anthropic's 2x base input pricing for 1-hour cache writes
  • preserve legacy behavior when only cache_creation_input_tokens exists, so older Claude JSONL still prices all cache writes at the 5-minute rate
  • keep report/export cache-write token totals as the aggregate write count while only changing cost math
  • bump the daily cache to v6 so historical cached rollups with under-reported Claude costs are discarded and recomputed from raw sessions
  • document the Claude pricing split and add changelog coverage plus focused regression tests

Closes #276.

Validation

  • npm run build
  • npx vitest run tests/parser-claude-cwd.test.ts tests/models.test.ts tests/models-hoist.test.ts tests/daily-cache.test.ts (4 files / 103 tests)
  • npx vitest run (47 files / 665 tests)
  • git diff --check
  • Argus local reviewer: PASS
  • Claude Opus 4.7 effort max: PASS
  • Gemini 3.1 Pro Preview: PASS

Notes

@AgentSeal AgentSeal added needs-testing needs-validation PR requires validation against real-world usage before review and removed needs-testing labels May 12, 2026
@AgentSeal
Copy link
Copy Markdown
Collaborator

Superseded by #317 which includes conflict resolution and cleaned-up changelog entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-validation PR requires validation against real-world usage before review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1-hour cache writes priced at 5-minute rate

2 participants