Skip to content

fix(model_prices): correct cache read pricing for Gemini flash latest and preview aliases - #38215

Closed
Alphaxiaoteng wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Alphaxiaoteng:fix/gemini-flash-cache-pricing
Closed

fix(model_prices): correct cache read pricing for Gemini flash latest and preview aliases#38215
Alphaxiaoteng wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Alphaxiaoteng:fix/gemini-flash-cache-pricing

Conversation

@Alphaxiaoteng

Copy link
Copy Markdown

Fixes #38062

Root Cause

Several Gemini 2.5 / Flash aliases in model_prices_and_context_window.json (and its backup) still billed cache reads at 25% of input cost (7.5e-08 / 2.5e-08), which was the legacy Gemini 2.0 rate, instead of the 10% rate (3e-08 / 1e-08) matching Google's official Gemini 2.5 Flash pricing:

  • gemini/gemini-flash-latest (7.5e-08 -> 3e-08)
  • gemini/gemini-flash-lite-latest (2.5e-08 -> 1e-08)
  • gemini/gemini-2.5-flash-preview-09-2025 (7.5e-08 -> 3e-08)
  • gemini-2.5-flash-preview-09-2025 (7.5e-08 -> 3e-08)
  • gemini/gemini-2.5-flash-lite-preview-06-17 (2.5e-08 -> 1e-08)
  • gemini-2.5-flash-lite-preview-06-17 (2.5e-08 -> 1e-08)

Changes

  • Updated cache_read_input_token_cost in model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json to 10% of input_cost_per_token.
  • Added unit test in tests/test_litellm/llms/gemini/test_cost_calculator.py covering all corrected model aliases.

Verification & Test Evidence

  • pytest tests/test_litellm/llms/gemini/test_cost_calculator.py -> Passed (19 passed, exit code 0)
  • pytest tests/test_litellm/test_model_prices_schema.py -> Passed (21 passed, exit code 0)
  • python ci_cd/check_files_match.py -> Passed (exit code 0)
  • python ci_cd/generate_model_prices_schema.py --check -> Passed (exit code 0)
  • ruff check --config ruff-tests.toml tests/test_litellm/llms/gemini/test_cost_calculator.py -> Passed (exit code 0)

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review (388 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@CLAassistant

CLAassistant commented Aug 25, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alpha Intelligence seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Alphaxiaoteng
Alphaxiaoteng changed the base branch from main to litellm_internal_staging August 25, 2026 15:29
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing Alphaxiaoteng:fix/gemini-flash-cache-pricing (12aecc4) with litellm_internal_staging (31a6756)

Open in CodSpeed

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by the rolling registry PR #38207, which carries these values re-verified against the provider's own pricing page/API (DeepInfra publishes $/token and 262144 context for the Kimi K2.5 and K2.7 Code entries). Maintainers asked for a single open model-pricing PR at a time.

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.

[Bug]: gemini *-latest aliases price a cache read at the deprecated 2.0 rate (25% of input, should be 10%)

2 participants