Repository navigation
Description
Split from #4241.
Problem: the price of the two reference models is the file pricing_overrides.json in /home/devops/.data/ai/ on the PVC roadmap-service-home. A person writes it by hand with devops ai cost set-price in the pod. genai-prices 0.1.13 returns LookupError for qwen3.8:27b and qwen/qwen3-embedding-8b, so without the file the reports show no savings and log an unpriced warning. A new PVC loses the file.
Why deferred: the repository-owned price needs new code, a setting that holds the price and that PricingRegistry reads. That is a separate change from the ConfigMap template fix.
Acceptance criteria: a setting holds the input and output price per million tokens of a reference model. PricingRegistry reads the setting before it asks genai-prices. The ConfigMap template sets the prices of qwen3.8:27b (0.035 and 1.50 USD) and qwen/qwen3-embedding-8b (0.01 USD). A test shows that the reports price both models with no pricing_overrides.json file. The key-walk test of tests/k8s/test_k8s_configmap_keys.py passes.
Proposed design
Problem statement
The price of the two reference models, qwen3.8:27b and qwen/qwen3-embedding-8b, lives only in the hand-written file pricing_overrides.json on the PVC roadmap-service-home. genai-prices 0.1.13 returns LookupError for both models. Without the file, the reports show no savings and log an unpriced warning. A new PVC loses the file. The repository must own these prices in a setting that PricingRegistry reads. The example ConfigMap sets no ai.reference_model or ai.reference_embedding_model today, so the change must also name the two models there, or the prices would never be used.
Acceptance criteria
Requirement: Reference price setting
The AIConfig model of Settings SHALL hold a mapping from model name to the input price and the output price per million tokens, in USD.
Scenario: A setting with both prices loads
- WHEN a config with ai.reference_prices naming a model with an input and an output price is validated by Settings
- THEN the validation passes and Settings returns both prices for that model
Requirement: Setting read before genai-prices
PricingRegistry MUST read the price from the setting before it asks genai-prices, in get_pricing, price_reference and calculate_request_cost.
Scenario: The setting wins over genai-prices
- WHEN the setting holds a price for a model, no pricing_overrides.json exists, and genai-prices is replaced by a stub that raises an error
- THEN PricingRegistry returns the price of the setting with a source that names the setting, and does not call the stub
Requirement: Override file wins over the setting
A price in pricing_overrides.json MUST win over the price of the setting for the same model.
Scenario: File and setting name one model
- WHEN pricing_overrides.json and the setting both hold a price for one model
- THEN PricingRegistry returns the price of the file
Requirement: Fallback to genai-prices
PricingRegistry SHALL ask genai-prices for a model that neither the override file nor the setting names.
Scenario: A model with no setting entry
- WHEN PricingRegistry prices a model that the setting does not hold
- THEN PricingRegistry returns the price of genai-prices
Requirement: ConfigMap template prices
The ConfigMap template SHALL set ai.reference_model to qwen3.8:27b and ai.reference_embedding_model to qwen/qwen3-embedding-8b, with 0.035 USD input and 1.50 USD output for the first and 0.01 USD input for the second.
Scenario: The rendered ConfigMap holds the prices
- WHEN the test renders the active devops ConfigMap and loads its settings
- THEN the setting holds the three prices as stated for the two models, and the embedding output price is 0
Requirement: Reports price both models without the file
The reports MUST price both reference models when no pricing_overrides.json file exists.
Scenario: Reports with no override file
- WHEN a report runs on local usage of chat and embedding tokens with settings from the ConfigMap template and no pricing_overrides.json file
- THEN each reference model has a price, the savings show, and no unpriced warning is logged
Requirement: Key-walk test passes
The ConfigMap template MUST name only keys that Settings declares.
Scenario: Key walk of the example ConfigMap
- WHEN tests/k8s/test_k8s_configmap_keys.py runs
- THEN unknown_setting_keys returns an empty list and the test passes
Existing Tool Considered
genai-prices 0.1.13 is already in use and is open and maintained. It lacks a price for qwen3.8:27b and qwen/qwen3-embedding-8b, and it has no repository-owned override that a ConfigMap can set. Its own custom-snapshot route (set_custom_snapshot, used for pricing_snapshot.json in src/devops_cli/ai/spend/pricing.py:440-452) needs a provider file on disk, so it is no lighter than the existing override file. The change builds a small pydantic field in AIConfig and one lookup step beside the existing _get_override_pricing in PricingRegistry. Cost: a few thousand tokens to build and test, one pull request, and under one hour of elapsed time. Upkeep is low because the prices change rarely.
Key questions
- Where does the price setting live, and what is its shape?: Add the field reference_prices to AIConfig, a mapping from model name to a small pydantic model with input_usd_per_million and output_usd_per_million (defaults 0.0, ge=0, no NaN). AIConfig already holds reference_model, reference_embedding_model and reference_provider, and the ConfigMap renders the ai section. unknown_setting_keys does not read the keys of a plain mapping field, so model names such as qwen3.8:27b need no declaration. ModelPricing (prompt_usd_per_million, completion_usd_per_million) is the type the registry already returns, so the registry converts the entry to a ModelPricing. (best practice) [sources: src/devops_cli/config/settings.py:671, src/devops_cli/config/settings.py:682, src/devops_cli/config/setting_keys.py:24, src/devops_cli/ai/spend/models.py:15, k8s/devops/configmap.example.yaml:13]
- Chosen: Field reference_prices in AIConfig, model name to prices. AIConfig already owns the reference model settings, the ConfigMap template renders it, and the key-walk test accepts the mapping.
- Rejected: A second JSON file in the repository. It adds a file format, and the ConfigMap would not carry it to the pod.
- Rejected: Fields on AIConfig for each of the two models (chat input, chat output, embedding input). It ties the setting to two slots and breaks when a reference model changes; a mapping keyed by model name follows the model.
- Which price wins when the setting and pricing_overrides.json both name a model?: The override file wins over the setting, and the setting wins over genai-prices. The registry already resolves an override before genai-prices in get_pricing and calculate_request_cost, so the new lookup goes right after _get_override_pricing in both. A person's
devops ai cost set-pricekeeps its effect, and the setting is a default that survives a new PVC. A local call still costs 0 before either lookup. (best practice) [sources: src/devops_cli/ai/spend/pricing.py:469, src/devops_cli/ai/spend/pricing.py:503, src/devops_cli/ai/spend/pricing.py:609, src/devops_cli/ai/spend/pricing.py:615]- Chosen: Override file, then setting, then genai-prices. It keeps the existing override semantics and adds a repository default below the person's choice.
- Rejected: Setting, then override file, then genai-prices. A set-price command would have no effect for a model that the setting names.
- Does the key-walk test render the example ConfigMap that the template change edits?: Yes. The test renders the active devops ConfigMap from the k8s directory, validates it with Settings and walks each key with unknown_setting_keys, so ai.reference_prices must be a field of AIConfig. [sources: tests/k8s/test_k8s_configmap_keys.py:26, tests/k8s/test_k8s_configmap_keys.py:36, src/devops_cli/config/setting_keys.py:18]
- Does the ConfigMap template name the reference models today?: No. k8s/devops/configmap.example.yaml sets no ai.reference_model and no ai.reference_embedding_model, so the Service uses the defaults (gpt-4o-mini and text-embedding-3-small). The change must set both to qwen3.8:27b and qwen/qwen3-embedding-8b next to the prices. Repository docs (docs/CONFIGURATION.md, docs/ENV_VARS.md) are generated from the field declarations, so they need regeneration with the new field. [sources: k8s/devops/configmap.example.yaml:13, src/devops_cli/config/settings.py:682, src/devops_cli/config/settings.py:686, docs/CONFIGURATION.md:203]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Alternatives check of 2026-11-18: none.
Tool: none found.
Reason: Searches found only genai-prices, already in use; its custom snapshot needs a provider file on disk, so no open tool offers a repository-owned price table that the ConfigMap sets and PricingRegistry reads.
Covers:
- Price lookup for models the upstream snapshot knows
- Custom snapshot route loaded from a provider file
- Per-token input and output cost of a request
Lacks:
- No price for qwen3.8:27b or qwen/qwen3-embedding-8b
- No ConfigMap-settable price a pod can read
- Custom snapshot needs a file on disk, lost with a new PVC
- No setting that a pydantic Settings field holds
Activity
devops-cli-service commentedon Nov 9, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(ai)scope of the title gives the scope.A lost price file hides the savings in the reports, but the service continues to run.The reports price both reference models on a new PVC or cluster with no hand-written file.The change needs a new setting, a PricingRegistry change, a template change and a test.A repository-owned setting holds the input and output price of a reference model, and PricingRegistry reads the setting before genai-prices.as the change that both ask for.Both items ask for the same setting that holds the reference model price and that PricingRegistry reads before genai-prices.A person closes one of the two if that is so.devops-cli-service commentedon Nov 9, 2026
Status set to Ready at cc3d22e (see proposed design in issue body).
devops-cli-service commentedon Nov 10, 2026
Alternatives check: in-use
Reason: Searches turned up no open, maintained tool that supplies a repository-owned price setting which this project's own PricingRegistry reads before its lookup. genai-prices is the pricing library the project already uses: it covers per-million-token price lookup and cost calculation, but it holds no price for qwen3.8:27b or qwen/qwen3-embedding-8b and offers no ConfigMap-settable override (its custom-snapshot route still needs a provider file on disk), so the settings field, the ConfigMap template change and the registry lookup order remain repository code.
The item already names this tool.
Tool: genai-prices (https://pypi.org/project/genai-prices)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-10. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 18, 2026
The result in the alternatives block of the issue body changed. Before this check:
in-use, tool https://pypi.org/project/genai-prices. A person decides what the new result means for the item.Searches (8)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 22, 2026
Plan state: branch
feat/4244-hold-the-reference-prices-in-a, draft pull request #6766. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
A model review of the plan found these points. They stop no draft, and a person judges them:
false_premiseat proposal (pull_request_body): The plan says feat(ai): a setting holds the price of a reference model #4242 merged the setting and the template prices, but feat(ai): a setting holds the price of a reference model #4242 is an issue that no merged pull request closed; the code landed in commit feat(ai): a setting holds the price of a reference model #4258. The attribution is wrong even though the code stands at the staged commit. Evidence: "No merged pull request closed it."false_premiseat proposal (feasibility): The plan citestests/support/paths.py:21forREPO_ROOT, but the file declares that constant at line 23. Evidence: "REPO_ROOT: Final[Path] = TESTS_ROOT.parent"false_premiseat proposal (existing_tool): The plan names the embedding reference model asqwen/qwen-embedding-8b; the issue and the template nameqwen/qwen3-embedding-8b. Evidence: "qwen/qwen3-embedding-8b"8 remaining items
devops-cli-service commentedon Nov 22, 2026
The draft pull request #6779 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 50 model requests, 3468494 input tokens, 22690 output tokens.
feat(ai): hold the reference prices in a repository-owned setting (#4244
docs(openspec): archive the change (#4244)
devops-cli-service commentedon Nov 22, 2026
Stopped at pull request.
Failure class:
lint.Action taken: none.
Action left:
repair: give the failure to a fix step.Reason:
The check
Static Analysisof the draft pull request #6779 failed or was cancelled, and no fix-checks Job repairs it.The item is Blocked: the implement Job ended at the draft, and no fix-checks Job takes this case. Fix the cause. Then comment
implement: retry.feat(ai): hold the reference prices in a repository-owned setting (#4244