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(gemini): map video response modality instead of MODALITY_UNSPECIFIED
mateo-berrice3bf2d839fd
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.pyindex f9ed8cea9b5..8c4bb1aa0c5 100644--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py@@ -998,6 +998,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):response_modalities.append("IMAGE")elif modality == "audio":response_modalities.append("AUDIO")+ elif modality == "video":+ response_modalities.append("VIDEO")else:response_modalities.append("MODALITY_UNSPECIFIED")return response_modalitiesdiff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.pyindex 51f13affa3f..40f9f4e7910 100644--- a/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py+++ b/tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py@@ -880,6 +880,12 @@ def test_vertex_ai_usage_metadata_with_image_tokens_in_prompt():)+def test_map_response_modalities_video():+ """The video modality maps to VIDEO instead of MODALITY_UNSPECIFIED, which Gemini rejects."""+ v = VertexGeminiConfig()+ assert v.map_response_modalities(["text", "video"]) == ["TEXT", "VIDEO"]++def test_vertex_ai_usage_metadata_accumulates_duplicate_modalities():"""Ensure _calculate_usage accumulates repeated modality entries."""v = VertexGeminiConfig()