BerriAI/litellm · error · ValueError
input parameter is required
Error message
input parameter is required
What it means
ValueError from validate_request in the count_tokens transformation: the request body omitted the 'input' field (empty/falsy), so there is no content to tokenize. It fails fast before any HTTP call is made.
Source
Thrown at litellm/llms/openai/responses/count_tokens/transformation.py:60
request["instructions"] = instructions
if tools is not None:
request["tools"] = self._transform_tools_for_responses_api(tools)
return request
def get_required_headers(self, api_key: str) -> dict[str, str]:
return {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}",
}
def validate_request(self, model: str, input: str | list[Any]) -> None:
if not model:
raise ValueError("model parameter is required")
if not input:
raise ValueError("input parameter is required")
@staticmethod
def _transform_tools_for_responses_api(
tools: list[dict[str, Any]],
) -> list[dict[str, Any]]:
"""
Transform OpenAI chat tools format to Responses API tools format.
Chat format: {"type": "function", "function": {"name": "...", "parameters": {...}}}
Responses format: {"type": "function", "name": "...", "parameters": {...}}
"""
transformed: Final = []
for tool in tools:
if tool.get("type") == "function" and "function" in tool:
func = tool["function"]
item: dict[str, Any] = {
"type": "function",
"name": func.get("name", ""),View on GitHub (pinned to 77b7c6c40c)
Solutions
- Pass the input parameter to the count_tokens call.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/openai/responses/count_tokens/transformation.py:60 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/3cac9757c423e35e.
Report an issue: GitHub.