{"record":{"id":"2a5905f1788e0a73","repo":"BerriAI/litellm","slug":"input-is-required","errorCode":null,"errorMessage":"input is required","messagePattern":"input is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/endpoints/speech/speech_to_completion_bridge/handler.py","lineNumber":45,"sourceCode":"        from .transformation import SpeechToCompletionBridgeTransformationHandler\n\n        super().__init__()\n        self.transformation_handler = SpeechToCompletionBridgeTransformationHandler()\n\n    def validate_input_kwargs(self, kwargs: dict) -> SpeechToCompletionBridgeHandlerInputKwargs:\n        from litellm import LiteLLMLoggingObj\n\n        model: Final = kwargs.get(\"model\")\n        if model is None or not isinstance(model, str):\n            raise ValueError(\"model is required\")\n\n        custom_llm_provider: Final = kwargs.get(\"custom_llm_provider\")\n        if custom_llm_provider is None or not isinstance(custom_llm_provider, str):\n            raise ValueError(\"custom_llm_provider is required\")\n\n        input: Final = kwargs.get(\"input\")\n        if input is None or not isinstance(input, str):\n            raise ValueError(\"input is required\")\n\n        optional_params: Final = kwargs.get(\"optional_params\")\n        if optional_params is None or not isinstance(optional_params, dict):\n            raise ValueError(\"optional_params is required\")\n\n        litellm_params: Final = kwargs.get(\"litellm_params\")\n        if litellm_params is None or not isinstance(litellm_params, dict):\n            raise ValueError(\"litellm_params is required\")\n\n        headers = kwargs.get(\"headers\")\n        if headers is None or not isinstance(headers, dict):\n            raise ValueError(\"headers is required\")\n\n        headers = kwargs.get(\"headers\")\n        if headers is None or not isinstance(headers, dict):\n            raise ValueError(\"headers is required\")\n\n        logging_obj: Final = kwargs.get(\"logging_obj\")","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/endpoints/speech/speech_to_completion_bridge/handler.py#L27-L63","documentation":"Thrown by SpeechToCompletionBridgeHandler.validate_input_kwargs when 'input' is missing from kwargs or is not a str (handler.py:45). 'input' is the text to synthesize; the bridge validates it must be a plain string before transforming the request into a chat/completions payload.","triggerScenarios":"Calling the TTS bridge with input=None, input omitted, or input as a non-string (list of messages, bytes, dict). Direct handler invocation without the input argument.","commonSituations":"Passing a chat-style messages list to a speech endpoint; dynamically built requests where the text field key is named 'text' or 'prompt' instead of 'input'; empty request bodies on the proxy.","solutions":["Pass the text to synthesize as the input= string argument","If your text arrives as bytes or a list, convert/join it to a str before calling","Check the proxy /v1/audio/speech request body uses the 'input' field with a string value"],"exampleFix":"# before\nresp = litellm.audio_speech(model=\"gpt-4o-audio-preview\", voice=\"alloy\", input=None)\n\n# after\nresp = litellm.audio_speech(model=\"gpt-4o-audio-preview\", voice=\"alloy\", input=\"Hello world\")","handlingStrategy":"validation","validationCode":"if not isinstance(text, str) or not text:\n    raise ValueError(\"input text is required for speech synthesis\")\nresp = litellm.audio_speech(model=model, input=text, voice=voice)","typeGuard":"def is_speech_input_valid(text: object) -> bool:\n    return isinstance(text, str) and len(text) > 0","tryCatchPattern":"try:\n    resp = litellm.audio_speech(model=model, input=text, voice=voice)\nexcept ValueError as e:\n    if \"input is required\" in str(e):\n        return bad_request_response(\"'input' must be a non-empty string\")","preventionTips":["Name the text field 'input' and pass a str, not messages/bytes","Coerce bytes or lists to str before calling","Validate payloads at your own API boundary before proxying to /v1/audio/speech"],"tags":["validation","tts","input","speech"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}