Repository navigation
feat(pricing): dynamic provider prices with provenance and cache policy - #28
Merged
Merged
Conversation
Price models from a runtime catalogue (LiteLLM, then OpenRouter) instead of a hardcoded table: on-disk cache with TTL, bundled offline snapshot, local overrides, name normalisation across harnesses, per-price provenance, and an explicit unknown state that the minimum-cost filter no longer hides.
…cher provenance - try the exact (prefix-normalised) id in every source before the date-stripped one - session view reads flatten() rows correctly and shows n/a / lower bound for unknown or partial usage in tables, breakdowns, flow and per-call costs - treat unpublished token classes like unknown models in the cost filter - merge cache writes under a lock so concurrent refreshes and failures never drop entries - CLI no longer waits for the network before discovery; sources refresh in parallel - provenance carries rates, currency and a content-hash source version; calls carry a confidence
This was referenced Oct 24, 2026
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and result
Models missing from the old hardcoded tables appeared to cost $0 and were hidden by the minimum-cost filter. Atlas now resolves maintained catalogues at runtime, calculates an estimated API list-price cost for each call's model, and exposes unknown or incomplete prices as
n/aor a lower bound.Closes #20. Historical pricing is deferred to #31.
Agreed scope
The operator selected current-catalogue estimates for both recent and older sessions. Comparing old sessions at today's model prices is intentional. A reproducible historical ledger, effective dates, and invoice/subscription reconciliation are outside this PR. This is the selected alternative to #26; the two implementations should not be merged together.
Implementation
Validation
npm run typecheckandnpm run buildpass.npm run bench: 50,000 sessions, 100 returned rows, approximately 0.3 seconds locally and 0.18 seconds in CI. Fixed the test and benchmark date ranges so September fixtures do not expire out of the default 30-day window.Local real-session verification
n/arather than a zero estimate; added regression coverage.Limits
These are approximate API list-price estimates, not actual subscription charges. Third-party catalogues can lag or contain errors; local overrides take precedence. Long-context, batch/priority tiers, and historical promotional windows are not modeled. Missing rates remain explicit.