BerriAI/litellm · error · ValueError

Azure AI API base is required. Set AZURE_AI_API_BASE environ

Error message

Azure AI API base is required. Set AZURE_AI_API_BASE environment variable or pass api_base parameter.

What it means

Error "Azure AI API base is required. Set AZURE_AI_API_BASE environment variable or pass api_base parameter." thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/azure_ai/image_edit/transformation.py:72

    ) -> str:
        """
        Constructs a complete URL for Azure AI Foundry image edits API request.

        Azure AI Foundry FLUX models handle image editing through the /images/edits
        endpoint.

        Args:
        - model: Model name (deployment name for Azure AI Foundry)
        - api_base: Base URL for Azure AI endpoint
        - litellm_params: Additional parameters including api_version

        Returns:
        - Complete URL for the image edits endpoint
        """
        api_base = AzureFoundryModelInfo.get_api_base(api_base)

        if api_base is None:
            raise ValueError(
                "Azure AI API base is required. Set AZURE_AI_API_BASE environment variable or pass api_base parameter."
            )

        api_version = litellm_params.get("api_version") or litellm.api_version or get_secret_str("AZURE_AI_API_VERSION")
        if api_version is None:
            # API version is mandatory for Azure AI Foundry
            raise ValueError(
                "Azure API version is required. Set AZURE_AI_API_VERSION environment variable or pass api_version parameter."
            )

        # Add the path to the base URL using the model as deployment name
        # Azure AI Foundry FLUX models use /images/edits for editing
        if "/openai/deployments/" in api_base:
            new_url = _add_path_to_api_base(
                api_base=api_base,
                ending_path="/images/edits",
            )
        else:

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set AZURE_AI_API_BASE or pass api_base.

When it happens

Trigger: Thrown at litellm/llms/azure_ai/image_edit/transformation.py:72 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/ad4b8819493801e2. Report an issue: GitHub.