feat(s36): deterministic integer-ore estimate scaling with model x effort

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0145ZKPLMVeqM47z2jxxokym
This commit is contained in:
Kjell Tore Guttormsen 2026-07-15 09:59:55 +02:00
commit eb889a7f0e
3 changed files with 99 additions and 0 deletions

View file

@ -57,3 +57,22 @@ def test_load_pricing_missing_provenance_raises(tmp_path: Path) -> None:
bad = {"models": _VALID_PRICING["models"]} # no source/date
with pytest.raises(ValidationError):
costsim.load_pricing(_write(tmp_path, bad))
def test_estimate_equals_hand_computed() -> None:
"""Anchor the integer-øre math: m-cheap = 10 øre/1k, effort standard (100%), max_tokens 100_000
100_000*100//100 * 10 // 1000 = 1000 øre/run; 3 projects 3000 øre."""
pricing = costsim.PricingContract(**_VALID_PRICING)
assert costsim.estimate_run_ore("m-cheap", "standard", pricing, max_tokens=100_000) == 1000
assert (
costsim.estimate_portfolio_ore(
"m-cheap", "standard", pricing, n_projects=3, max_tokens=100_000
)
== 3000
)
def test_unknown_effort_raises() -> None:
pricing = costsim.PricingContract(**_VALID_PRICING)
with pytest.raises(ValueError, match="unknown effort"):
costsim.estimate_run_ore("m-cheap", "turbo", pricing)