Skip to content

feat(ai): a setting holds the price of a reference model - #4258

Merged
dan-petty merged 2 commits into
mainfrom
feat/4242-price-overrides-setting
Nov 9, 2026
Merged

dan-petty merged 2 commits into
mainfrom
feat/4242-price-overrides-setting

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Add the setting ai.price_overrides: a map of model name to prompt and completion USD per million tokens. PricingRegistry reads it, so the ConfigMap template owns the prices of qwen3.8:27b and qwen/qwen3-embedding-8b, and a new data volume needs no hand step. A price in pricing_overrides.json wins over the setting for the same model; devops ai cost set-price never copies a price of the setting into the file. The key walk of the settings now checks the fields of each price.

Closes #4242

Change: openspec/changes/archive/2026-11-09-4242-a-setting-holds-the-price-of/

@dan-petty dan-petty added type/feature Type feature: a new function scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Nov 9, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results and decisions for #4242.

Precedence. The file pricing_overrides.json wins over ai.price_overrides for the same model. The two sources merge for different models. The registry keeps the setting in its own dict, so devops ai cost set-price for another model never copies a price of the setting into the file. set-price of a name in the setting wins, and removing that hand price gives back the price of the setting. The issue text chose this rule. If a person wants the setting to win, the change is one line in _get_override_pricing, but set-price would then stop working for the two reference models.

Settings model. Settings has extra="ignore", but the section ai has extra="forbid" (AIConfig). So ai.price_overrides is a declared field, and an image older than this change refuses a ConfigMap that holds the key.

What the live ConfigMap must hold. Apply the key at the same time as the new image or after it, never before. A new image works with no key (the default is an empty map). Under ai: the live ConfigMap needs:

price_overrides:
  qwen3.8:27b:
    prompt_usd_per_million: 0.035
    completion_usd_per_million: 1.50
  qwen/qwen3-embedding-8b:
    prompt_usd_per_million: 0.01
    completion_usd_per_million: 0.0

Nothing was applied to the cluster. The hand file on the Service volume holds the same prices, so the reports do not change at the roll.

Also fixed. unknown_setting_keys read the value type of a mapping field as a nested model and reported the model names as unknown keys. It now checks the fields of each value and reads no model name (new test in tests/k8s/test_k8s_configmap_keys.py).

fail-to-pass (uv run devops ci fail-to-pass --base origin/main): tests/ai/spend/test_pricing_registry_overrides.py errored on the base (the field does not exist), and 2 tests failed on the base (test_the_template_prices_both_reference_models, test_a_key_of_a_price_in_a_copy_of_the_example_is_checked_and_a_model_name_is_not).

Full CI (flock ... uv run devops ci, exit 0): every row passed. The test row took 11m 30s, over the 5 minute budget. The slowest test is tests/prometheus/test_k8s_monitoring_alerting.py (94 s), and the known issue is #3593. This change adds 10 fast tests.

Premise. genai-prices 0.1.13 calc_price raises LookupError for both names. devops docs generate --sync-readme leaves no diff.

@dan-petty
dan-petty marked this pull request as ready for review November 9, 2026 18:10
@dan-petty
dan-petty enabled auto-merge (squash) November 9, 2026 18:14
@dan-petty dan-petty closed this Nov 9, 2026
auto-merge was automatically disabled November 9, 2026 18:19

Pull request was closed

@dan-petty dan-petty reopened this Nov 9, 2026
@dan-petty
dan-petty enabled auto-merge (squash) November 9, 2026 18:28
@dan-petty
dan-petty merged commit d31717d into main Nov 9, 2026
50 of 51 checks passed
@dan-petty
dan-petty deleted the feat/4242-price-overrides-setting branch November 9, 2026 18:41
dan-petty pushed a commit that referenced this pull request Nov 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.103.0](v0.102.0...v0.103.0)
(2026-11-09)


### Features

* **ai:** a setting holds the price of a reference model
([#4258](#4258))
([d31717d](d31717d))
* **ai:** add --since, --until, and --by to cost report and roi
([#4264](#4264))
([fe59c14](fe59c14))
* **ai:** integrate Jev 1.14 and agent configurations
([#4275](#4275))
([28356ed](28356ed))


### Bug Fixes

* **openspec:** check the archive result on disk, plan the dry run
([#4273](#4273))
([cefc184](cefc184))
* **roadmap:** build the trace facts from every plan run
([#4267](#4267))
([b46506d](b46506d))
* **roadmap:** keep refused stage replies, stop placeholder replies
([#4260](#4260))
([aea5adc](aea5adc))
* **roadmap:** match a security trigger word as a word
([#4261](#4261))
([ec96082](ec96082))
* **roadmap:** name schema violations in the log
([#4276](#4276))
([c816e8f](c816e8f))
* **roadmap:** read a quoted tuple as an MCP key in context
([#4265](#4265))
([2cef137](2cef137))


### Code Refactoring

* **ui:** delete kubernetes and logs dashboard tabs
([#4263](#4263))
([2d8b693](2d8b693))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ai): a setting holds the price of a reference model

1 participant