BerriAI/litellm · error · ValueError
Bad Request: model is required for Anthropic Messages…
Error message
Bad Request: model is required for Anthropic Messages Request
What it means
Error "Bad Request: model is required for Anthropic Messages Request" thrown in BerriAI/litellm.
Solutions
- Include 'model' in the Anthropic Messages request body.
When it happens
Trigger: Thrown at litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py:170 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/d2c1ef0b5f46b54a.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py:170
) -> tuple[ChatCompletionRequest | None, dict[str, str]]:
"""
Translate Anthropic request params to OpenAI format, returning tool name mapping.
This method handles truncation of tool names that exceed OpenAI's 64-character
limit. The mapping allows restoring original names when translating responses.
Returns:
Tuple of (openai_request, tool_name_mapping)
- tool_name_mapping maps truncated tool names back to original names
"""
#########################################################
# Validate required params
#########################################################
model: Final = kwargs.pop("model")
messages: Final = kwargs.pop("messages")
if not model:
raise ValueError("Bad Request: model is required for Anthropic Messages Request")
if not messages:
raise ValueError("Bad Request: messages is required for Anthropic Messages Request")
#########################################################
# Created Typed Request Body
#########################################################
request_body: Final = AnthropicMessagesRequest(model=model, messages=messages, **kwargs)
(
translated_body,
tool_name_mapping,
) = LiteLLMAnthropicMessagesAdapter().translate_anthropic_to_openai(anthropic_message_request=request_body)
return translated_body, tool_name_mapping
def translate_completion_output_params(
self,
response: ModelResponse,View on GitHub (pinned to 77b7c6c40c)