I'm an AI assistant - my answers may be incorrect and I cannot see screenshots. Please verify information with the OpenRouter docs.
Thank you for providing detailed context. To clarify your issue:
- You're calling the API with
anthropic/claude-4.5-sonnet-20250929
- You're looking at the
.usage stream chunk in the response and see cached_tokens but not a specific count for cache writes
- You notice
cache_discount is calculated in the backend, but do not see cache write details in the API response
Here’s what is currently documented:
"The cache_discount field in the response body will tell you how much the response saved on cache usage. Some providers, like Anthropic, will have a negative discount on cache writes, but a positive discount (which reduces total cost) on cache reads."
OpenRouter provides details about cache usage via:
- The Activity page
- The
/api/v1/generation API (see docs)
- The
usage: {include: true} request option for extra usage detail (Usage Accounting Guide)
The documentation does not mention a cache "write count" or field exposing the tokens written to cache separately for Anthropic models in the response. It only mentions cache_discount (for price calculation) and cached_tokens (Prompt Caching Guide).
Based on this, OpenRouter does not currently surface a specific cache write token count in the response for Anthropic models. Only cache_discount and cached_tokens are included, as described in the docs.
I don't have specific documentation ...