Skip to content

Conversation

@Chesars
Copy link
Contributor

@Chesars Chesars commented Dec 18, 2025

Relevant issues

Fixes #14849

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

  • Fix cache_read_input_token_cost from 3.125e-07 to 1.25e-07 ($0.125/1M)
  • Add missing cache_read_input_token_cost_above_200k_tokens: 2.5e-07 ($0.25/1M)

The previous pricing was 2.5x higher than Google's official rates.

Models Updated

  • gemini-2.5-pro
  • gemini-2.5-pro-exp-03-25
  • gemini-2.5-pro-preview-03-25
  • gemini-2.5-pro-preview-05-06
  • gemini-2.5-pro-preview-06-05
  • gemini-2.5-pro-preview-tts
  • gemini/gemini-2.5-pro
  • gemini/gemini-2.5-pro-preview-03-25
  • gemini/gemini-2.5-pro-preview-05-06
  • gemini/gemini-2.5-pro-preview-06-05
  • gemini/gemini-2.5-pro-preview-tts

Pricing Source

https://ai.google.dev/gemini-api/docs/pricing

Context Size cache_read (before) cache_read (after)
≤200k tokens $0.3125/1M ❌ $0.125/1M ✅
>200k tokens (missing) $0.25/1M ✅

Tests

  • Verified pricing matches Google official documentation
  • Tested cost calculation with Gemini response

- Fix cache_read_input_token_cost: 3.125e-07 → 1.25e-07 ($0.125/1M)
- Add cache_read_input_token_cost_above_200k_tokens: 2.5e-07 ($0.25/1M)

Models updated:
- gemini-2.5-pro
- gemini-2.5-pro-exp-03-25
- gemini-2.5-pro-preview-03-25
- gemini-2.5-pro-preview-05-06
- gemini-2.5-pro-preview-06-05
- gemini-2.5-pro-preview-tts
- gemini/gemini-2.5-pro
- gemini/gemini-2.5-pro-preview-03-25
- gemini/gemini-2.5-pro-preview-05-06
- gemini/gemini-2.5-pro-preview-06-05
- gemini/gemini-2.5-pro-preview-tts

Pricing source: https://ai.google.dev/gemini-api/docs/pricing
@vercel
Copy link

vercel bot commented Dec 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Dec 18, 2025 0:24am

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 cache hit tokens double counted in cost calculator

1 participant