Skip to content

LiteLLM error: Anthropic doesn't support tool calling without tools= param specified #2915

Closed

Description

@jessevdp

I'm running into some issues related to my provider: LiteLLM proxy. I realize this is a somewhat niche case, sorry 😬. See my config below.

Is this somehow something I can resolve client side?

AI_APICallError: litellm.UnsupportedParamsError: Anthropic doesn't support tool calling without tools= param specified. Pass tools= param OR set litellm.modify_params = True // litellm_settings::modify_params: True to add dummy tool to the request.

Dummy session with the error (error not shown in web UI for some reason?): https://opencode.ai/s/SWAsOXyz

Image

My config

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my-litellm-provider": {
      "name": "My LiteLLM Provider",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://my-provider.com",
        "apiKey": "...",
        "includeUsage": true
      },
      "models": {
        "claude-4-5-sonnet": {
          "name": "Anthropic Claude 4.5 Sonnet",
          "release_date": "2025-09-29",
          "attachment": true,
          "reasoning": true,
          "temperature": true,
          "tool_call": true,
          "limit": {
            "context": 200000,
            "output": 64000
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budget_tokens": 16000,
            },
          }
        },
      }
    }
  }
}

Activity

  1. jessevdp commented on Oct 2, 2025

    @jessevdp
    ContributorAuthor

    It seems to only happen / error with the thinking options added.

  2. self-assigned this
    on Oct 2, 2025
  3. rekram1-node commented on Oct 2, 2025

    @rekram1-node
    Contributor

    @jessevdp is your proxy dropping metadata? it seems like the issue is on your proxy rather than opencode.

    If you turn on reasoning we need to keep the reasoning chunks otherwise anthropic with return error

  4. jessevdp commented on Oct 3, 2025

    @jessevdp
    ContributorAuthor

    Thanks for getting back to me!

    I might have been too quick to come to conclusions. I turned off thinking mode because this LiteLLM proxy distributes between Google Vertex and AWS Bedrock and it seems when forwarding to Vertex thinking mode was giving an error.

    (I left a comment on a closed, seemingly sorta related issue #2599 (comment))

    After turning thinking mode off I was back to not getting those tools related error messages and continued work. But later in the day the error messages returned.

    What might have happened is that earlier in the day the issue was still there, but LiteLLM was falling back / retrying on Vertex (Bedrock is our main provider) and since thinking was now disabled those requests would succeed. We might have simply run out of Vertex capacity later that day.

    What’s interesting is that whenever I get this error and I just type “go” the agent seems fine to just carry on. But that might again just be related to capacity on Google Vertex I suppose…


    Anyway, I probably need to do some more digging to figure out what’s happening.

    Is there some way to enable a nice HTTP log? That way I can inspect the request that resulted in this issue. I’ve tried log level DEBUG but that doesn’t seem to be it.

  5. rekram1-node commented on Oct 3, 2025

    @rekram1-node
    Contributor

    hm dont think we do any http logs now? I feel like we used to do it may still be possible id have to check

  6. mschenk42 commented on Oct 25, 2025

    @mschenk42

    I am also encountering this issue. This appears to occur consistently when the session is compressed either manually or automatically upon reaching the context limit. Otherwise, the system functions flawlessly. Given that it appears to be triggered by compression, it does not appear to be related to using the Lite LLM Proxy.

    I wanted to give you a heads up about the configuration. This is the main agent that uses subagents. I'm wondering if there's anything to do with the subagent sessions?

    When running without subagents manual compaction works fine.

    Image
  7. rekram1-node commented on Oct 25, 2025

    @rekram1-node
    Contributor

    would it be fixed if we just passed an empty tools array when we compact?

  8. mschenk42 commented on Oct 27, 2025

    @mschenk42

    Yeah, based on the error message that seems like it would resolve the problem.

  9. rekram1-node commented on Oct 27, 2025

    @rekram1-node
    Contributor

    ill try that

  10. rekram1-node commented on Oct 27, 2025

    @rekram1-node
    Contributor

    Should be fixed by: 0af4505

    Will release soon

  11. mschenk42 commented on Oct 28, 2025

    @mschenk42

    Unfortunately that didn't work. I'm going to reach out to our team that manages our Lite LLM Proxy. Thanks for trying to resolve. I'll share here if I find a way to resolve this.

  12. rekram1-node commented on Oct 28, 2025

    @rekram1-node
    Contributor

    thank you for heads up

  13. hewliyang commented on Nov 5, 2025

    @hewliyang

    A long time ago, Anthropic models would throw an error if you submitted a completions request w/ a message history containing tool calls & results - but don't pass in any tools. This is what happens during compaction, where we send the existing conversation history + a summary prompt, but disable all tools, i.e. completion([...existing_history_with_tools, summarize_prompt])

    https://github.com/BerriAI/litellm/blob/c45fad3855847715afaebba71926f8e84eb7b355/litellm/llms/anthropic/chat/transformation.py#L672-L686

            if (
                "tools" not in optional_params
                and messages is not None
                and has_tool_call_blocks(messages)
            ):
                if litellm.modify_params:
                    optional_params["tools"], _ = self._map_tools(
                        add_dummy_tool(custom_llm_provider="anthropic")
                    )
                else:
                    raise litellm.UnsupportedParamsError(
                        message="Anthropic doesn't support tool calling without `tools=` param specified. Pass `tools=` param OR set `litellm.modify_params = True` // `litellm_settings::modify_params: True` to add dummy tool to the request.",
                        model="",
                        llm_provider="anthropic",
                    )

    This is no longer the case (evidenced by the fact that compaction works fine via AI SDK). In the short term you can fix this on the LiteLLM side by running the proxy with modify_params=True, as the error message implies. This will add a dummy tool to the request in this case

    https://github.com/BerriAI/litellm/blob/c45fad3855847715afaebba71926f8e84eb7b355/litellm/utils.py#L6809-L6827

    def add_dummy_tool(custom_llm_provider: str) -> List[ChatCompletionToolParam]:
        """
        Prevent Anthropic from raising error when tool_use block exists but no tools are provided.
    
        Relevent Issues: https://github.com/BerriAI/litellm/issues/5388, https://github.com/BerriAI/litellm/issues/5747
        """
        return [
            ChatCompletionToolParam(
                type="function",
                function=ChatCompletionToolParamFunctionChunk(
                    name="dummy_tool",
                    description="This is a dummy tool call",  # provided to satisfy bedrock constraint.
                    parameters={
                        "type": "object",
                        "properties": {},
                    },
                ),
            )
        ]

    But obviously this is suboptimal because now your arguments can be massaged in unknown ways.

    tldr: not an opencode problem, litellm has a lot of footguns

  14. geoHeil commented on Dec 29, 2025

    @geoHeil

    For me, the native pass-through works much better

      "provider": {
        "my-litellm": {
        "my-anthropic": {
          "npm": "@ai-sdk/anthropic",
          "name": "my LiteLLM (Anthropic native)",
          "options": {
            "baseURL": "https://llm.my.corp.com/anthropic/v1",
            "apiKey": "{env:MY_KEY}"
          },
    
  15. danielfrg commented on Jan 13, 2026

    @danielfrg
    Contributor

    I understand this is not an opencode problem directly but its hard to make changes on existing deployments in large companies. This is not the end of the world since a new session is usually fine to continue existing work but a workaround in the config would be nice, maybe a way to set a dummy tool in all calls so compaction works?

  16. added a commit that references this issue on Jan 14, 2026
    d805c88
  17. 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