feat: show normalized prompt cache hit rates

Token usage previously showed cache reads and writes without a comparable hit rate. Activity usage now calculates a weighted cache hit rate using OpenAI-compatible input totals and Anthropic's separately reported input, cache-read, and cache-write tokens, then shows it in totals and grouped details.

Release note: Token 用量统计新增缓存命中率,并针对 OpenAI 兼容接口与 Anthropic Messages 的不同上报口径进行归一化计算。
This commit is contained in:
mesalogo
2026-08-15 22:01:49 +08:00
parent 0b96400e51
commit 36b38ce2a8
10 changed files with 138 additions and 9 deletions
+2
View File
@@ -379,6 +379,7 @@ export type TokenUsageRecord = {
output: number
cacheRead: number
cacheWrite: number
cacheInput?: number
totalTokens: number
}
@@ -389,6 +390,7 @@ export type TokenUsageSummary = {
output: number
cacheRead: number
cacheWrite: number
cacheInput?: number
totalTokens: number
}
records: TokenUsageRecord[]