You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(pricing): move model pricing to a DB-backed, periodically-updated table #22
`cli/src/utils/pricing.ts` currently hardcodes a static `MODEL_PRICING` map (Claude, Gemini, OpenAI/Codex) compiled into the CLI. Any time a provider changes pricing or ships a new model, the fix requires a code change + release (see the recent Codex GPT-5.6 pricing fix — cost was hardcoded to 0 until manually patched).
Proposal
Move model pricing out of source code and into the local SQLite database (~/.code-insights/data.db), with a mechanism to refresh it periodically instead of requiring a CLI update:
New table (e.g. model_pricing) keyed by (model_id, effective_from) so historical sessions are costed with the price that was actually in effect at the time, not today's price.
A sync/update path (e.g. code-insights sync or a dedicated code-insights pricing update command) that refreshes the table from a maintained source, with the current hardcoded map kept as the offline/bundled fallback seed.
getModelPricing() / calculateCost() in pricing.ts read from the DB table first, falling back to the bundled defaults if the DB has no entry or the model is unrecognized.
Why
New models currently silently cost $0 or fall back to a generic default until someone notices and patches pricing.ts in a release.
Historical cost figures are wrong once a model's price changes, since the static table only ever holds "current" pricing — no way to reprice old sessions accurately or preserve what a session cost at the time.
Scope note
Needs a design decision on where the periodic price data comes from (bundled JSON updated per release vs. remote fetch vs. manual entry) before implementation — flagging for scoping, not diving into full build yet.
Reason: Unknown models can currently be reported as zero-cost and historical sessions cannot retain the price effective at execution time. That undermines the accuracy of the product’s core cost analysis rather than merely adding convenience.
Scheduling note: First choose an authoritative pricing-source and provenance/update model. Preserve effective dates, bundled offline defaults, unknown-model warnings, and reproducible historical calculations; do not silently reprice past sessions with current rates.
Activity
Merge pull request #22 from melagiri/chore/remove-qr-code-option
ClaudiaFang commentedon Aug 3, 2026
Backlog priority review — 2026-08-04
Priority:
P1Reason: Unknown models can currently be reported as zero-cost and historical sessions cannot retain the price effective at execution time. That undermines the accuracy of the product’s core cost analysis rather than merely adding convenience.
Scheduling note: First choose an authoritative pricing-source and provenance/update model. Preserve effective dates, bundled offline defaults, unknown-model warnings, and reproducible historical calculations; do not silently reprice past sessions with current rates.