Skip to content

fix(admin): show cached input share using all input tokens - #53

Open
rexdotsh wants to merge 1 commit into
mainfrom
fix/usage-cache-read-rate
Open

rexdotsh wants to merge 1 commit into
mainfrom
fix/usage-cache-read-rate

Conversation

@rexdotsh

Copy link
Copy Markdown
Owner

Summary

  • Compute the dashboard cached-input percentage as cacheReadTokens / inputTotalTokens, including cache writes in the denominator. The existing Claude display omitted cache writes and could round to 100% even with substantial writes.
  • Label it cached input rather than cache hit: this is a token share, not a percentage of requests with a cache hit. Show - when input usage is unavailable instead of implying 0%.
  • Cover both the overall KPI and provider breakdown in admin UI tests, including cache-write and no-usage cases.

Evidence

In a read-only 24-hour production bucket query on Sep 27, Opus 5.5 had ~245.4M cache-read, ~14.6M cache-write, and ~37.9K uncached input tokens: ~94.4% cached input, while the old dashboard rounded to 100%. This PR only changes display math; it does not alter stored token counts or proxy behavior.

Checks

  • bun test: 143 passing
  • bun lint
  • bun typecheck

Independent of open PRs #49 and #52. Leave unmerged for review.

This branch has not been deployed

No deployments
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