BerriAI/litellm · error · ValueError

Deepinfra API Base is required. api_base=None. Set in call o

Error message

Deepinfra API Base is required. api_base=None. Set in call or via `DEEPINFRA_API_BASE` env var.

What it means

Error "Deepinfra API Base is required. api_base=None. Set in call or via `DEEPINFRA_API_BASE` env var." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/deepinfra/rerank/transformation.py:51

        api_base: str | None,
        model: str,
        optional_params: dict | None = None,
    ) -> str:
        """
        Constructs the complete DeepInfra inference endpoint URL for rerank.

        Args:
            api_base (Optional[str]): The base URL for the DeepInfra API.
            model (str): The model identifier.

        Returns:
            str: The complete URL for the DeepInfra rerank inference endpoint.

        Raises:
            ValueError: If api_base is None.
        """
        if not api_base:
            raise ValueError(
                "Deepinfra API Base is required. api_base=None. Set in call or via `DEEPINFRA_API_BASE` env var."
            )

        # Remove 'openai' from the base if present
        api_base_clean = api_base.replace("openai", "") if "openai" in api_base else api_base

        # Remove any trailing slashes for consistency, then add one
        api_base_clean = api_base_clean.rstrip("/") + "/"

        # Compose the full endpoint
        return f"{api_base_clean}inference/{model}"

    def validate_environment(
        self,
        headers: dict,
        model: str,
        api_key: str | None = None,
        optional_params: dict | None = None,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set DEEPINFRA_API_BASE or pass api_base.

When it happens

Trigger: Thrown at litellm/llms/deepinfra/rerank/transformation.py:51 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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