chore(weave): add gemini-3.1-flash-lite stable model costs - #6886
Closed
ro31337 wants to merge 1 commit into
Closed
Conversation
|
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=2728aca6474e5d2115c43ebe53a260e9b36937f8 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
jwlee64
requested changes
May 19, 2026
Contributor
Author
|
Good call - closing this, will go through the script path instead. Status upstream: litellm merged gemini-3.1-flash-lite stable pricing earlier today in BerriAI/litellm#27933, but to their shin_agent_oss_staging_05_19_2026 branch - their workflow promotes staging to main periodically, so it should land on main in the next 1–3 days. Plan: I'll monitor litellm main and run make update_costs update_model_providers once the rows are there, unless someone else picks it up first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA Issue(s)
WB-34501
Description
Google graduated
gemini-3.1-flash-litefrom preview to general availability on 2026-05-07, with the stable model idgemini-3.1-flash-lite(no-previewsuffix) now served from the same endpoints as before. Ourcost_checkpoint.jsonandmodel_providers.jsonstill only know about the-previewvariants, so any customer or internal call that uses the stable model id today gets recorded with$0cost in Weave's UI and Datadog cost panels.This PR adds the stable-name rows alongside the existing preview rows so cost attribution catches up with the GA. All four name variants we keep for the preview model (bare
gemini-3.1-flash-lite, plus thegemini/,vertex_ai/, andopenrouter/google/prefixed forms) get a corresponding stable-name entry incost_checkpoint.json. The three prefixed variants that already exist inmodel_providers.jsonalso get their stable-name siblings there.openrouter/google/gemini-3.1-flash-liteis intentionally added only tocost_checkpoint.json— that prefix is absent for every gemini model inmodel_providers.jsontoday, so adding it would be a one-off departure from the file's existing shape.The cost-loader in
update_costs.pykeeps these manual entries safe across future automated syncs from litellm. It compares the upstream row against the most recent stored row and only appends a new historical entry when costs differ, capped at three entries per model. If litellm later publishes the same numbers, nothing changes; if they diverge by some rounding, the sync appends a fresh row and the hand-added one stays as historical context.The numeric values stored in
cost_checkpoint.jsonare USD-per-token, so$0.25 per 1M input tokensbecomes0.25 / 1_000_000 = 2.5e-07. Every value can be cross-checked against the public sources linked in the table below — all four sources converge on the same numbers, and each table cell carries the link the reviewer should open to verify that exact value.input2.5e-07output1.5e-06cache_read_input2.5e-08cache_creation_input0.0-previewrows already store in the same fileprovidervertex_ai-language-models(bare andvertex_ai/keys) ·gemini(gemini/key) ·openrouter(openrouter/google/key)providervalue as its-previewsibling already incost_checkpoint.jsoncreated_at2026-05-19 10:13:20datetime.now()format theupdate_costs.pysync script writes)Stable model-id GA confirmation: Firebase AI Logic models page —
gemini-3.1-flash-lite: "Stable version of Gemini 3.1 Flash‑Lite, Stable, 2026-05-07"; OpenRouter listing — "Released May 7, 2026."Why this approach
The team's existing pattern for adding new models is exactly this: a hand-edit of
cost_checkpoint.json(appended at the end) plus amodel_providers.jsoninsertion next to the closest existing sibling, alphabetical-ish within each provider section. PR #6781 ("Add grok 4.3") is the most recent reference. Following that pattern keeps the diff identical in shape to the half-dozen recent merges and minimizes reviewer overhead. The change is strictly additive — no rows removed, no fields renamed.Testing
Both JSON files re-parse cleanly via the real loader at
weave.trace_server.costs.insert_costs.load_costs_from_json(). The loader returns 2,559 models (up from 2,555, +4 as expected) and the four new stable keys round-trip through theCostDetailstyped-dict shape with the costs the file declares.The full suite under
tests/trace_server/costs/passes locally (uv run --group test python -m pytest tests/trace_server/costs/ -v→ 18 passed in 0.08s) anduvx ruff checkon the touched directories passes too.