BerriAI/litellm · error · ValueError

api_base is required for Azure AVA TTS. Format: https://

Error message

api_base is required for Azure AVA TTS. Format: https://{region}.api.cognitive.microsoft.com or https://{region}.tts.speech.microsoft.com

What it means

Error "api_base is required for Azure AVA TTS. Format: https://{region}.api.cognitive.microsoft.com or https://{region}.tts.speech.microsoft.com" thrown in BerriAI/litellm.

Solutions

  1. Set api_base to your region's TTS endpoint, e.g. https://{region}.tts.speech.microsoft.com.

When it happens

Trigger: Thrown at litellm/llms/azure/text_to_speech/transformation.py:325 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/711dd91846edf6b9. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/azure/text_to_speech/transformation.py:325

        # User-Agent
        validated_headers["User-Agent"] = "litellm"

        return validated_headers

    def get_complete_url(
        self,
        model: str,
        api_base: str | None,
        litellm_params: dict,
    ) -> str:
        """
        Get the complete URL for Azure AVA TTS request

        Azure TTS endpoint format:
        https://{region}.tts.speech.microsoft.com/cognitiveservices/v1
        """
        if api_base is None:
            raise ValueError(
                f"api_base is required for Azure AVA TTS. "
                f"Format: https://{{region}}.{self.COGNITIVE_SERVICES_DOMAIN} or "
                f"https://{{region}}.{self.TTS_SPEECH_DOMAIN}"
            )

        # Remove trailing slash and parse URL
        api_base = api_base.rstrip("/")
        parsed_url: Final = urlparse(api_base)
        hostname: Final = parsed_url.hostname or ""

        # Check if it's a Cognitive Services endpoint (convert to TTS endpoint)
        if self._is_cognitive_services_endpoint(hostname=hostname):
            region: Final = self._extract_region_from_hostname(hostname=hostname, domain=self.COGNITIVE_SERVICES_DOMAIN)
            return self._build_tts_url(region=region)

        # Check if it's already a TTS endpoint
        if self._is_tts_endpoint(hostname=hostname):
            if not api_base.endswith(self.TTS_ENDPOINT_PATH):

View on GitHub (pinned to 77b7c6c40c)