fix(pricing): resolve gemini-default routing label for submission - #1026
Merged
junhoyeo merged 5 commits intoAug 3, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
junhoyeo
force-pushed
the
fix/gemini-default-submission-pricing
branch
2 times, most recently
from
August 3, 2026 19:34
d4491a6 to
72d8207
Compare
junhoyeo
force-pushed
the
fix/gemini-default-submission-pricing
branch
from
August 3, 2026 19:34
72d8207 to
e82fe55
Compare
junhoyeo
pushed a commit
that referenced
this pull request
Aug 4, 2026
* fix(test): pass the bucket timezone to build_graph_from_messages in submission tests `build_graph_from_messages` gained a `bucket_timezone` parameter in #1016, and #1026 added two submission tests written against the previous four-argument signature. Neither branch touched the other's lines, so the merge produced no textual conflict and the mismatch only surfaced at compile time: `cargo test -p tokscale-core --lib` fails with two E0061 errors, which blocks the whole core unit test suite. Both call sites now pass `&crate::bucket_tz::BucketTimezone::Local`, matching the neighbouring `graph_pricing_policy_is_strict_only_for_submission` test. * fix(pricing): compose routing-prefix and tier-suffix stripping An id carrying both a routing prefix and a tier suffix resolved to nothing, so `cx/gpt-5.5-xhigh` priced at $0 even though `cx/gpt-5.5` and `gpt-5.5-xhigh` each resolve on their own. The two transformations were never applied together: prefix stripping retried only the terminal segment exactly as it stood, and the suffix stage saw the still-prefixed id and splits on `-`, so peeling `-xhigh` off `cx/gpt-5.5-xhigh` left `cx/gpt-5.5`, which is not a dataset key either. The terminal segment produced by prefix stripping is now also offered to suffix stripping, which resolves the pair through the existing guards rather than adding a new matching rule. This covers the whole tier family reported on the issue, `cx/gpt-5.5-high`, `-medium` and `-low` included, and the same shape on other versions such as `cx/gpt-5.4-xhigh`. --------- Co-authored-by: MoerAI <26067127+MoerAI@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
antigravity-clirecords sessions withgemini-default(Google AI Studio's generic routing label) when no specific model is selected. Local reports priced this label through fuzzy matching, buttokscale submitvalidation requires every token bucket to have a rate, so any session with cached-prefix tokens failed withpricing is unavailable for submitted token usage: google/gemini-default(issue #1019).This PR makes the label resolve deterministically and prices it with full bucket coverage:
gemini-default -> gemini-2.0-flash-lite(same target the local display already fuzzy-matched to, matching the issue's suggested mapping).geminiin fuzzy matching, so generic ids that erode togeminican no longer land on an unrelated gemini key (e.g. a native-audio preview with no cache rates).vercel_ai_gateway/google/gemini-2.0-flash-lite, which has no cache-read rates) cannot cover the usage, retry the canonical unhinted resolution (the bare official key, which has cache rates). This also protects other models whose hinted reseller row lacks rates.Root cause
google/gemini-defaulthas no exact pricing key. The lookup strips the-defaultsuffix, and fuzzy matching then selected the longest unrelated gemini key (dataset-dependent; e.g.gemini/gemini-2.5-flash-native-audio-preview-12-2025). Those rows have input/output rates but no cache-read rates, while Antigravity CLI sessions routinely includecacheReadtokens.covers_usagerequires every populated bucket to have a rate, so validation failed for the whole submission. Local display still worked because cost display only needs input/output rates.Reproduced against the real LiteLLM dataset in both the current shape and an older-cache shape (without the later-added live-audio key): pure input/output usage passed validation while input/output + cacheRead + reasoning failed. After the fix both pass.
Validation
cargo test -p tokscale-core: 1357 lib tests + all integration suites pass (new regression tests cover the alias, the fuzzy blocklist, the Antigravity CLI parser, and submission validation with cache-read usage).cargo test -p tokscale-cli: 993 unit + 132 integration pass.covers_usage_with_provider("gemini-default", Some("google"), cache-read usage)is now true on the current LiteLLM dataset and on the older-cache simulation, with cost computed at full flash-lite rates.cargo fmt --checkandgit diff --checkclean.Boundary
The
gemini-default -> gemini-2.0-flash-litemapping is taken from the issue reporter's local display behavior and the issue's suggested mapping; it is not confirmed against official Google/Antigravity documentation. If the maintainers know the actual default-routing billable model, only the single alias line needs updating - the fallback fix is independent of that choice.Known CI note
test_pricing_command_with_providerin the CLI integration suite depends on live LiteLLM data and fails onmaintoo because upstream removed the bareclaude-sonnet-4-20250514key. Verified by running that test with this change stashed: it fails identically on the base commit. This PR does not change that behavior.Fixes #1019
Summary by cubic
Fix submission pricing for Google’s
gemini-defaultby resolving it togemini-2.0-flash-litewhen it fully covers the used buckets and excluding unpriceable generic routing usage from submission. Submissions now price covered tokens (including cache-read) and no longer fail validation; the CLI warns about excluded generic usage without promising a submission when none remains. Fixes #1019.gemini-default->gemini-2.0-flash-liteonly when it covers all used buckets; otherwise keep provider pricing.geminiin fuzzy matching to avoid wrong hits.google/gemini-defaultmessages from submission.Written for commit 72d8207. Summary will update on new commits.