diff --git a/litellm/llms/vertex_ai/vertex_model_garden/main.py b/litellm/llms/vertex_ai/vertex_model_garden/main.py index 7240d9dce57..c6427ecee0b 100644 --- a/litellm/llms/vertex_ai/vertex_model_garden/main.py +++ b/litellm/llms/vertex_ai/vertex_model_garden/main.py @@ -120,31 +120,18 @@ class VertexAIModelGardenModels(VertexBase): ## CONSTRUCT API BASE stream: bool = optional_params.get("stream", False) or False optional_params["stream"] = stream - default_api_base = create_vertex_url( - vertex_location=vertex_location or "us-central1", - vertex_project=vertex_project or project_id, - stream=stream, - model=model, - ) - if len(default_api_base.split(":")) > 1: - endpoint = default_api_base.split(":")[-1] + if api_base is not None: + # User provided a custom api_base (e.g. Model Garden mg-endpoint URL). + # Use it directly — OpenAILikeChatHandler appends /chat/completions. + pass else: - endpoint = "" - - _, api_base = self._check_custom_proxy( - api_base=api_base, - custom_llm_provider="vertex_ai", - gemini_api_key=None, - endpoint=endpoint, - stream=stream, - auth_header=None, - url=default_api_base, - model=model, - vertex_project=vertex_project or project_id, - vertex_location=vertex_location or "us-central1", - vertex_api_version="v1beta1", - ) + api_base = create_vertex_url( + vertex_location=vertex_location or "us-central1", + vertex_project=vertex_project or project_id, + stream=stream, + model=model, + ) # Publisher/catalog models: model id must be sent in the JSON body (OpenAPI route). # Single-segment endpoint ids: model is encoded in the URL path; body model stays empty. if not _vertex_model_garden_model_id_in_json_body(model):