Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(gemini): keep the 2048 cache minimum on Gemini 2.5 Pro only, per Google's live cachedContents API

mateo-berri2303379c2080
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index fcdf6c4baa3..de387552a44 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -25066,7 +25066,6 @@
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
- "prompt_cache_min_tokens": 2048,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
@@ -27139,7 +27138,6 @@
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
- "prompt_cache_min_tokens": 2048,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index fcdf6c4baa3..de387552a44 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -25066,7 +25066,6 @@
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
- "prompt_cache_min_tokens": 2048,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
@@ -27139,7 +27138,6 @@
"supports_parallel_function_calling": true,
"supports_pdf_input": true,
"supports_prompt_caching": true,
- "prompt_cache_min_tokens": 2048,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_system_messages": true,
diff --git a/tests/test_litellm/llms/vertex_ai/context_caching/test_vertex_ai_context_caching.py b/tests/test_litellm/llms/vertex_ai/context_caching/test_vertex_ai_context_caching.py
index 5c33b9a995b..7cbfacfc338 100644
--- a/tests/test_litellm/llms/vertex_ai/context_caching/test_vertex_ai_context_caching.py
+++ b/tests/test_litellm/llms/vertex_ai/context_caching/test_vertex_ai_context_caching.py
@@ -1396,14 +1396,15 @@ class TestContextCachingEndpoints:
# Restart the patcher so teardown_method can stop it cleanly
self._token_check_patcher.start()
- @pytest.mark.parametrize("model", ["gemini-2.5-flash", "gemini-2.5-pro"])
- def test_check_and_create_cache_skips_between_default_and_gemini_2_5_minimum(
- self, model, local_model_cost_map
+ def test_check_and_create_cache_skips_between_default_and_gemini_2_5_pro_minimum(
+ self, local_model_cost_map
):
- """Gemini 2.5 Flash and Pro need 2048 cached tokens, twice the provider-agnostic default.
+ """Gemini 2.5 Pro needs 2048 cached tokens, twice the provider-agnostic default.
- Content between the two used to reach Google's cachedContents endpoint and 400.
+ Content between the two used to reach Google's cachedContents endpoint and 400
+ with "Cached content is too small".
"""
+ model = "gemini-2.5-pro"
self._token_check_patcher.stop()
cached_messages = [