BerriAI/litellm · error · ValueError
litellm_params is required
Error message
litellm_params is required
What it means
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.
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.
Example fix
# before
handler.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
# after
handler.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") Defensive patterns
Strategy: validation
Validate before calling
def check_litellm_params(kwargs: dict) -> None:
if not isinstance(kwargs.get("litellm_params"), dict):
raise ValueError("speech bridge requires dict 'litellm_params' (use {} if none)") Type guard
def is_valid_litellm_params(value: object) -> bool:
return isinstance(value, dict) Prevention
- 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.
When it happens
Trigger: 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).
Common situations: Code lifted from proxy internals into a standalone script; tests with minimal kwargs dicts; None defaults from de-serialized request objects.
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
- input is required
- logging_obj is required
- model is required
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/eb44cd92c9142130.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/endpoints/speech/speech_to_completion_bridge/handler.py:53
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")
if logging_obj is None or not isinstance(logging_obj, LiteLLMLoggingObj):
raise ValueError("logging_obj is required")
return SpeechToCompletionBridgeHandlerInputKwargs(
model=model,
input=input,
voice=kwargs.get("voice"),
optional_params=optional_params,View on GitHub (pinned to 77b7c6c40c)