9router/src/lib/db/repos
hodtien 54e3245ace feat(usage): track cached tokens + correct input/output/cache cost (#2209)
Normalize every provider to one cache-inclusive convention via
canonicalizeUsage() before persist, and price cached + cache_creation as
subsets of prompt_tokens in calculateCostFromTokens() to stop
double-counting. usageRepo now delegates cost math to a single source.
Surface Cached tokens/cost across dashboard (overview, tokens, cost,
details). Merge Claude message_start cache with message_delta output so
cache counts survive. Compatible LLM nodes now allow multiple API-key
connections (key pool).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 15:18:27 +07:00
..
aliasRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
apiKeysRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
combosRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
connectionsRepo.js fix: prevent non-SSE stream pipe crash and cross-IdP account overwrites (#2244) 2026-07-03 11:11:07 +07:00
disabledModelsRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
nodesRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
pricingRepo.js fix(translator): ESM-safe registry + tool-id pairing + responses max_tokens; add real-creds tests 2026-06-15 11:38:43 +07:00
proxyPoolsRepo.js feat(db): migrate from lowdb to SQLite with repos pattern 2026-05-09 17:48:20 +07:00
requestDetailsRepo.js refactor(app): DRY pass — split large files, extract shared utils 2026-06-14 19:31:09 +07:00
settingsRepo.js fix(headroom): support Docker sidecar proxy 2026-06-21 17:45:27 +07:00
usageRepo.js feat(usage): track cached tokens + correct input/output/cache cost (#2209) 2026-07-03 15:18:27 +07:00