BerriAI/litellm · error · ValueError

Vertex project and location are required for custom endpoint

Error message

Vertex project and location are required for custom endpoint

What it means

Raised in the 'custom' (Model Garden) branch when vertex_project or vertex_location is None: endpoint discovery for a custom endpoint requires both to construct the aiplatform client, so the call cannot proceed with defaults.

Source

Thrown at litellm/llms/vertex_ai/vertex_ai_non_gemini.py:324

            request_str += f"llm_model.predict({prompt}, **{optional_params}).text\n"
            ## LOGGING
            logging_obj.pre_call(
                input=prompt,
                api_key=None,
                additional_args={
                    "complete_input_dict": optional_params,
                    "request_str": request_str,
                },
            )
            completion_response = llm_model.predict(prompt, **optional_params).text
        elif mode == "custom":
            """
            Vertex AI Model Garden
            """

            if vertex_project is None or vertex_location is None:
                raise ValueError("Vertex project and location are required for custom endpoint")

            ## LOGGING
            logging_obj.pre_call(
                input=prompt,
                api_key=None,
                additional_args={
                    "complete_input_dict": optional_params,
                    "request_str": request_str,
                },
            )
            llm_model = aiplatform.gapic.PredictionServiceClient(
                client_options=client_options,
                credentials=creds,
            )
            request_str += f"llm_model = aiplatform.gapic.PredictionServiceClient(client_options={client_options}, credentials=...)\n"
            endpoint_path = llm_model.endpoint_path(project=vertex_project, location=vertex_location, endpoint=model)
            request_str += f"llm_model.predict(endpoint={endpoint_path}, instances={instances})\n"
            response = llm_model.predict(endpoint=endpoint_path, instances=instances).predictions

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set vertex_project and vertex_location (via params or VERTEXAI_PROJECT / VERTEXAI_LOCATION env vars) for the custom endpoint.
  2. Verify the credentials being used actually resolve a project and location.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/vertex_ai_non_gemini.py:324 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/ed428b838bc009ac. Report an issue: GitHub.