When using Anthropic/Claude models via LiteLLM-based proxies (e.g., custom gateways), requests fail with:
UnsupportedParamsError: Anthropic doesn't support tool calling without tools= param specified
This happens when:
- Message history contains previous tool calls (
tool-call / tool-result)
- Current request has no tools (e.g., compaction, title generation)
Root Cause
LiteLLM validates that if message history contains tool calls, the tools parameter must be present. Anthropic's native API now handles this gracefully, but many users route through LiteLLM proxies which enforce stricter validation.
Proposed Solution
Add a dummy tool when:
- Model is Anthropic/Claude (checked via
providerID, api.id, or api.npm)
- Message history contains
tool-call or tool-result
- No tools are provided (
tools is empty)
The dummy tool is excluded from activeTools so LLM won't actually call it.
Reproduction
curl -X POST "https://your-litellm-gateway" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "model_name_for_claude",
"messages": [
{"role": "user", "content": "What is 2+2?"},
{"role": "assistant", "content": null, "tool_calls": [{"id": "call_123", "type": "function", "function": {"name": "calc", "arguments": "{}"}}]},
{"role": "tool", "tool_call_id": "call_123", "content": "4"},
{"role": "assistant", "content": "The answer is 4."},
{"role": "user", "content": "Thanks!"}
]
}'
# Returns 400: UnsupportedParamsError
Relates to
When using Anthropic/Claude models via LiteLLM-based proxies (e.g., custom gateways), requests fail with:
UnsupportedParamsError: Anthropic doesn't support tool calling without tools= param specified
This happens when:
tool-call/tool-result)Root Cause
LiteLLM validates that if message history contains tool calls, the
toolsparameter must be present. Anthropic's native API now handles this gracefully, but many users route through LiteLLM proxies which enforce stricter validation.Proposed Solution
Add a dummy tool when:
providerID,api.id, orapi.npm)tool-callortool-resulttoolsis empty)The dummy tool is excluded from
activeToolsso LLM won't actually call it.Reproduction
Relates to