{"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/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/endpoints/speech/speech_to_completion_bridge/handler.py#L35-L71","documentation":"validate_input_kwargs in the speech-to-completion bridge raises ValueError(\"litellm_params is required\") when kwargs[\"litellm_params\"] is missing, None, or not a dict. litellm_params carries router/proxy-level settings (api_base, api_key, metadata, ...) and is spread verbatim into the bridged litellm.completion call (transformation.py:44), so the bridge refuses to run without it.","triggerScenarios":"Direct handler invocations that omit litellm_params or pass None; constructing kwargs manually from a request that never carried litellm params (bare SDK usage outside the proxy).","commonSituations":"Code lifted from proxy internals into a standalone script; tests with minimal kwargs dicts; None defaults from de-serialized request objects.","solutions":["Pass a dict ({} is acceptable): handler.speech(..., litellm_params={}, ...).","Include credentials there when needed: litellm_params={\"api_key\": ..., \"api_base\": ...}.","Use litellm.speech() so litellm builds litellm_params itself."],"exampleFix":"# before\nhandler.speech(model=\"gpt-4o-audio-preview\", input=\"hi\", voice=\"alloy\", optional_params={}, headers={}, logging_obj=log, custom_llm_provider=\"openai\")  # ValueError: litellm_params is required\n\n# after\nhandler.speech(model=\"gpt-4o-audio-preview\", input=\"hi\", voice=\"alloy\", optional_params={}, litellm_params={\"api_key\": os.environ[\"OPENAI_API_KEY\"]}, headers={}, logging_obj=log, custom_llm_provider=\"openai\")","handlingStrategy":"validation","validationCode":"def check_litellm_params(kwargs: dict) -> None:\n    if not isinstance(kwargs.get(\"litellm_params\"), dict):\n        raise ValueError(\"speech bridge requires dict 'litellm_params' (use {} if none)\")","typeGuard":"def is_valid_litellm_params(value: object) -> bool:\n    return isinstance(value, dict)","tryCatchPattern":null,"preventionTips":["Default litellm_params to {} in custom wrappers.","Put api_key/api_base into litellm_params when calling the handler directly.","Use litellm.speech() to avoid assembling litellm_params by hand."],"tags":["speech","tts","validation","kwargs","internal-api"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}