BerriAI/litellm · error · ValueError

api_base is required

Error message

api_base is required

What it means

BaseVideosConfig.get_complete_url() is optional (some providers need the model embedded in the URL); the default returns api_base unchanged but raises ValueError('api_base is required') when api_base is None, failing fast instead of letting 'None' leak into the video-generation HTTP request.

Source

Thrown at litellm/llms/base_llm/videos/transformation.py:91

    ) -> dict:
        return {}

    @abstractmethod
    def get_complete_url(
        self,
        model: str,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        """
        OPTIONAL

        Get the complete url for the request

        Some providers need `model` in `api_base`
        """
        if api_base is None:
            raise ValueError("api_base is required")
        return api_base

    @abstractmethod
    def transform_video_create_request(
        self,
        model: str,
        prompt: str,
        api_base: str,
        video_create_optional_request_params: dict,
        litellm_params: GenericLiteLLMParams,
        headers: dict,
    ) -> tuple[dict, RequestFiles, str]:
        pass

    @abstractmethod
    def transform_video_create_response(
        self,
        model: str,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass api_base in the video call's litellm_params (api_base='http://video.internal:8000').
  2. Set the provider's base env var or add api_base to the video provider's entry in litellm config.
  3. In a custom videos config, override get_complete_url to inject the provider default endpoint.

Example fix

# before
resp = await litellm.avideo_generate(model="myvid/model-a", prompt="sunset")  # ValueError

# after
resp = await litellm.avideo_generate(
    model="myvid/model-a", prompt="sunset",
    api_base="http://video.internal:8000/v1",
)
Defensive patterns

Strategy: validation

Validate before calling

video_base = kwargs.get("api_base") or os.getenv("MYVID_API_BASE")
if video_base is None:
    raise ValueError("video generation requires api_base for this provider")

Try / catch

try:
    job = await litellm.avideo_generate(model=m, prompt=p, api_base=base)
except ValueError as e:
    if "api_base is required" in str(e):
        base = os.environ["MYVID_API_BASE"]
        job = await litellm.avideo_generate(model=m, prompt=p, api_base=base)
    else:
        raise

Prevention

When it happens

Trigger: Calling litellm's video generation API (avideo_generate / video create) when no api_base resolves — custom or self-hosted video provider without a configured base URL or env var.

Common situations: Using self-hosted video models behind a gateway without setting api_base; provider env var missing in the deployed environment; config entry for a video model missing the api_base field.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/522371c603a5150d. Report an issue: GitHub.