Skip to content

fix: correct cache hit rate formula to work across all API backends#1559

Open
ZeroClover wants to merge 1 commit intoWei-Shaw:mainfrom
ZeroClover:fix/cache-hit-rate-formula
Open

fix: correct cache hit rate formula to work across all API backends#1559
ZeroClover wants to merge 1 commit intoWei-Shaw:mainfrom
ZeroClover:fix/cache-hit-rate-formula

Conversation

@ZeroClover
Copy link
Copy Markdown
Contributor

The previous formula cache_read / (cache_read + cache_creation) only worked for Claude API. For OpenAI (where cache_creation is always 0), it degrades to 0% or 100%. The new formula uses
cache_read / (input + cache_creation + cache_read) which equals total input tokens across all backends.

The previous formula `cache_read / (cache_read + cache_creation)` only
worked for Claude API. For OpenAI (where cache_creation is always 0),
it degrades to 0% or 100%. The new formula uses
`cache_read / (input + cache_creation + cache_read)` which equals
total input tokens across all backends.
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