Skip to content

proxy: move model prices to a data file and warn on unpriced models - #169

Closed
abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:fix/100-model-prices-file
Closed

abu-tahir-0 wants to merge 1 commit into
patsypppe:mainfrom
abu-tahir-0:fix/100-model-prices-file

Conversation

@abu-tahir-0

Copy link
Copy Markdown
Contributor

What this changes

Closes #100.

budget.py no longer keeps prices in a dict. They live in model_prices.toml, packaged inside meridian.runtime.proxy and parsed once per process (load_prices), so adding or changing a price is a data edit. The unknown-model fallback stays, but BudgetLedger.charge now logs it once per model per run, naming the model, the default price, and the file to edit.

Also adds the current Claude 4.5 ids at their list prices (claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5), alongside the existing entries.

How it was checked

  • make check passes (ruff, mypy --strict, unit tests) — except tests/unit/test_web_vectors.py, which fails identically on a clean main here (t_quantile differs in the last bit: 3.249835541592117 vs ...118); unrelated to this change.
  • make integration / make e2e, if this touches runtime/, snapshots/, store/, gate/, manifest/ or the proxy — attempted the proxy integration tests, but this checkout has no meridian-proxy:dev / checkout:dev images (make images); CI builds them.
  • New behaviour has a test at the cheapest tier that can catch it, including the cases that should fail: a custom TOML adds a model without code, a malformed pair is refused, and an unpriced model warns once per run (two ledgers imply two warnings).
  • Built the wheel and loaded load_prices() from an extracted copy outside the source tree; model_prices.toml is included and resolves.

Anything a reviewer should know

  • The default fallback is still the Sonnet price, deliberately: the issue asks for visibility, not a different fallback. A noisier alternative would be charging the most expensive known model so a budget stops early; happy to switch if you prefer.
  • PriceBook.from_toml is the seam for the tests (and for a future --prices flag), but there is no runtime override today.
  • Prices remain approximate list prices; the data file says so.

Prices move to model_prices.toml, packaged with the wheel and parsed once per process. Unknown models still fall back to the default price, but each is now logged once per run, so a mis-priced model is visible instead of silent. Adding a model or changing a price is a data edit, not a code change.
@abu-tahir-0

Copy link
Copy Markdown
Contributor Author

Closing this as a duplicate of #168, which was already open for the same issue. I missed it when picking the issue up; sorry for the noise. My branch had the same shape (TOML instead of JSON, plus loader/unit coverage), but there is no reason to review two implementations of the same change. Happy to help there if any of the test or packaging bits are useful.

@abu-tahir-0 abu-tahir-0 closed this Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move model prices to a data file and warn on unknown models

1 participant