Add token history and credit formatting helpers for analytics (#45741)

## What changed

- Add daily text token history grouped by model or token type, with date-range and model filtering, freshness metadata, and validation of token counts. Support both grouped and per-model report data, including reported model totals when components are unavailable.
- Add credit formatting helpers that preserve tiny signed adjustments and format integer millionths without floating-point rounding, plus a short date formatter.

## Testing

Add unit tests for token groupings, model filtering, freshness, missing components, explicit zero totals, and credit formatting across tiny refunds and integer limits.

GitOrigin-RevId: 706dcae7995e46707c2f1df9cdf3e06966459dd6
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-09-15 17:33:25 +00:00
1 parent 1fd5399004
commit 7224096b85
6 files changed
+407

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ pub(crate) enum AccountAnalyticsUnit {
RelativeUsage,
Credits,
Count,
Tokens,
}
#[derive(Debug, Clone, PartialEq)]