BerriAI/litellm · error · ValueError

api_base is None. Please set AZURE_AI_API_BASE or…

Error message

api_base is None. Please set AZURE_AI_API_BASE or dynamically via `api_base` param, to make the request.

What it means

Error "api_base is None. Please set AZURE_AI_API_BASE or dynamically via `api_base` param, to make the request." thrown in BerriAI/litellm.

Solutions

  1. Set AZURE_AI_API_BASE or pass api_base.

When it happens

Trigger: Thrown at litellm/llms/azure_ai/embed/handler.py:102 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/aaae8cd22eb0dedf. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/azure_ai/embed/handler.py:102

            stream=False,
            _response_headers=embedding_headers,
        )
        return returned_response

    def image_embedding(
        self,
        model: str,
        data: ImageEmbeddingRequest,
        timeout: float,
        logging_obj,
        model_response: EmbeddingResponse,
        optional_params: dict,
        api_key: str | None,
        api_base: str | None,
        client: HTTPHandler | AsyncHTTPHandler | None = None,
    ):
        if api_base is None:
            raise ValueError(
                "api_base is None. Please set AZURE_AI_API_BASE or dynamically via `api_base` param, to make the request."
            )
        if api_key is None:
            raise ValueError(
                "api_key is None. Please set AZURE_AI_API_KEY or dynamically via `api_key` param, to make the request."
            )

        if client is None or not isinstance(client, HTTPHandler):
            client = HTTPHandler(timeout=timeout, concurrent_limit=1)

        url: Final = f"{api_base}/images/embeddings"

        response: Final = client.post(
            url=url,
            json=data,
            headers={"Authorization": f"Bearer {api_key}"},
        )

View on GitHub (pinned to 77b7c6c40c)