Repository navigation
Conversation
… the models they point to, and Gemini 2.5 cache reads at 10%
…cing of the model it names
…to the 0.25 tier rate
|
@xyzs996 is attempting to deploy a commit to the LobeHub OSS Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb69359ba8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| pricing: { | ||
| units: [ | ||
| { name: 'textInput_cacheRead', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' }, | ||
| { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' }, |
There was a problem hiding this comment.
Preserve the higher cached-audio rates
When Gemini 2.5 Flash usage contains cached audio, computeChatCost assigns those tokens to textInput_cacheRead unless the card provides a dedicated audioInput_cacheRead unit (computeChatCost.ts:186-204). Consequently this change charges cached audio at $0.03/M instead of Google's $0.10/M rate; the analogous Flash-Lite change charges $0.01/M instead of $0.03/M. Add the modality-specific units, as the Gemini 3.1 Flash-Lite card already does, and cover both corrected paths with regression assertions.
AGENTS.md reference: AGENTS.md:L124-L124
Useful? React with 👍 / 👎.
What
Three Gemini price rows in
packages/model-bank/src/aiModels/google.tsdisagree either withGoogle's published rate card or with the row they say they mirror. All three make LobeHub's
displayed cost roughly 2x too high for cache-heavy traffic.
Every number below is from https://ai.google.dev/gemini-api/docs/pricing, checked today.
1.
gemini-flash-latestis priced at the 2027 rate#18289repointed this alias fromgemini-3.6-flashtogemini-3.7-flashand updated itsextendParams, but left thepricingblock untouched. In the same PR,gemini-3.6-flashwasrepriced down to the introductory rate — with a comment that spells out exactly what the alias
is now carrying:
gemini-3.7-flash(target)gemini-flash-latest(alias, today)Exactly 2x, on every unit, until 2027-01-01.
2.
gemini-pro-lateststill carries Gemini 2.5 Pro's rate cardIts description says
Points to gemini-3.1-pro-preview, but its numbers are 2.5 Pro's:gemini-3.1-pro-preview(target)gemini-pro-latest(alias, today)Input is 1.6x low, output 1.2x low, cache read 1.55x high. It is also missing the
imageInput/videoInput/audioInput/textInput_cacheWriteunits the target has, somulti-modal input on this alias currently bills at nothing.
The third alias,
gemini-flash-lite-latest, matches its target exactly — that is the intendedconvention, and it is the one the existing test happens to pin.
3. Gemini 2.5 cache reads are at the retired 2.0 ratio
Google charges 10% of input for context caching on 2.5. These rows use 25%, which was the
Gemini 2.0 rate:
gemini-2.5-progemini-2.5-flashgemini-2.5-flash-liteThis is specifically a 2.5 problem: every 3.x row in the file already uses 10%, and the 2.0 and
1.5 rows correctly use 25% because that was the rate then, which is why it doesn't read as
wrong at a glance.
Impact
Priced at a coding agent's token mix — 95.6% cache read, 4.1% cache miss, 0.3% output, measured
over 8.04B tokens — per 1M tokens:
gemini-flash-latestgemini-2.5-flash-litegemini-2.5-pro(>200k)gemini-2.5-flashgemini-pro-latest(≤200k)gemini-pro-latestis the mixed one: over-billed on cache reads, under-billed on input andoutput, so a short uncached prompt is reported cheaper than it is.
Test
Google rolling model aliasesalready assertsflashLiteLatest.pricing === flashLite.pricing,but only for that one pair — which is why the other two drifted. I replaced the one-off check
with a generic one that reads each alias's own
descriptionand compares against the model itnames, so repointing an alias without repricing it fails here:
Two
computeChatCostcases readgemini-2.5-pro's real pricing and had the old 0.625 bakedinto their expected credits; those are updated with the arithmetic shown in the comments.
Not changed here
The same two rows exist elsewhere and I left them alone rather than guess:
vertexai.tspricesgemini-3.6-flashandgemini-3.7-flashat 1.5 / 7.5 / 0.15 — thepost-2027 numbers — while
google.tshas 0.75 / 3.75 / 0.075 for the same models. Same PRadded both. I could not load Vertex's own pricing table to confirm Vertex mirrors AI Studio
here, and
gemini-2.0-flashis already priced differently in the two files (0.15 vs 0.10), soI did not assume it. Happy to include it if you confirm the direction.
vertexai.tsandaihubmix.tscarry the same 25% cache-read ratio on their Gemini 2.5 rows.aihubmix.tsmirrors google.ts exactly on every 3.x row, so those two rows are very likely thesame defect — say the word and I'll add them to this PR.
Test
Negative control for the new assertion: with only
gemini-flash-latest's pricing reverted toits current values,
prices gemini-flash-latest the same as the model it points tofails andthe other 16 still pass — so the test is pinning the thing it claims to pin.
🔗 Related Issue
None — found while diffing the catalog against Google's rate card. Related to #18289, which is
where the
gemini-flash-latestalias was repointed.