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
feat use identity_pool for vertex
Ishaan Jaff32281252158f
diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.pyindex a88925330aa..f40f6e90c5f 100644--- a/litellm/llms/vertex_httpx.py+++ b/litellm/llms/vertex_httpx.py@@ -832,6 +832,7 @@ class VertexLLM(BaseLLM):self, credentials: Optional[str], project_id: Optional[str]) -> Tuple[Any, str]:import google.auth as google_auth+ from google.auth import identity_poolfrom google.auth.credentials import Credentials # type: ignore[import-untyped]from google.auth.transport.requests import (Request, # type: ignore[import-untyped]@@ -855,10 +856,16 @@ class VertexLLM(BaseLLM):else:json_obj = json.loads(credentials)- creds = google.oauth2.service_account.Credentials.from_service_account_info(- json_obj,- scopes=["https://www.googleapis.com/auth/cloud-platform"],- )+ # Check if the JSON object contains Workload Identity Federation configuration+ if "type" in json_obj and json_obj["type"] == "external_account":+ creds = identity_pool.Credentials.from_info(json_obj)+ else:+ creds = (+ google.oauth2.service_account.Credentials.from_service_account_info(+ json_obj,+ scopes=["https://www.googleapis.com/auth/cloud-platform"],+ )+ )if project_id is None:project_id = creds.project_id