BerriAI/litellm · error · ValueError

vertex_project is required for Vertex AI video generation. S

Error message

vertex_project is required for Vertex AI video generation. Set it via environment variable VERTEXAI_PROJECT or pass as parameter.

What it means

Raised while building the :predictLongRunning URL for Veo video generation when no Google Cloud project can be resolved. The URL template is `https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/.../models/MODEL:predictLongRunning`, so the project is structurally required; unlike location (which defaults to us-central1) there is no default. Resolution order is litellm_params vertex_project/vertex_ai_project, then litellm.vertex_project, then the VERTEXAI_PROJECT env var — all empty triggers the error.

Source

Thrown at litellm/llms/vertex_ai/videos/transformation.py:267

        return headers

    def get_complete_url(
        self,
        model: str,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        """
        Get the complete URL for Veo video generation.

        Returns URL for :predictLongRunning endpoint:
        https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT/locations/LOCATION/publishers/google/models/MODEL:predictLongRunning
        """
        vertex_project: Final = VertexBase.safe_get_vertex_ai_project(litellm_params)
        vertex_location = VertexBase.safe_get_vertex_ai_location(litellm_params)

        if not vertex_project:
            raise ValueError(
                "vertex_project is required for Vertex AI video generation. "
                "Set it via environment variable VERTEXAI_PROJECT or pass as parameter."
            )

        # Default to us-central1 if no location specified
        vertex_location = vertex_location or "us-central1"

        # Extract model name (remove vertex_ai/ prefix if present)
        model_name: Final = model.replace("vertex_ai/", "")

        # Construct the URL
        if api_base:
            base_url = api_base.rstrip("/")
        else:
            base_url = get_vertex_base_url(vertex_location)

        url: Final = (
            f"{base_url}/v1/projects/{vertex_project}/locations/{vertex_location}/publishers/google/models/{model_name}"

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass the project in the call: litellm.video_generation(model="vertex_ai/veo-2.0-generate-001", prompt=p, vertex_project="my-project").
  2. Or export VERTEXAI_PROJECT=my-project (optionally VERTEXAI_LOCATION too) before starting the process.
  3. Or set litellm.vertex_project = "my-project" at startup.
  4. Check for typos: the env var is VERTEXAI_PROJECT, not GOOGLE_PROJECT or GCP_PROJECT.

Example fix

# before
video = litellm.video_generation(
    model="vertex_ai/veo-2.0-generate-001",
    prompt="A cat surfing",
)

# after
video = litellm.video_generation(
    model="vertex_ai/veo-2.0-generate-001",
    prompt="A cat surfing",
    vertex_project="my-gcp-project",
    vertex_location="us-central1",
)
Defensive patterns

Strategy: validation

Validate before calling

import os

def veo_project() -> str:
    p = os.getenv("VERTEXAI_PROJECT")
    if not p:
        raise RuntimeError("VERTEXAI_PROJECT must be set for Vertex video generation")
    return p

Try / catch

try:
    v = litellm.video_generation(model="vertex_ai/veo-2.0-generate-001", prompt=p, vertex_project=P)
except ValueError as e:
    if "vertex_project is required" in str(e):
        raise ConfigError("Set VERTEXAI_PROJECT or pass vertex_project for Veo calls") from e
    raise

Prevention

When it happens

Trigger: Calling litellm.video_generation(model="vertex_ai/veo-2.0-generate-001", prompt=...) (or aretrieve_video_content) without vertex_project in the call, without litellm.vertex_project, and without VERTEXAI_PROJECT exported; location alone being set is not enough.

Common situations: Developers coming from Gemini API (AI Studio key) video calls where no project concept exists; scripts run outside the shell where VERTEXAI_PROJECT was exported; notebooks where the env cell was skipped after restart.

Related errors


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