HomeLearnCoursesHackathonsAccount
Mastering the Claude API
Extended Thinking and Vision · 1/2

Extended thinking: letting Claude reason before answering

For problems that benefit from multi-step reasoning — math, multi-constraint planning, debugging a tricky failure — you can enable extended thinking, which has Claude generate an internal reasoning process before producing its final answer. This arrives in the response as one or more thinking content blocks, separate from the text block containing the actual answer, so your application can choose whether to surface the reasoning to users or just use the improved final answer. Thinking is billed as output tokens like any other generated content, so it's a real cost and latency tradeoff, not a free quality boost — reach for it when a task's difficulty actually warrants deliberation, not by default on every request.

The practical habit worth building is checking a block's type before reading it: iterate response.content and handle 'thinking' blocks and 'text' blocks distinctly, since treating a thinking block as the final answer (or vice versa) is a common early mistake. When thinking is enabled in a multi-turn tool-use conversation, thinking blocks generally need to be passed back unchanged on subsequent requests within that turn sequence — dropping or editing them can break the reasoning continuity the model relies on.