Skip to content

LLMUsage.cacheWriteTokens: Anthropic cache writes reported apart - #22

Merged
ayman3000 merged 1 commit into
mainfrom
usage-cache-writes
Oct 9, 2026
Merged

ayman3000 merged 1 commit into
mainfrom
usage-cache-writes

Conversation

@ayman3000

Copy link
Copy Markdown
Owner

Adds an optional cacheWriteTokens to LLMUsage (default nil, source-compatible); Anthropic fills it from cache_creation_input_tokens. Naseem needs it to price cache writes (1.25x) apart from cache reads and plain input. swift test: 175 passed.

🤖 Generated with Claude Code

Cache writes bill above the plain input rate (1.25x for 5-minute writes)
and reads below it, so a host's cost estimate needs both apart from the
rest of the prompt. Anthropic maps cache_creation_input_tokens; other
providers leave it nil.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ayman3000
ayman3000 merged commit 59ea46f into main Oct 9, 2026
1 check passed
@ayman3000
ayman3000 deleted the usage-cache-writes branch October 9, 2026 21:24
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 participant