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: Support signed URLs with query parameters for Vertex AI Gemini (#17976)
Xingjian Li0eb7d975a17f
diff --git a/litellm/litellm_core_utils/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.pyindex d2c91f4a841..ca2a092dbc8 100644--- a/litellm/litellm_core_utils/prompt_templates/common_utils.py+++ b/litellm/litellm_core_utils/prompt_templates/common_utils.py@@ -689,7 +689,14 @@ def _get_image_mime_type_from_url(url: str) -> Optional[str]:video/mpegpsvideo/flv"""+ from urllib.parse import urlparse+url = url.lower()++ # Parse URL to extract path without query parameters+ # This handles URLs like: https://example.com/image.jpg?signature=...+ parsed = urlparse(url)+ path = parsed.path# Map file extensions to mime typesmime_types = {@@ -717,7 +724,7 @@ def _get_image_mime_type_from_url(url: str) -> Optional[str]:# Check each extension group against the URLfor extensions, mime_type in mime_types.items():- if any(url.endswith(ext) for ext in extensions):+ if any(path.endswith(ext) for ext in extensions):return mime_typereturn None