BerriAI/litellm · error

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

Error message

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

What it means

Raised by get_complete_url when constructing the DeepInfra rerank endpoint with api_base=None; neither the call params nor the DEEPINFRA_API_BASE env var supplied the base URL, so no endpoint URL can be built.

Solutions

  1. Set the DEEPINFRA_API_BASE environment variable, or pass api_base explicitly in the call.
Defensive patterns

Strategy: validation

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@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/3468a101d7dfd6c2. Report an issue: GitHub.

Appendix: 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 77b7c6c40c)