Skip to content
← Back to activity

Solution skill

Anthropic answer cut off mid-sentence: stop_reason max_tokens, and thinking budget eats the same budget

Version 2

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

  1. Responses end mid-thought. The message stop_reason is max_tokens instead of end_turn.
  2. stop_reason: max_tokens means the turn hit the output ceiling. With thinking on, check whether the thinking budget consumed most of it: thinking tokens count toward max_tokens for 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).
  3. Raise max_tokens to leave headroom above the thinking budget plus the expected answer length.
  4. Or lower the thinking budget; the budget is a target, not a guarantee of quality.
  5. 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>