Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(cost): price Gemini 3 preview models at their own rates (#3967)

Yunus Ozen6f23242c8014
diff --git a/packages/core/src/repowise/core/generation/cost_tracker.py b/packages/core/src/repowise/core/generation/cost_tracker.py
index d3b6dde45..0fd36ce27 100644
--- a/packages/core/src/repowise/core/generation/cost_tracker.py
+++ b/packages/core/src/repowise/core/generation/cost_tracker.py
@@ -72,8 +72,8 @@ _PRICING: dict[str, dict[str, float]] = {
"gemini-1.5-flash-lite": {"input": 0.075, "output": 0.30},
"gemini-1.5-pro": {"input": 1.25, "output": 5.0},
# Gemini preview / experimental models
- "gemini-3.1-flash-lite-preview": {"input": 0.075, "output": 0.30},
- "gemini-3-flash-preview": {"input": 0.075, "output": 0.30},
+ "gemini-3.1-flash-lite-preview": {"input": 0.25, "output": 1.50},
+ "gemini-3-flash-preview": {"input": 0.50, "output": 3.00},
"gemini-3.5-flash-lite": {"input": 0.30, "output": 2.50},
# Standard rates; introductory prices run until year end.
"gemini-3.8-flash": {"input": 1.50, "output": 7.50},
diff --git a/tests/unit/cli/test_pricing_table_agreement.py b/tests/unit/cli/test_pricing_table_agreement.py
index bdb4fd2ac..74c829363 100644
--- a/tests/unit/cli/test_pricing_table_agreement.py
+++ b/tests/unit/cli/test_pricing_table_agreement.py
@@ -27,36 +27,12 @@ from repowise.core.generation.cost_tracker import _PRICING, get_model_pricing
_SHARED_MODELS = sorted(set(_COST_TABLE_EXACT) & set(_PRICING))
-# Models where the two tables already disagree, found by this test on the run
-# that introduced it. Both are Gemini "preview" rows that ``cost_tracker``
-# still prices at the gemini-1.5-flash rate ($0.075/$0.30 per MTok) it sits
-# directly beneath in that file, while the estimator carries per-row rates with
-# explicit per-MTok comments. ``gemini-3.5-flash-lite`` agrees in both tables,
-# which is what makes these two look like copied placeholders rather than a
-# deliberate split.
-#
-# Not fixed here: the wrong half is ``core/generation/cost_tracker.py``, and
-# this branch does not own that file. ``strict=True`` on purpose — whoever
-# corrects the rate gets a failing test telling them to delete this entry,
-# rather than a silently-passing xfail that outlives the bug.
-_KNOWN_DRIFT = {
- "gemini-3-flash-preview": "cost_tracker prices it at the 1.5-flash rate",
- "gemini-3.1-flash-lite-preview": "cost_tracker prices it at the 1.5-flash rate",
-}
-
-
-def _param(model: str):
- if model in _KNOWN_DRIFT:
- return pytest.param(model, marks=pytest.mark.xfail(strict=True, reason=_KNOWN_DRIFT[model]))
- return pytest.param(model)
-
-
def test_the_two_tables_actually_overlap() -> None:
"""Otherwise the parametrised test below would vacuously pass on zero cases."""
assert len(_SHARED_MODELS) >= 5, _SHARED_MODELS
[email protected]("model", [_param(m) for m in _SHARED_MODELS])
[email protected]("model", _SHARED_MODELS)
def test_estimate_and_live_counter_price_a_model_identically(model: str) -> None:
"""Per-1K x 1000 must equal per-MTok, for both directions of the bill."""
est_input, est_output = lookup_cost(model)