{"record":{"id":"eb44cd92c9142130","repo":"BerriAI/litellm","slug":"litellm-params-is-required-eb44cd","errorCode":null,"errorMessage":"litellm_params is required","messagePattern":"litellm_params is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/endpoints/speech/speech_to_completion_bridge/handler.py","lineNumber":53,"sourceCode":"        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\")\n        if logging_obj is None or not isinstance(logging_obj, LiteLLMLoggingObj):\n            raise ValueError(\"logging_obj is required\")\n\n        return SpeechToCompletionBridgeHandlerInputKwargs(\n            model=model,\n            input=input,\n            voice=kwargs.get(\"voice\"),\n            optional_params=optional_params,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/endpoints/speech/speech_to_completion_bridge/handler.py#L35-L71","documentation":"Thrown by SpeechToCompletionBridgeHandler.validate_input_kwargs when 'litellm_params' is missing from kwargs or is not a dict (handler.py:53). litellm_params carries per-request metadata (api_base, api_key, metadata, etc.) injected by the router; the bridge requires it before building the completion request.","triggerScenarios":"Direct invocation of speech_to_completion_bridge_handler.speech() without litellm_params; litellm_params set to None by custom routing or mocking code.","commonSituations":"Bypassing litellm's standard entrypoints; test harnesses that construct kwargs manually; monkeypatched get_litellm_params returning None.","solutions":["Route calls through litellm.audio_speech()/litellm.speech() so the router injects litellm_params","If calling the handler directly, pass litellm_params=get_litellm_params() or at minimum {}","Ensure custom router patches return a dict for litellm_params"],"exampleFix":"# before\nhandler.speech(model=m, input=i, voice=v, optional_params={}, litellm_params=None, headers={}, logging_obj=log, custom_llm_provider=\"openai\")\n\n# after\nfrom litellm import get_litellm_params\nhandler.speech(model=m, input=i, voice=v, optional_params={}, litellm_params=get_litellm_params(), headers={}, logging_obj=log, custom_llm_provider=\"openai\")","handlingStrategy":"validation","validationCode":"from litellm import get_litellm_params\nlitellm_params = litellm_params if isinstance(litellm_params, dict) else get_litellm_params()","typeGuard":"def has_litellm_params(kwargs: dict) -> bool:\n    return isinstance(kwargs.get(\"litellm_params\"), dict)","tryCatchPattern":"try:\n    handler.speech(..., litellm_params=litellm_params, ...)\nexcept ValueError as e:\n    if \"litellm_params is required\" in str(e):\n        logger.error(\"Call bypassed litellm routing; use litellm.audio_speech\")\n        raise","preventionTips":["Use litellm's public entrypoints so the router injects litellm_params","When calling handlers directly, build params via get_litellm_params()","In tests, assert mocked routing returns dict litellm_params"],"tags":["validation","tts","litellm-params","routing"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}