Skip to content

refactor(pricing): host-side pricing pass, decoders emit tokens + basis (phase 0 exemplar) - #810

Merged
iamtoruk merged 1 commit into
feat/core-extractionfrom
phase0/pricing-lift-out
Jul 26, 2026
Merged

iamtoruk merged 1 commit into
feat/core-extractionfrom
phase0/pricing-lift-out

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Phase 0 exemplar for #809, targeting the integration branch (not main).

  • New src/pricing-pass.ts: 'estimated' basis computes cost via the exact formula cachedCallToApiCall already uses on warm-cache reads; 'measured' passes provider-reported dollars through; absent basis = unconverted provider, untouched — both kinds coexist during the fan-out.
  • ParsedProviderCall: add-only optional costUSD?/costBasis?. Pass runs before any cache write: CachedCall values byte-identical, zero parse-version bumps.
  • 3 exemplars converted (zerostack trivial, qwen standard incl. reasoning+cache buckets, quickdesk real-cost passthrough), chosen from a full 33-file call-site survey.
  • docs/core/phase0-recipe.md: per-pattern mechanical recipe for the ~27-provider fan-out, incl. the cache-formula safety theorem, whitelist, worked diffs, per-provider acceptance. Misfits flagged for stronger-model handling: antigravity, mistral-vibe, copilot; parser.ts Claude sites deferred to Phase 3 by design.
  • Determinism test: network/pricing stubbed to throw — decoders never price; tokens identical; cost computed separately.

Verified independently: full suite 2251 passed, tsc clean, exemplars grep-clean of calculateCost, no PROVIDER_PARSE_VERSIONS changes.

@iamtoruk
iamtoruk merged commit 34905db into feat/core-extraction Jul 26, 2026
4 checks passed
@iamtoruk
iamtoruk deleted the phase0/pricing-lift-out branch July 26, 2026 15:00
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