SunsetDiff

This model does not support assistant message prefill. The conversation must end with a user message.

claude-sonnet-5-5 rejects a prefilled last assistant turn. The conversation has to end with a user message.

Error text

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.

Affected models

Models named on the official page for this failure.
Model idWhat 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.

Fix

Raw SDK

End the messages array on a user turn. The migration guide's continuation example puts the interrupted text in the user message.

Before

client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Write a title"},
        {"role": "assistant", "content": "Title:"},
    ],
)

After

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

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.

Python

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.

Vercel AI SDK

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.

TypeScript

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.

Switch guides

More request errors

All request errors

Questions

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.

Deprecation alerts

We email you before models shut down. Unsubscribe anytime.

Deprecation alert signup
Providers (optional)