Skip to content

feat(accounting): normalize provider evidence and savings - #222

Open
alteixeira20 wants to merge 5 commits into
teamchong:mainfrom
alteixeira20:upstream-export/02-accounting-evidence
Open

feat(accounting): normalize provider evidence and savings#222
alteixeira20 wants to merge 5 commits into
teamchong:mainfrom
alteixeira20:upstream-export/02-accounting-evidence

Conversation

@alteixeira20

Copy link
Copy Markdown
Contributor

Problem

Provider-reported usage, local estimates, and serialized-byte reduction are different evidence classes, and cache-token buckets do not have identical semantics across providers.

Changes

Add a small provider-neutral accounting API that:

  • distinguishes provider-reported, estimated, bytes-only, and unavailable evidence;
  • treats Anthropic cache read/write buckets as disjoint from uncached input;
  • treats OpenAI-compatible, Featherless, and Google cached tokens as subsets of input;
  • prefers provider-reported baselines over estimates;
  • never turns invalid or negative counters into savings;
  • keeps PXPipe-added and model latency as separately supplied measurements;
  • exports the normalization primitives from the core package.

Scope

No dashboard or tracker rewiring is included.

This PR defines and tests the accounting contract only; it does not introduce a new savings claim.

Validation

Validated from a branch based directly on current upstream 0.13.1:

  • production dependency audit;
  • TypeScript typecheck;
  • focused accounting tests;
  • full test suite;
  • build.

No raw prompts, credentials, session files, or machine identifiers are included.

@alteixeira20
alteixeira20 marked this pull request as ready for review August 12, 2026 03:59
atmediallc pushed a commit to atmediallc/OmniGlyph that referenced this pull request Aug 17, 2026
Add a fail-closed physical-usage contract that distinguishes provider reports, estimates and byte-only evidence without changing the cache-weighted baseline model.

Co-authored-by: Alexandre Teixeira <alexandremagteixeira@gmail.com>

Inspired-by: teamchong/pxpipe#222
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