If you set max_tokens=100 and Claude's natural response would be 500 tokens, what happens?
Select an answer to reveal the explanation.
Short Explanation and Infographic
max_tokens is a hard ceiling — when Claude hits it, generation stops wherever it is, even mid-word. It doesn't gracefully summarize; it just stops.
Full explanation below image
Full Explanation
The max_tokens parameter is a hard limit. When Claude reaches that token count, generation stops immediately — the response may be cut off mid-sentence, mid-word, or mid-thought. The API returns a stop_reason of 'max_tokens' rather than 'end_turn' to indicate the response was cut short. This means developers should set max_tokens high enough for their expected use case, or handle the 'max_tokens' stop reason to notify users the response was truncated. Option A is wrong — no error is returned. Option C is wrong — Claude doesn't auto-summarize. Option D is wrong — Claude strictly respects the limit.