Docs Index
cost transparency.md

Proof Card: Cost Transparency

Status: production Last verified: 2026-05-22 · PR #839

Claim

CostTransparencyService (src/services/cost/CostTransparencyService.ts) reads tenant-attributed AI usage rows from ai_usage_logs and writes daily rollups into cost_rollup_daily (per-tenant/provider/day) and cost_rollup_per_flow (per-tenant/flow/day). Every rollup carries explicit measured / estimated counts captured at write time in ai_usage_logs.cost_source. The dashboard at /cost-transparency-dashboard.html renders per-cell source labels (measured / estimated / mixed (M measured, E estimated) / no data) — silent fallback to estimated is prohibited (see ADR-022).

Source

Tests

Live vs Fixture

Known Gaps

Verification (60-second AI-reviewer recipe)

npx jest tests/unit/services/cost/ --config=jest.fast.config.cjs
npx jest tests/integration/costTransparency.fixture.test.ts --config=jest.slow.config.cjs
grep -n "cost_source" src/database/migrations/047-create-cost-rollup-tables.ts   # confirm column was added
grep -n "pricingForModel" src/services/cost/modelPricing.ts                       # confirm throws-on-unknown contract
# curl -H "Authorization: Bearer <jwt>" http://localhost:3003/api/cost-transparency/dashboard