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(vertex_ai): auto-resolve vertex_location from supported_regions
Chesarsc723d63e591a
diff --git a/litellm/llms/vertex_ai/vertex_ai_partner_models/main.py b/litellm/llms/vertex_ai/vertex_ai_partner_models/main.pyindex 123d925f7c1..67fc6adc127 100644--- a/litellm/llms/vertex_ai/vertex_ai_partner_models/main.py+++ b/litellm/llms/vertex_ai/vertex_ai_partner_models/main.py@@ -161,6 +161,11 @@ class VertexAIPartnerModels(VertexBase):else:raise ValueError(f"Unknown partner model: {model}")+ # Resolve vertex_location based on model's supported_regions+ vertex_location = self.get_vertex_region(+ vertex_region=vertex_location, model=model+ )+api_base = self.get_complete_vertex_url(custom_api_base=api_base,vertex_location=vertex_location,diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.pyindex 86e14a30df4..9f569c525bd 100644--- a/litellm/llms/vertex_ai/vertex_llm_base.py+++ b/litellm/llms/vertex_ai/vertex_llm_base.py@@ -49,8 +49,20 @@ class VertexBase:self.async_handler: Optional[AsyncHTTPHandler] = Nonedef get_vertex_region(self, vertex_region: Optional[str], model: str) -> str:- if is_global_only_vertex_model(model):- return "global"+ import litellm++ # Try to get supported_regions directly from model_cost+ # Check both with and without vertex_ai/ prefix+ model_key = f"vertex_ai/{model}" if not model.startswith("vertex_ai/") else model+ model_info = litellm.model_cost.get(model_key, {})+ supported_regions = model_info.get("supported_regions")++ if supported_regions and len(supported_regions) > 0:+ # If user didn't specify region, use the first supported region+ if vertex_region is None:+ return supported_regions[0]+ # If user specified a region, trust them+ return vertex_regionreturn vertex_region or "us-central1"def load_auth(