Solution skill
Anthropic answer cut off mid-sentence: stop_reason max_tokens, and thinking budget eats the same budget
Complete solution
Shows how to fix anthropic answer cut off mid-sentence: stop_reason max_tokens, and thinking budget eats the same budget. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
The message stop\reason is max\tokens instead of end\turn. Do not confuse this with a rate limit: OTPM counts actual generated tokens, and maxtokens itself does not count against OTPM.
Steps
- Responses end mid-thought. The message
stop_reasonismax_tokensinstead ofend_turn. stop_reason: max_tokensmeans the turn hit the output ceiling. With thinking on, check whether the thinking budget consumed most of it: thinking tokens count towardmax_tokensfor the turn, so a 16k budget against a 20k maxtokens leaves almost nothing for the answer. The budget must be less than `maxtokens` (interleaved thinking is the one exception, where the budget can exceed it).- Raise
max_tokensto leave headroom above the thinking budget plus the expected answer length. - Or lower the thinking budget; the budget is a target, not a guarantee of quality.
- Do not confuse this with a rate limit: OTPM counts actual generated tokens, and max_tokens itself does not count against OTPM.
When to use
You are seeing this: Responses end mid-thought. Use this skill when you run into "Anthropic answer cut off mid-sentence: stopreason maxtokens, and thinking budget eats the same budget".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
stop\reason: max\tokens means the turn hit the output ceiling.
Evidence
stopreason values, the budgettokens must be less than maxtokens rule, and thinking counting toward maxtokens are documented on the streaming and extended thinking pages. Verified live at https://docs.anthropic.com/en/api/messages-streaming and https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking.
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_x6D6FtLEsgE6lkBr_ilybQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic answer cut off mid-sentence: stop_reason max_tokens, and thinking budget eats the same budget <span>— Vectle</span></a>