Extended Thinking and Prompt Caching
CoreApply extended thinking, prompt caching, batch processing, and vendor choice · Difficulty 2/5
Explanation
Extended Thinking
Turning on a thinking budget lets Claude produce internal reasoning before its final answer, improving performance on hard, multi-step tasks. The catch: thinking tokens are billed as output tokens. Extended Thinking is a capability-vs-cost lever, not a free quality upgrade -- apply it to steps whose reasoning depth genuinely pays for the added tokens and latency, not uniformly across a pipeline.
The Signature Carry-Back Rule
Extended Thinking imposes one non-negotiable structural requirement on multi-turn, tool-using conversations: every thinking block the API returns must be passed back on the next request byte-for-byte unchanged. Each thinking block carries an opaque signature field that the API uses to confirm the reasoning it's receiving back is exactly what it produced -- not edited, not summarized, not reconstructed from a paraphrase. Modify the block in any way and the signature no longer matches; the API rejects the request rather than silently accepting tampered reasoning.
This applies identically to redacted (encrypted) thinking blocks. Their contents are ciphertext -- unreadable, not meant to be inspected by your code or a human -- but that does not exempt them from the rule. They still have to be returned in the same position, completely untouched, on the next turn. There is no version of "it's just encrypted noise, so trimming it is harmless" -- the signature check runs regardless of whether the payload is legible.
The most common way this rule gets violated in practice: a developer worried about context-window growth strips thinking blocks out of history before resending it, intending to save tokens. That optimization breaks the very next request. If context budget from accumulated reasoning is the actual concern, the fix is the context-engineering toolkit (pruning, compaction, subagent handoffs) applied to the conversation as a whole -- not ad hoc surgery on an individual thinking block, which is a hard failure rather than a savings.
Prompt Caching
Mark a stable prefix -- a system prompt, long reference documents, tool definitions -- with cache_control so it is cached server-side. Subsequent requests that reuse that identical prefix:
- Pay a large discount on the cached tokens
- Start faster, since the cached portion doesn't need to be reprocessed from scratch
Cache writes cost a bit more than normal input tokens (a one-time premium the first time a prefix is cached); cache reads are much cheaper. The economics favor caching precisely when many requests share a long, unchanging prefix -- the repeated cheap reads outweigh the one-time write premium.
Common exam traps
- Treating Extended Thinking as strictly beneficial -- it costs billed output tokens and latency, so it should be reserved for genuinely hard reasoning steps.
- Stripping or summarizing a thinking block to save context before the next tool-use turn -- this breaks the signature and the very next request fails.
- Assuming a redacted/encrypted thinking block is exempt from the carry-back rule because its content can't be read -- it still must be replayed unchanged.
- Assuming caching helps when every request is different -- caching only pays off with a long, unchanging, *shared* prefix across many requests.
- Truncating a needed document to save tokens instead of caching it, trading away correctness for a savings that caching would have delivered without any information loss.
Key Takeaways
- Extended thinking produces internal reasoning before the answer; thinking tokens are billed as output tokens
- Reserve extended thinking for steps whose reasoning depth pays for the added tokens/latency, not as a default
- Every thinking block carries a signature and must be passed back to the API completely unchanged on the next turn -- editing, summarizing, or dropping it breaks the signature and the request is rejected
- Redacted (encrypted) thinking blocks follow the identical carry-back rule even though their content is unreadable
- Prompt caching (cache_control) discounts and speeds up requests that reuse an identical stable prefix
- Cache writes cost a bit more than normal input; cache reads are much cheaper -- caching pays off with high prefix reuse
- Caching delivers the most benefit when many requests share a long, unchanging prefix, not when every request differs
Glossary Terms
A parameter within the extended thinking configuration that sets the maximum tokens Claude can use for its internal reasoning process. Higher budgets allow more thorough reasoning but increase cost and latency. Must be at least 1024.
The time-to-live for cached prompt content in Claude's prompt caching system. The cache entry is refreshed (TTL resets) each time the cached content is used. If unused beyond the TTL window, the cache entry expires and the content must be re-processed and billed at full rate.
A Claude capability that allows the model to reason through complex problems step-by-step in a dedicated thinking block before producing its final response. Controlled via the 'thinking' parameter with a 'budget_tokens' limit. Thinking tokens are billed but improve accuracy on hard reasoning tasks.
A Claude API feature that caches frequently-used prompt content (system prompts, large documents, tool definitions) to reduce cost and latency on repeated API calls. Cached tokens are billed at a discounted rate. Cache has a TTL that resets on each use. Must be enabled by marking content with cache_control.
Related Concepts
The Message Batches API, Realtime vs. Batch & Third-Party Vendors
The Message Batches API processes many requests asynchronously within 24 hours at a substantial per-token discount
Streaming, Tool Use & Vision
Streaming delivers server-sent events as generation happens, lowering perceived latency without changing total tokens or cost