BerriAI/litellm · error · AzureSpeechAudioTranscriptionException

api_base is required for Azure AI Speech transcription. Use…

Error message

api_base is required for Azure AI Speech transcription. Use a Cognitive Services endpoint like https://{region}.api.cognitive.microsoft.com or an STT endpoint like https://{region}.stt.speech.microsoft.com.

What it means

Error "api_base is required for Azure AI Speech transcription. Use a Cognitive Services endpoint like https://{region}.api.cognitive.microsoft.com or an STT endpoint like https://{region}.stt.speech.microsoft.com." thrown in BerriAI/litellm.

Solutions

  1. Pass api_base pointing to your Cognitive Services/STT endpoint, e.g. https://{region}.stt.speech.microsoft.com.

When it happens

Trigger: Thrown at litellm/llms/azure/audio_transcription/transformation.py:94 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/6c946c805d8961af. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/azure/audio_transcription/transformation.py:94

        validated_headers: Final = headers.copy()
        validated_headers["Ocp-Apim-Subscription-Key"] = api_key
        validated_headers["Content-Type"] = validated_headers.get("Content-Type", "audio/wav")
        validated_headers["Accept"] = "application/json"
        return validated_headers

    def get_complete_url(
        self,
        api_base: str | None,
        api_key: str | None,
        model: str,
        optional_params: dict,
        litellm_params: dict,
        stream: bool | None = None,
    ) -> str:
        api_base = api_base or get_secret_str("AZURE_SPEECH_API_BASE")
        if api_base is None:
            raise AzureSpeechAudioTranscriptionException(
                message=(
                    "api_base is required for Azure AI Speech transcription. "
                    "Use a Cognitive Services endpoint like "
                    "https://{region}.api.cognitive.microsoft.com or an STT "
                    "endpoint like https://{region}.stt.speech.microsoft.com."
                ),
                status_code=400,
            )

        base_url: Final = self._resolve_stt_base_url(api_base=api_base)
        query_params: Final = {
            "language": optional_params.get("language", self.DEFAULT_LANGUAGE),
            "format": self._get_azure_response_format(optional_params.get("response_format")),
        }
        return f"{base_url}{self.STT_ENDPOINT_PATH}?{urlencode(query_params)}"

    def transform_audio_transcription_request(
        self,

View on GitHub (pinned to 77b7c6c40c)