Issues / #2289
#2289 Anthropic API: cache_creation_input_tokens is never reported, though every newly read token is kept
open · @xrip · 0 Kommentare · Auf GitHub
Beschreibung
## Summary `/v1/messages` never reports `cache_creation_input_tokens`. Every token a request reads is kept for the next request (the live session, and the conversation cache when it is on), which is what Anthropic calls a cache write. Clients that show cache writes, such as Claude Code, always see none. ## Expected Anthropic's usage splits the prompt three ways, and the three add up to the whole prompt: - `cache_read_input_tokens`: read from the cache; - `cache_creation_input_tokens`: written to the cache by this request; - `input_tokens`: neither. ## Actual `message_delta`'s usage has `input_tokens` (everything read now) and `cache_read_input_tokens` (the reused prefix). `cache_creation_input_tokens` is absent, so a client fills in 0, while the tokens read now are in fact kept and reused by the next request. ## Impact Display only: the totals and a client's context fill are already right. Claude Code's status line and cost estimate show every newly read token as uncached input, and no cache writes at all. ## Fix #2290: the newly read tokens are `cache_creation_input_tokens`, all but the last prompt token, which stays `input_tokens` (never 0: Claude Code takes 0 as "not given" and counts the prompt twice, #1013).
Mehr auf der Site
Links zu Install, Modellen, Releases.