Repository navigation
Description
Friction
- Each process prices its local tokens against its own
ai.reference_model, and the savings counter carries no reference label. The dashboard adds workstation savings priced at gpt-4o to roadmap-service savings priced at gpt-4o-mini. - Over 30 days roadmap-service shows $1.78 where gpt-4o pricing gives $29.69. The 30-day "Local Cloud Savings" is about $28 low on a gpt-4o basis, or the workstation part about 16.7x high on a gpt-4o-mini basis.
- A reference model genai-prices does not know, such as the typo
gpt-4o-mni, makes every local request's savings $0 with no warning. - A hosted model genai-prices does not know is stored at $0 with source "unknown", and nothing records that it went unpriced.
- No effect in the last 24 h, when only the workstation emitted. Any range that includes Service activity mixes the two prices.
Evidence
Checked at main 3dd7fa6 (v0.2.36) on 2026-10-17, read-only. genai-prices 0.1.9 queried offline from its bundled snapshot.
_emit_local_cost_equivalent(src/devops_cli/ai/spend/ledger.py:601-617) resolves the reference inside the emitting process throughSpendLedger._resolve_reference_model(:341-351), fromsettings.ai.reference_model.- The default is
gpt-4o-mini(src/devops_cli/config/defaults.py:65). The emitted labels are provider, model, server and backend (ledger.py:700-705). Nothing is emitted when the result is 0 (:616). - The workstation's runtime config sets
reference_model: gpt-4o.k8s/devops/configmap.example.yamlsets none, so the Service uses the default. - Live 30 d: savings divided by tokens at gpt-4o rates is about 1.00 for current workstation instances and 0.060 (0.15/2.5 = 0.6/10) for all 19 roadmap-service pods.
get_pricingfalls back toModelPricing(0, 0, source="unknown")(src/devops_cli/ai/spend/pricing.py:439-446). The ledger has no pricing-source column (ledger.py:33-51).AIConfig.reference_modelis an unvalidated str (src/devops_cli/config/settings.py:459).- Offline probe:
gpt-4o-mniandgpt-9-previewresolve to 0/0 "unknown";gpt-4oresolves to $2.50/$10.00 per million tokens. src/devops_cli/ai/spend/models.py:148and:173hard-code"gpt-4o-mini"instead ofDEFAULT_AI_REFERENCE_MODEL.
Remedy
Tests first, in tests/test_ai_spend_pricing.py, tests/test_ai_spend_ledger.py and tests/test_k8s_monitoring_dashboards.py, using genai-prices' bundled snapshot. No network:
- Two processes configured with different
ai.reference_modelvalues produce savings the dashboard prices with one reference. - An unknown
ai.reference_modelorai.reference_embedding_modellogs one warning naming it, anddevops ai costsays the savings are unpriced instead of printing $0. - A hosted request whose model resolves to "unknown" logs one warning per model per process and stores
pricing_source="unknown"in a new ledger column. - No
"gpt-4o-mini"literal remains outsidesrc/devops_cli/config/defaults.py.
Code, proposed design (owner decision below):
- Price savings in one place, at query time. devops-cli records which tokens ran locally, as a
locallabel ondevops_cli_ai_tokens_totalor adevops_cli_ai_local_tokens_totalcounter. - A recording rule in
k8s/monitoring/prometheus-values.yamlholds the reference price per operation and token type. A test checks the committed prices against genai-prices for the default chat and embedding references, so they cannot drift. - The savings panels multiply tokens by price.
AI_LOCAL_COST_EQUIVALENT_USD_TOTALand_emit_local_cost_equivalentare removed in the same change. A changed reference then re-prices history, and every process agrees. - Interim, if the owner keeps client-side pricing: set
ai.reference_modelin the cluster ConfigMap (k8s/devops/configmap.example.yamland the live one) to the workstation's value, and add areference_modellabel the panels group by. - Check both reference settings against the pricing registry when
devops ai costanddevops config showrun. A warning, not a load error, so a registry update cannot break config loading. - Persist
ModelPricing.sourceon each ledger row aspricing_source. - Replace the
models.pyliterals withDEFAULT_AI_REFERENCE_MODEL.
Key question for the owner: which reference prices savings (gpt-4o as on the workstation, or the gpt-4o-mini default), and whether savings move to query time.
Depends on: the embedding-recording item, which adds ai.reference_embedding_model and the operation label.
Proposed: type/bug, P2-Medium.
Proposed design
Problem statement
The current implementation of local AI spend tracking uses different reference models per process, causing inconsistent savings calculations. When an unknown model is specified, it silently prices at $0 without warning. Additionally, the dashboard mixes savings from different processes priced at different rates, making it difficult to interpret the actual cost savings.
Acceptance criteria
- Criterion 1: Two processes configured with different ai.reference_model values produce savings that are priced consistently using one reference model
Verification: Run tests in test_ai_spend_pricing.py, test_ai_spend_ledger.py and test_k8s_monitoring_dashboards.py using genai-prices' bundled snapshot to verify that savings from different processes are priced with a single consistent reference model. - Criterion 2: An unknown ai.reference_model or ai.reference_embedding_model logs one warning naming it, and devops ai cost shows unpriced savings instead of printing $0
Verification: Verify that when an invalid reference model is configured, the system logs a warning message and displays 'unpriced' rather than zero cost in the devops ai cost output. - Criterion 3: A hosted request whose model resolves to "unknown" logs one warning per model per process and stores pricing_source="unknown" in a new ledger column
Verification: Ensure that when a hosted model cannot be resolved, a warning is logged once per process and the ledger stores 'pricing_source' as 'unknown' for that record. - Criterion 4: No literal "gpt-4o-mini" remains outside src/devops_cli/config/defaults.py
Verification: Search codebase to ensure no hardcoded "gpt-4o-mini" strings exist outside the defaults.py file, all references should use DEFAULT_AI_REFERENCE_MODEL.
Key questions
- Which reference prices savings (gpt-4o as on the workstation, or the gpt-4o-mini default), and whether savings move to query time.: Based on the issue description, the decision is to use the gpt-4o model for pricing savings, matching the workstation's configuration. Savings will be priced at query time rather than client-side to ensure consistency. (proposed)
- Should client-side pricing be kept or moved to query time?: The issue indicates that moving savings pricing to query time is preferred for consistency. Interim solution suggests setting ai.reference_model in the cluster ConfigMap to match workstation value. (proposed)
Fit
Needs splitting into 5 items:
- Move savings pricing from client-side to query time
- Implement unified reference model for all processes
- Add warning logs for unknown models
- Persist pricing source in ledger
- Remove hardcoded gpt-4o-mini literals
Suspected block
None.
Dependencies
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 18, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The candidate describes a defect in how local AI savings are priced and reported.The defect causes significant misreporting of costs and savings, affecting financial accuracy.Correctly pricing local AI usage affects financial reporting and decision-making for users.Fixing requires changes across multiple components including ledger, pricing, and dashboard logic.dan-petty commentedon Oct 18, 2026
Proposal needs splitting into 5 items at 25e2cda (see proposed design in issue body).
fix(ai): embedding requests reach the spend ledger and the AI usage c…
fix(ai): the spend series exists at $0, a gateway call counts as loca…
fix(monitoring): the ai spend dashboard shows local savings for every…