BerriAI/litellm · error · ValueError
SSML input is required when use_ssml is True.
Error message
SSML input is required when use_ssml is True.
What it means
Raised by validate_vertex_input when the Vertex text-to-speech request has use_ssml=True but the input contains neither 'text' nor 'ssml'. The validator first strips None values and, when use_ssml is set, converts any 'text' entry into 'ssml'; this error fires only when both keys are absent after that cleanup, meaning the caller enabled SSML mode without supplying any content at all.
Source
Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:222
http_binary_response: Final = HttpxBinaryResponseContent(response)
return http_binary_response
def validate_vertex_input(input_data: VertexInput, kwargs: dict, optional_params: dict) -> None:
# Remove None values
if input_data.get("text") is None:
input_data.pop("text", None)
if input_data.get("ssml") is None:
input_data.pop("ssml", None)
# Check if use_ssml is set
use_ssml: Final = kwargs.get("use_ssml", optional_params.get("use_ssml", False))
if use_ssml:
if "text" in input_data:
input_data["ssml"] = input_data.pop("text")
elif "ssml" not in input_data:
raise ValueError("SSML input is required when use_ssml is True.")
else:
# LiteLLM will auto-detect if text is in ssml format
# check if "text" is an ssml - in this case we should pass it as ssml instead of text
if input_data:
_text: Final = input_data.get("text", None) or ""
if "<speak>" in _text:
input_data["ssml"] = input_data.pop("text")
if not input_data:
raise ValueError("Either 'text' or 'ssml' must be provided.")
if "text" in input_data and "ssml" in input_data:
raise ValueError("Only one of 'text' or 'ssml' should be provided, not both.")
View on GitHub (pinned to 77b7c6c40c)
Solutions
- When use_ssml=True, pass the SSML markup via the ssml/input parameter instead of plain text.
- Set use_ssml=False (or omit it) if you intend to synthesize plain text.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:222 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/911f7cb1b6dcf94d.
Report an issue: GitHub.