BerriAI/litellm · error · ValueError
litellm_params is required
Error message
litellm_params is required
What it means
validate_input_kwargs raises when 'litellm_params' is absent from kwargs or is not a dict. litellm_params carries router/proxy-level metadata (metadata, base_url, api_base, ...) that the bridge threads into the Responses API call. Only direct, hand-built invocations of the handler can omit it.
Source
Thrown at litellm/completion_extras/litellm_responses_transformation/handler.py:126
model: Final = typed_kwargs.get("model")
if model is None or not isinstance(model, str):
raise ValueError("model is required")
custom_llm_provider: Final = typed_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")
messages: Final = typed_kwargs.get("messages")
if messages is None or not isinstance(messages, list):
raise ValueError("messages is required")
optional_params: Final = typed_kwargs.get("optional_params")
if optional_params is None or not isinstance(optional_params, dict):
raise ValueError("optional_params is required")
litellm_params: Final = typed_kwargs.get("litellm_params")
if litellm_params is None or not isinstance(litellm_params, dict):
raise ValueError("litellm_params is required")
headers: Final = typed_kwargs.get("headers")
if headers is None or not isinstance(headers, dict):
raise ValueError("headers is required")
model_response: Final = typed_kwargs.get("model_response")
if model_response is None or not isinstance(model_response, ModelResponse):
raise ValueError("model_response is required")
logging_obj: Final = typed_kwargs.get("logging_obj")
if logging_obj is None or not isinstance(logging_obj, LiteLLMLoggingObj):
raise ValueError("logging_obj is required")
return ResponsesToCompletionBridgeHandlerInputKwargs(
model=model,
messages=messages,
optional_params=optional_params,
litellm_params=litellm_params,View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use litellm.completion()/acompletion() which always injects litellm_params
- If direct, include litellm_params as a dict (an empty dict is accepted)
- Verify no middleware strips the key before it reaches the handler
Example fix
# before
kwargs = {"model": m, "messages": msgs, "optional_params": {}}
# after
kwargs = {"model": m, "messages": msgs, "optional_params": {}, "litellm_params": {}} Defensive patterns
Strategy: validation
Validate before calling
def has_litellm_params(kwargs: dict) -> bool:
return isinstance(kwargs.get("litellm_params"), dict) Type guard
def is_dict_param(v) -> bool:
return isinstance(v, dict) Prevention
- Default litellm_params to {} in manual invocations
- Forward the pipeline-provided litellm_params untouched in wrappers
When it happens
Trigger: Calling the bridge handler with a kwargs dict missing the litellm_params key; passing it as a non-dict (e.g. a list of tuples).
Common situations: Custom pipelines or unit tests constructing kwargs manually; refactors that pass only the outer request params and forget the litellm-internal dict.
Related errors
- model is required
- custom_llm_provider is required
- messages is required
- optional_params is required
- headers is required
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/fb249611fb29058b.
Report an issue: GitHub.