-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Closed
Description
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, orapi.npm) - Message history contains
tool-callortool-result - No tools are provided (
toolsis empty)
The dummy tool is excluded fromactiveToolsso 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: UnsupportedParamsErrorRelates to
- LiteLLM error: Anthropic doesn't support tool calling without tools= param specified #2915 (same root cause, different approach)
hendem
Metadata
Metadata
Assignees
Labels
No labels