BerriAI/litellm · error · VertexAIError

api_base is required for Vertex AI Gemma models. Please prov

Error message

api_base is required for Vertex AI Gemma models. Please provide the full endpoint URL.

What it means

Raised while constructing the Gemma API base: neither an explicit api_base param nor the expected environment variable yielded an endpoint URL. Gemma has no default regional endpoint, so the full URL must be user-supplied.

Source

Thrown at litellm/llms/vertex_ai/vertex_gemma_models/main.py:98

        try:
            model = get_vertex_base_model_name(model=model)

            access_token, project_id = self._ensure_access_token(
                credentials=vertex_credentials,
                project_id=vertex_project,
                custom_llm_provider="vertex_ai",
            )

            gemma_transformation: Final = VertexGemmaConfig()

            ## CONSTRUCT API BASE
            stream: Final[bool] = optional_params.get("stream", False) or False
            optional_params["stream"] = stream

            # If api_base is not provided, it should be set as an environment variable
            # or passed explicitly because the endpoint URL is unique per deployment
            if api_base is None:
                raise VertexAIError(
                    status_code=400,
                    message="api_base is required for Vertex AI Gemma models. Please provide the full endpoint URL.",
                )

            # Check if we need to append :predict
            if not api_base.endswith(":predict"):
                _, api_base = self._check_custom_proxy(
                    api_base=api_base,
                    custom_llm_provider="vertex_ai",
                    gemini_api_key=None,
                    endpoint="predict",
                    stream=stream,
                    auth_header=None,
                    url=api_base,
                )
            # If api_base already ends with :predict, use it as-is

            # Use the custom transformation handler for gemma models

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass api_base with the full endpoint URL of your deployed Gemma model on Vertex AI.
  2. Confirm the endpoint URL from the Vertex AI console (Model Garden deployment) and set it via the api_base parameter.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/vertex_gemma_models/main.py:98 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/51c39034f7c38dbc. Report an issue: GitHub.