mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: add cache-aware token usage dashboard (#1338)
* feat: add cache-aware token usage dashboard Track normalized Claude, Codex, and ACP usage with incremental SQLite backfill. Exclude imported transcript history, rebuild usage after history rewrites, and expose an owner-only dashboard with cache-aware totals and breakdowns. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: preserve usage model and local dates via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> * fix: normalize cached usage and timezone buckets via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> --------- Co-authored-by: HAPI <noreply@hapi.run>
This commit is contained in:
@@ -731,3 +731,35 @@ export type SqliteStorageUsageResponse = {
|
||||
shmBytes: number
|
||||
totalBytes: number
|
||||
}
|
||||
|
||||
export type UsageSummaryBucket = {
|
||||
key: string
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
cacheCreationTokens: number
|
||||
totalTokens: number
|
||||
uncachedTokens: number
|
||||
requests: number
|
||||
}
|
||||
|
||||
export type UsageSummaryResponse = {
|
||||
range: {
|
||||
from: number | null
|
||||
to: number | null
|
||||
}
|
||||
totals: {
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
cacheCreationTokens: number
|
||||
totalTokens: number
|
||||
uncachedTokens: number
|
||||
requests: number
|
||||
sessions: number
|
||||
}
|
||||
daily: Array<UsageSummaryBucket & { key: string }>
|
||||
byAgent: UsageSummaryBucket[]
|
||||
byModel: UsageSummaryBucket[]
|
||||
updatedAt: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user