Skip to content

fix(cost_map): vertex gemini-3.5-flash-lite priority cache read is $0.054/M - #41137

Closed
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_gemini35_flash_lite_vertex_priority_cache_rate
Closed

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_gemini35_flash_lite_vertex_priority_cache_rate

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

  • Set cache_read_input_token_cost_priority to 5.4e-08 on gemini-3.5-flash-lite and vertex_ai/gemini-3.5-flash-lite in both map copies
  • Update the vertex_ai priority row in GEMINI_35_FLASH_LITE_TIER_RATES_BY_SURFACE to 5.4e-08
  • gemini/gemini-3.5-flash-lite (Gemini API surface) is untouched at 5e-08

User Flow

Before: a Vertex user on the priority tier with cached prompt tokens is underbilled

  1. They send POST https://litellm-domain/v1/chat/completions with "model": "vertex_ai/gemini-3.5-flash-lite", "service_tier": "priority" and a prompt that hits the context cache
  2. The response header x-litellm-response-cost bills cached input at $0.05/M
  3. https://litellm-domain/ui/?page=logs shows spend about 7% below the Google invoice for cached input

After: the same request bills cached input at Google's published priority rate

  1. They send the same POST https://litellm-domain/v1/chat/completions
  2. x-litellm-response-cost bills cached input at $0.054/M
  3. https://litellm-domain/ui/?page=logs matches the Google invoice

Relevant issues

Unblocks CI on #40955 (core-utils shard). The provider sync produced the correct 5.4e-08 there; the hardcoded test was stale

Affected release

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Raw page evidence, fetched with curl and a cache-buster from https://cloud.google.com/gemini-enterprise-agent-platform/generative-ai/pricing, Gemini 3 section, Priority tab, columns "Price (/1M tokens) <= 200K input tokens with Priority | > 200K input with Priority | <= 200K cached input tokens with Priority | > 200K cached input tokens with Priority":

Gemini 3.5 Flash-Lite | Input (text, image, video, audio) | Global       | $0.54  | $0.54  | $0.054  | $0.054
                      |                                   | Non-global * | $0.594 | $0.594 | $0.0594 | $0.0594
                      | Text output (response and reasoning) | Global    | $4.50  | $4.50  | N/A     | N/A

$0.054 per 1M tokens = 5.4e-08 per token, matching the new map value. Input $0.54/M (5.4e-07) and output $4.50/M (4.5e-06) already matched

Before (7fd541e)

  1. LITELLM_LOCAL_MODEL_COST_MAP=True uv run pytest tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py -k gemini_35_flash_lite with the chore(prices): sync Vertex AI prices: 14 models #40955 map: FAILED ...[vertex_ai-priority-5.4e-07-4.5e-06-5e-08] - assert 0.0004428 == 0.000442 ± 1.0e-12

After (18d85c7)

  1. Same command: 8 passed, 290 deselected

Type

🐛 Bug Fix
✅ Test

Caveats (if any)

Low

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/7553267d0ea54bf4925a6df40e7ca640
Open in Devin Desktop: https://app.devin.ai/desktop/session/7553267d0ea54bf4925a6df40e7ca640?variant=devin

….054/M

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 14, 2026 22:15
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

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.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects Gemini 3.5 Flash-Lite priority cached-input pricing for Vertex-backed model entries from $0.05/M to $0.054/M

  • Updates both the root pricing map and bundled fallback map
  • Covers prefixed and unprefixed Vertex-backed model keys
  • Updates the behavioral cost-calculation regression test while leaving Gemini API pricing unchanged

Confidence Score: 5/5

The PR appears safe to merge because the pricing correction is consistently applied and covered by the existing behavioral cost test

Both runtime pricing-map copies update the relevant Vertex-backed entries, and the regression test verifies cached-token billing through the service-tier cost path without changing Gemini API behavior

Important Files Changed

Filename Overview
model_prices_and_context_window.json Corrects the priority cache-read rate for both Vertex-backed Gemini 3.5 Flash-Lite model keys
litellm/model_prices_and_context_window_backup.json Keeps bundled fallback pricing synchronized with the root pricing map
tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py Updates the Vertex priority-tier behavioral expectation while retaining distinct Gemini API pricing coverage

Reviews (1): Last reviewed commit: "fix(cost_map): vertex gemini-3.5-flash-l..." | Re-trigger Greptile

@codspeed

codspeed Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_gemini35_flash_lite_vertex_priority_cache_rate (18d85c7) with main (7fd541e)

Open in CodSpeed

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Closing: main already carries this Vertex value and test expectation, and the direct Gemini row fix lives in rolling PR #41597

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