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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(cost): bill gemini-embedding-2-preview per token like the GA entries
kerry4a8ec7b9d8c6
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 74ca23fcc8a..9299a1493f8 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -25601,10 +25601,10 @@"source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models"},"gemini-embedding-2-preview": {- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "vertex_ai-embedding-models","max_input_tokens": 8192,"max_tokens": 8192,@@ -25631,10 +25631,10 @@"uses_embed_content": true},"vertex_ai/gemini-embedding-2-preview": {- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "vertex_ai","max_input_tokens": 8192,"max_tokens": 8192,@@ -25689,10 +25689,10 @@},"gemini/gemini-embedding-2-preview": {"deprecation_date": "2026-08-10",- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "gemini","max_input_tokens": 8192,"max_tokens": 8192,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex 74ca23fcc8a..9299a1493f8 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -25601,10 +25601,10 @@"source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models"},"gemini-embedding-2-preview": {- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "vertex_ai-embedding-models","max_input_tokens": 8192,"max_tokens": 8192,@@ -25631,10 +25631,10 @@"uses_embed_content": true},"vertex_ai/gemini-embedding-2-preview": {- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "vertex_ai","max_input_tokens": 8192,"max_tokens": 8192,@@ -25689,10 +25689,10 @@},"gemini/gemini-embedding-2-preview": {"deprecation_date": "2026-08-10",- "input_cost_per_audio_per_second": 0.00016,- "input_cost_per_image": 0.00012,+ "input_cost_per_audio_token": 6.5e-06,+ "input_cost_per_image_token": 4.5e-07,"input_cost_per_token": 2e-07,- "input_cost_per_video_per_second": 0.00079,+ "input_cost_per_video_token": 1.2e-05,"litellm_provider": "gemini","max_input_tokens": 8192,"max_tokens": 8192,diff --git a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.pyindex 5dfeac6f469..926570d7929 100644--- a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py@@ -500,6 +500,28 @@ class TestProcessEmbedContentResponseUsage:)assert prompt_cost == pytest.approx(516 * 1.2e-5 + 64 * 6.5e-6)+ def test_preview_alias_bills_audio_per_token(self):+ response_json = {+ "embedding": {"values": [0.1]},+ "usageMetadata": {+ "promptTokenCount": 64,+ "totalTokenCount": 64,+ "promptTokensDetails": [{"modality": "AUDIO", "tokenCount": 64}],+ },+ }+ result = process_embed_content_response(+ input="audio",+ model_response=EmbeddingResponse(),+ model="gemini-embedding-2-preview",+ response_json=response_json,+ )+ prompt_cost, _ = generic_cost_per_token(+ model="gemini-embedding-2-preview",+ usage=result.usage,+ custom_llm_provider="vertex_ai",+ )+ assert prompt_cost == pytest.approx(64 * 6.5e-6)+def test_image_without_modality_details_uses_image_rate(self):response_json = {"embedding": {"values": [0.1]},