BerriAI/litellm · error · ValueError
input is required
Error message
input is required
What it means
validate_input_kwargs in the speech-to-completion bridge raises ValueError("input is required") when kwargs["input"] is missing, None, or not a str. "input" is the text to be spoken; it becomes the user message content of the bridged chat-completion request (transformation.py:39). Because it must be a str, passing bytes or a list of content parts fails the isinstance check.
Solutions
- Pass the text to synthesize as a plain str: handler.speech(..., input="text to speak", ...).
- Decode before forwarding: input=my_bytes.decode("utf-8") if your pipeline carries bytes.
- Validate input early in your own wrapper (non-empty str) to fail with a clearer message.
Example fix
# before handler.speech(model="gpt-4o-audio-preview", input=b"hello world", ...) # ValueError: input is required # after handler.speech(model="gpt-4o-audio-preview", input="hello world", ...)
Defensive patterns
Strategy: validation
Validate before calling
def check_speech_input(kwargs: dict) -> None:
value = kwargs.get("input")
if not isinstance(value, str) or not value:
raise ValueError("speech bridge requires non-empty str 'input' (decode bytes first)") Type guard
def is_valid_input_kwarg(value: object) -> bool:
return isinstance(value, str) and len(value) > 0 Prevention
- Decode bytes/bytearray to utf-8 str before forwarding input.
- Reject empty prompts in your wrapper with a clearer message than the bridge's.
- Keep SSML/objects out of input — the bridge treats it as plain message content.
When it happens
Trigger: Calling the handler (or a custom speech pipeline built on it) with input omitted, None, or as bytes/bytearray (e.g. passing pre-encoded audio or file content) instead of the text string to synthesize.
Common situations: Wrappers that accept file paths or SSML objects and forward them unmodified; empty-payload requests from clients hitting a custom endpoint; tests omitting the field.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- custom_llm_provider is required
- headers is required
- litellm_params is required
- logging_obj is required
- model is required
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2a5905f1788e0a73.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/endpoints/speech/speech_to_completion_bridge/handler.py:45
from .transformation import SpeechToCompletionBridgeTransformationHandler
super().__init__()
self.transformation_handler = SpeechToCompletionBridgeTransformationHandler()
def validate_input_kwargs(self, kwargs: dict) -> SpeechToCompletionBridgeHandlerInputKwargs:
from litellm import LiteLLMLoggingObj
model: Final = kwargs.get("model")
if model is None or not isinstance(model, str):
raise ValueError("model is required")
custom_llm_provider: Final = kwargs.get("custom_llm_provider")
if custom_llm_provider is None or not isinstance(custom_llm_provider, str):
raise ValueError("custom_llm_provider is required")
input: Final = kwargs.get("input")
if input is None or not isinstance(input, str):
raise ValueError("input is required")
optional_params: Final = kwargs.get("optional_params")
if optional_params is None or not isinstance(optional_params, dict):
raise ValueError("optional_params is required")
litellm_params: Final = kwargs.get("litellm_params")
if litellm_params is None or not isinstance(litellm_params, dict):
raise ValueError("litellm_params is required")
headers = kwargs.get("headers")
if headers is None or not isinstance(headers, dict):
raise ValueError("headers is required")
headers = kwargs.get("headers")
if headers is None or not isinstance(headers, dict):
raise ValueError("headers is required")
logging_obj: Final = kwargs.get("logging_obj")View on GitHub (pinned to 77b7c6c40c)