AI EngineerGuide

tool_choice any or tool returns a 400 on Claude Sonnet 5.5

Returns 400 Applies to claude-sonnet-5-5 on the Anthropic Messages API.

Error message, quoted from Anthropic's docs:

tool_choice: type "tool" and "any" are not supported for this model.

How to fix it

Send tool_choice: {"type": "auto"}, mark the tool strict: true, and say in the prompt when to use it. This applies to the token counting endpoint too.

Before
{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Summarize this ticket.",
      "role": "user"
    }
  ],
  "model": "claude-sonnet-4-5-20250929",
  "tool_choice": {
    "name": "get_invoice",
    "type": "tool"
  },
  "tools": [
    {
      "description": "Fetch an invoice",
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object"
      },
      "name": "get_invoice"
    }
  ]
}
After (Claude Sonnet 5.5)
{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Summarize this ticket.",
      "role": "user"
    }
  ],
  "model": "claude-sonnet-5-5",
  "tool_choice": {
    "type": "auto"
  },
  "tools": [
    {
      "description": "Fetch an invoice",
      "input_schema": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "type": "object"
      },
      "name": "get_invoice",
      "strict": true
    }
  ]
}

Official source

Claude Sonnet 5.5 rejects both with a 400 error, including on the token counting endpoint

https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide#forced-tool-use (last checked 2026-11-02)

Other changes for the same models

All migration errors

FAQ

What does "tool_choice: type "tool" and "any" are not supported for this model." mean?

tool_choice any or tool returns a 400 on Claude Sonnet 5.5 The fix: Send tool_choice: {"type": "auto"}, mark the tool strict: true, and say in the prompt when to use it. This applies to the token counting endpoint too.

How do I fix this when moving to claude-sonnet-5-5?

Send tool_choice: {"type": "auto"}, mark the tool strict: true, and say in the prompt when to use it. This applies to the token counting endpoint too.

Where is this documented?

In Anthropic’s official docs: https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide#forced-tool-use, last checked 2026-11-02.