Skip to content

Fix gemini flash 3 preview price#10315

Open
dirac-run wants to merge 1 commit intocline:mainfrom
dirac-run:fix/gemini-flash-3-preview-pricing
Open

Fix gemini flash 3 preview price#10315
dirac-run wants to merge 1 commit intocline:mainfrom
dirac-run:fix/gemini-flash-3-preview-pricing

Conversation

@dirac-run
Copy link
Copy Markdown

Currently Cline's api.ts has wrong info on gemini-3-flash-preview model. The config says "cacheWritesPrice" is 0.05 and totally skips cacheReadsPrice. The code interprets this as free cache reads (0 cost) which breaks the pricing calculation while using the aforementioned model. This PR fixes that.

Related Issue

Issue: 10314

Description

Test Procedure

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ♻️ Refactor Changes
  • 💅 Cosmetic Changes
  • 📚 Documentation update
  • 🏃 Workflow Changes

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • I have reviewed contributor guidelines

Screenshots

Additional Notes

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 18, 2026

⚠️ No Changeset found

Latest commit: 63a20dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This PR fixes a copy-paste bug in src/shared/api.ts where gemini-3-flash-preview had cacheWritesPrice: 0.05 instead of cacheReadsPrice: 0.05 in both vertexModels and geminiModels, causing cache reads to silently cost $0. It also removes a stale tiers block from the geminiModels entry whose two tiers had identical pricing ($0.30/$2.50) that didn't match the official rates ($0.50/$3.00) confirmed in Google's pricing documentation.

Confidence Score: 5/5

Safe to merge — this is a correct data-only bug fix with no logic changes.

The pricing values are confirmed against official Google AI pricing documentation ($0.50 input, $3.00 output, $0.05 cached reads). Setting cacheWritesPrice to 0 follows the established pattern for Gemini models in this codebase (writes billed at standard input rate). The removed tiers had identical values for both context-window tiers and incorrect prices, so their removal is correct. No logic or behavioral code was changed.

No files require special attention.

Important Files Changed

Filename Overview
src/shared/api.ts Fixes cacheReadsPrice/cacheWritesPrice swap for gemini-3-flash-preview in both vertexModels and geminiModels, and removes duplicate/incorrect tiers; all values align with official Google pricing.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[gemini-3-flash-preview token used from cache] --> B{cacheReadsPrice defined?}
    B -- "Before PR: No (missing field)" --> C["cacheReadsPrice = 0 (free)"]
    B -- "After PR: Yes = 0.05" --> D["cacheReadsPrice = $0.05 / 1M tokens"]
    C --> E["User undercharged — bug"]
    D --> F["Correct billing"]
    A2[gemini-3-flash-preview cache written] --> G{cacheWritesPrice}
    G -- "Before PR: 0.05 (wrong field)" --> H["Pricing logic misled"]
    G -- "After PR: 0 (correct)" --> I["Writes billed at standard inputPrice"]
Loading

Reviews (1): Last reviewed commit: "correct gemini flash 3 preview price" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant