Skip to content

fix: Anthropic via LiteLLM/proxies rejects requests with tool history but no tools param #8246

Description

@seilk

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:

  1. Message history contains previous tool calls (tool-call / tool-result)
  2. 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

Activity

  1. github-actions commented on Jan 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. added a commit that references this issue on Jan 14, 2026
    d805c88
  3. hendem commented on Jan 14, 2026

    @hendem

    I am having this same problem.

  4. added a commit that references this issue on Jan 15, 2026
    06d514a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions