BerriAI/litellm · error · ValueError

No audioContent in Vertex AI TTS response

Error message

No audioContent in Vertex AI TTS response

What it means

Raised in transform_response when the Vertex AI TTS JSON payload lacks audioContent — e.g. the API returned an error object or an unexpected schema. There is no audio to decode into HttpxBinaryResponseContent, so response transformation fails.

Source

Thrown at litellm/llms/vertex_ai/text_to_speech/transformation.py:458

        model: str,
        raw_response: httpx.Response,
        logging_obj: "LiteLLMLoggingObj",
    ) -> "HttpxBinaryResponseContent":
        """
        Transform Vertex AI TTS response to standard format

        Vertex AI returns JSON with base64-encoded audio content.
        We decode it and return as HttpxBinaryResponseContent.
        """
        from litellm.types.llms.openai import HttpxBinaryResponseContent

        # Parse JSON response
        _json_response: Final = raw_response.json()

        # Get base64-encoded audio content
        response_content: Final = _json_response.get("audioContent")
        if not response_content:
            raise ValueError("No audioContent in Vertex AI TTS response")

        # Decode base64 to get binary content
        binary_data: Final = base64.b64decode(response_content)

        # Create an httpx.Response object with the binary data
        response: Final = httpx.Response(
            status_code=200,
            content=binary_data,
        )

        # Initialize the HttpxBinaryResponseContent instance
        return HttpxBinaryResponseContent(response)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the raw response for an upstream error; a missing audioContent usually means the synthesis failed server-side.
  2. Retry, and verify the request parameters (voice, language, audio encoding) are valid for the chosen model.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/llms/vertex_ai/text_to_speech/transformation.py:458 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/97dcc336801de02e. Report an issue: GitHub.