BerriAI/litellm · error · ValueError

api_base is required for openai_like provider

Error message

api_base is required for openai_like provider

What it means

Configuration guard in the OpenAI-like responses-API transformation: neither the api_base argument nor the OPENAI_LIKE_API_BASE secret is set, so there is no host to append the responses endpoint path to and the request is rejected upfront.

Source

Thrown at litellm/llms/openai_like/responses/transformation.py:49

        self,
        headers: dict,
        model: str,
        litellm_params: GenericLiteLLMParams | None,
    ) -> dict:
        litellm_params = litellm_params or GenericLiteLLMParams()
        api_key: Final = litellm_params.api_key or get_secret_str("OPENAI_LIKE_API_KEY")
        if api_key:
            headers["Authorization"] = f"Bearer {api_key}"
        return headers

    def get_complete_url(
        self,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        api_base = api_base or get_secret_str("OPENAI_LIKE_API_BASE")
        if not api_base:
            raise ValueError("api_base is required for openai_like provider")
        api_base = api_base.rstrip("/")
        return f"{api_base}/responses"

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass api_base for the openai_like provider, via parameter or environment variable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/openai_like/responses/transformation.py:49 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/c22512b55baea617. Report an issue: GitHub.