Which older models still allow prefill?
The migration guide says Claude Sonnet 4.5, Claude Haiku 4.5, and older models accept a prefilled last assistant turn. Claude Sonnet 4.6, Claude Sonnet 5, and claude-sonnet-5-5 reject it.
claude-sonnet-5-5 rejects a prefilled last assistant turn. The conversation has to end with a user message.
This model does not support assistant message prefill. The conversation must end with a user message. The Sonnet 5.5 migration guide says claude-sonnet-5-5 rejects a prefilled last assistant turn with a 400, as Claude Sonnet 4.6 and Claude Sonnet 5 do. Claude Sonnet 4.5, Claude Haiku 4.5, and older models accept one. For output format, use structured outputs. For a continuation, move the instruction into the user message. Source: Claude Sonnet 5.5 migration guide, checked October 20, 2026.
| Model id | What the source says |
|---|---|
claude-sonnet-5-5 | Returns 400 when the last message is an assistant prefill. |
claude-sonnet-4-6 | The migration guide says this model also rejects assistant prefill. |
claude-sonnet-5 | The migration guide says this model also rejects assistant prefill. |
claude-sonnet-4-5-20250929 | The migration guide says Claude Sonnet 4.5 still accepts a prefilled last assistant turn. |
End the messages array on a user turn. The migration guide's continuation example puts the interrupted text in the user message.
client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[
{"role": "user", "content": "Write a title"},
{"role": "assistant", "content": "Title:"},
],
)
client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Your previous response was interrupted and ended with Title:. Continue from where you left off.",
},
],
)
Source: Claude Sonnet 5.5 migration guide, checked October 20, 2026.
LiteLLM sends the messages array you pass. Do not leave the last message as role assistant. End on a user message, the same way the migration guide describes.
import litellm
response = litellm.completion(
model="anthropic/claude-sonnet-5-5",
messages=[{
"role": "user",
"content": "Answer with the title only.",
}],
)
Source: LiteLLM Anthropic provider, checked October 20, 2026.
generateText's prompt is a user turn. If you pass messages, the last message has to be a user message. Do not append an assistant prefill.
import { anthropic } from "@ai-sdk/anthropic";
import { generateText } from "ai";
const { text } = await generateText({
model: anthropic("claude-sonnet-5-5"),
prompt: "Answer with the title only.",
});
Source: AI SDK generateText, checked October 20, 2026.
The migration guide says Claude Sonnet 4.5, Claude Haiku 4.5, and older models accept a prefilled last assistant turn. Claude Sonnet 4.6, Claude Sonnet 5, and claude-sonnet-5-5 reject it.