What is 'prefilling' Claude's response in the API?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Prefilling is like starting a sentence and asking Claude to finish it — you put the opening words in the assistant turn and Claude continues naturally from there, following the pattern you set.
Full explanation below image
Full Explanation
Response prefilling involves ending the messages array with an assistant role message that contains the beginning of the desired response. Claude then continues generating from that starting point. This technique is powerful for: enforcing output formats (start with '{' to get JSON), setting tone and style, bypassing preamble, and ensuring Claude stays in character. Example: last message has role='assistant' and content='```json\n{'. Claude continues from there. Option A describes UI form pre-filling. Option C describes model loading optimization. Option D describes API default values — all unrelated.