Skip to content

feat: add codeburn audit token-source view - #578

Merged
iamtoruk merged 1 commit into
mainfrom
feat/token-audit
Jul 1, 2026
Merged

iamtoruk merged 1 commit into
mainfrom
feat/token-audit

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

What

Adds codeburn audit, a token-source / conversion-transparency view to make token-amount mismatches (the #574 class of report) diagnosable in one command.

For each (provider, model) it shows the raw token fields the provider records next to the totals codeburn displays and prices, so any drift is visible:

codeburn audit              # table
codeburn audit --format json
what it surfaces
raw fields input, output, reasoning, cache write, cache read, per provider/model
normalizations reasoning folds into output; cache read = sum of per-call max(Anthropic cacheReadInput, OpenAI cached); cache write/read priced at 1.25x / 0.1x input when a model omits explicit cache rates
--format json per-component cost, the exact rates applied, both raw cache-read fields, and recomputed vs attributed cost

It turns "your numbers look off" reports (cache pricing, reasoning tokens, unpriced models) into a one-command diff. On real data it immediately surfaces things like an unpriced model showing $0 and the reasoning-token split on GPT-5.5.

Notes

  • Same options as codeburn models (period / from / to / provider / format).
  • New tests/audit-report.test.ts pins the normalizations (reasoning fold, per-call cache-read max, unpriced model -> null rates). Full suite green.

Adds a per-(provider, model) audit table showing the raw token fields each
provider records (input, output, reasoning, cache write/read) alongside the
totals codeburn displays and prices. It makes the normalizations explicit:
reasoning folds into output, the Anthropic cacheReadInput / OpenAI cached
vocabularies collapse to a per-call max, and cache write/read use the 1.25x /
0.1x input multipliers when a model omits explicit cache rates.

--format json adds per-component cost, the applied rates, both raw cache-read
fields, and recomputed vs attributed cost, so any token-to-cost drift is
visible in one command. Same options as `codeburn models`.
@iamtoruk
iamtoruk merged commit 2b0f781 into main Jul 1, 2026
3 checks passed
@iamtoruk
iamtoruk deleted the feat/token-audit branch July 1, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant