Can I still force a tool?
Not with tool_choice. The migration guide says to send type auto, set strict true, and say in the prompt when the tool applies. The model can still answer in text.
Forcing a tool with tool_choice type tool or any fails on claude-sonnet-5-5, including on the token counting endpoint. Send type auto.
tool_choice: type "tool" and "any" are not supported for this model. The Sonnet 5.5 migration guide says every earlier model on that page accepts tool_choice type any or tool. claude-sonnet-5-5 rejects both with a 400. Send tool_choice type auto, mark the tool strict so its input matches the schema, and say in the prompt when to use the tool. The model can answer without calling it. Source: Claude Sonnet 5.5 migration guide, checked October 20, 2026.
| Model id | What the source says |
|---|---|
claude-sonnet-5-5 | Returns 400 for tool_choice type "tool" and type "any". |
The migration guide's after request uses tool_choice type auto, strict true on the tool, and a user message that says when to call the tool.
client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
tools=[{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
"additionalProperties": False,
},
}],
tool_choice={"type": "tool", "name": "get_weather"},
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
)
client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
tools=[{
"name": "get_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
}],
tool_choice={"type": "auto"},
messages=[{
"role": "user",
"content": "What's the weather in Paris? Use the get_weather tool.",
}],
)
Source: Claude Sonnet 5.5 migration guide, checked October 20, 2026.
LiteLLM's Anthropic page shows tool_choice set to "auto", and it also shows a type tool example on claude-sonnet-5. Do not send type tool or any to claude-sonnet-5-5. Send auto.
import litellm
response = litellm.completion(
model="anthropic/claude-sonnet-5-5",
messages=[{"role": "user", "content": "What's the weather in Paris? Use the get_weather tool."}],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"],
},
},
}],
tool_choice="auto",
)
Source: LiteLLM Anthropic provider, checked October 20, 2026.
generateText documents toolChoice "auto", "none", "required", and a named tool. "auto" is the default. The Anthropic provider docs say a required or named toolChoice is downgraded to auto for claude-opus-5-5 and claude-fable-5-1. They do not say that for claude-sonnet-5-5, so set toolChoice to "auto" yourself and say in the prompt when to call the tool.
import { anthropic } from "@ai-sdk/anthropic";
import { generateText, tool } from "ai";
import { z } from "zod";
const result = await generateText({
model: anthropic("claude-sonnet-5-5"),
prompt: "What's the weather in Paris? Use the get_weather tool.",
toolChoice: "auto",
tools: {
get_weather: tool({
description: "Get the current weather in a given location",
inputSchema: z.object({ location: z.string() }),
}),
},
});
Source: AI SDK generateText, checked October 20, 2026.
Not with tool_choice. The migration guide says to send type auto, set strict true, and say in the prompt when the tool applies. The model can still answer in text.