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
Merge branch 'main' into litellm_image_edit_vertex_cred_fix
Sameer Kankutea13611dcdb0f
diff --cc tests/test_litellm/llms/vertex_ai/image_edit/test_vertex_ai_image_edit_transformation.pyindex 1e300cd48fb,8c1bd1545f9..c231904e710--- a/tests/test_litellm/llms/vertex_ai/image_edit/test_vertex_ai_image_edit_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/image_edit/test_vertex_ai_image_edit_transformation.py@@@ -140,30 -140,54 +140,78 @@@ class TestVertexAIGeminiImageEditTransfheaders={},)+ def test_validate_environment_with_litellm_params(self) -> None:+ """Test validate_environment uses credentials from litellm_params"""+ with patch.object(+ self.config, "_ensure_access_token", return_value=("test-token", "test-expiry")+ ) as mock_token:+ with patch.object(self.config, "set_headers", return_value={"Authorization": "Bearer test-token"}) as mock_headers:+ litellm_params = {+ "vertex_ai_project": "custom-project",+ "vertex_ai_credentials": "/path/to/custom/credentials.json",+ }++ result = self.config.validate_environment(+ headers={"X-Custom": "header"},+ model=self.model,+ litellm_params=litellm_params,+ api_base=None,+ )++ # Verify that safe_get_vertex_ai_project and safe_get_vertex_ai_credentials were used+ mock_token.assert_called_once()+ call_kwargs = mock_token.call_args[1]+ assert call_kwargs["credentials"] == "/path/to/custom/credentials.json"+ assert call_kwargs["project_id"] == "custom-project"+ assert result == {"Authorization": "Bearer test-token"}+ def test_get_complete_url_from_litellm_params(self) -> None:+ """Test vertex_project/vertex_location read from litellm_params first"""+ url = self.config.get_complete_url(+ model="gemini-2.5-flash",+ api_base=None,+ litellm_params={+ "vertex_project": "params-project",+ "vertex_location": "us-east1",+ },+ )+ assert "params-project" in url+ assert "us-east1" in url++ def test_get_complete_url_global_location(self) -> None:+ """Test global location uses correct base URL without region prefix"""+ url = self.config.get_complete_url(+ model="gemini-2.5-flash",+ api_base=None,+ litellm_params={+ "vertex_project": "test-project",+ "vertex_location": "global",+ },+ )+ assert "aiplatform.googleapis.com" in url+ assert "global-aiplatform.googleapis.com" not in url+ assert "/locations/global/" in url++ def test_get_complete_url_litellm_params_overrides_env(self) -> None:+ """Test litellm_params takes precedence over environment variables"""+ with patch.dict(+ os.environ,+ {+ "VERTEXAI_PROJECT": "env-project",+ "VERTEXAI_LOCATION": "us-central1",+ },+ ):+ url = self.config.get_complete_url(+ model="gemini-2.5-flash",+ api_base=None,+ litellm_params={+ "vertex_project": "params-project",+ "vertex_location": "eu-west1",+ },+ )+ assert "params-project" in url+ assert "eu-west1" in url+ assert "env-project" not in url+ assert "us-central1" not in urlclass TestVertexAIImagenImageEditTransformation: