BerriAI/litellm · error · ValueError

api_base is required

Error message

api_base is required

What it means

The abstract containers transformation's default get_complete_url requires an api_base: container operations (create/manage provider containers) must hit a concrete endpoint, and unlike chat there is no default host. None is rejected with a plain ValueError.

Source

Thrown at litellm/llms/base_llm/containers/transformation.py:97

        self,
        headers: dict,
        api_key: str | None = None,
    ) -> dict:
        return {}

    @abstractmethod
    def get_complete_url(
        self,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        """Get the complete url for the request.

        OPTIONAL - Some providers need `model` in `api_base`.
        """
        if api_base is None:
            msg: Final = "api_base is required"
            raise ValueError(msg)
        return api_base

    @abstractmethod
    def transform_container_create_request(
        self,
        name: str,
        container_create_optional_request_params: dict,
        litellm_params: GenericLiteLLMParams,
        headers: dict,
    ) -> dict:
        """Transform the container creation request.

        Returns:
            dict: Request data for container creation.
        """
        ...

    @abstractmethod

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass api_base for the container operation in litellm_params
  2. If writing a custom provider container config, override get_complete_url to construct the full URL from your provider's env vars
  3. Check the provider's container docs for the expected endpoint shape and set it explicitly

Example fix

# before
litellm_params={'api_key': k}
container_client.create_container(name='docs', litellm_params=litellm_params)

# after
litellm_params={'api_key': k, 'api_base': 'https://my-resource.example.com/api'}
container_client.create_container(name='docs', litellm_params=litellm_params)
Defensive patterns

Strategy: validation

Validate before calling

if not litellm_params.get('api_base'):
    raise ValueError('Container operations require api_base in litellm_params')

Prevention

When it happens

Trigger: Invoking the containers API (e.g. litellm container create/delete via a provider whose config does not override this method) without api_base in litellm_params or the call.

Common situations: New/experimental container integrations where the config class relies on the default; proxy vector-store/container config missing the endpoint; assuming the endpoint is derived from api_key or provider name.

Related errors


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