Why this page exists
Deep dives 6.1-6.4 taught you to call the API, engineer prompts, wire tools, and build RAG. This page covers the feature layer that the official "Features of Claude" module walks through: the request-level switches that change what Claude can see, how hard it thinks, how answers are grounded, and what a month of production traffic costs. Every card is runnable Python against the current API.
Buying reasoning, feeding non-text inputs 15 min
Three features that change WHAT Claude works with: a reasoning budget for hard problems, image blocks for anything visual, and document blocks for real PDFs.
CoreExtended thinking: paying for reasoning where it matters5 min▶
Extended thinking gives Claude a scratchpad before it answers. You set a token budget; Claude reasons inside it, then writes the final answer. You pay for the thinking tokens, so the whole game is knowing when it's worth it.
- When it pays: multi-step math, constrained planning, tricky data analysis, debugging with several interacting causes. Anything where a human would want scratch paper.
- When it's wasted tokens: lookups, reformatting, summarisation, classification. The model answers those in one pass anyway; the budget just sits there as spend risk.
- Reading the response: thinking arrives as separate
thinkingblocks before thetextblock. Log them in dev (they are gold for debugging prompts), hide them from end users. Notebudget_tokensmust be less thanmax_tokens. - Tuning: start around 4k-8k for hard analytical questions. If the thinking block ends abruptly mid-reasoning, the budget was too small; if it's short and the budget huge, dial it down.
CoreVision: images as content blocks5 min▶
Images are just another content block in the messages you already know. Two sources: base64 for local files, URL for anything already hosted.
- Chart reading: dashboards, plots from papers, that PNG a stakeholder pasted into Slack. Claude reads axes, legends, and trends - ask for a table, not a description, and you get data back.
- Screenshot QA: "does this UI match the spec?" with the screenshot and the spec in the same message. Cheap visual regression review.
- Document photos: phone photos of receipts, whiteboards, forms. For born-digital PDFs, use the document block in the next card instead - it keeps layout.
- Practical limits: up to 100 images per request; resize huge images to roughly 1568px on the long edge before encoding, since bigger only burns tokens.
CorePDF support: document blocks beat text extraction5 min▶
You could run a PDF through an extraction library and paste the text. Native PDF support sends the file itself as a document block, and Claude sees each page as text AND image together.
- When native wins: layout that carries meaning (two-column reports, forms), tables that extraction mangles, scanned pages where there is no text layer at all, and anything with charts or stamps inside.
- When extraction is fine: clean single-column born-digital text you'll reuse across many calls - extracted text is cheaper per call and easier to cache.
- Cost model: each PDF page costs its text tokens plus an image's worth of tokens, so a 100-page contract is a real spend. Cache it (Part 2) if you'll ask more than one question.
Auditable answers, sane bills 12 min
Citations make answers point at exact source passages. Caching makes the tenth question against the same document nearly free. Together they are the compliance-and-cost story for document workloads.
CoreCitations: answers that point at passages4 min▶
Enable citations on a document block and every claim in the answer arrives with the exact source span attached - page numbers, character ranges, quoted text. This is the format compliance teams actually accept, because "the model said so" becomes "clause 4.2, page 7 says so".
- Works on plain-text documents, PDFs (citations carry page numbers), and pre-chunked custom content. Also on search results returned by your own tools.
- Why it beats "please quote your sources" in the prompt: cited spans are structured fields extracted from the document, not generated text, so they can't be hallucinated quotes. Render them as footnotes or links in your UI.
- The fit: policy Q&A, contract review, regulatory summaries, anything a human will be held accountable for repeating.
A data team shipped a "policy bot" twice. Version 1 answered from a RAG index with no citations; legal refused to let staff rely on it. Version 2 sent the policy as a citations-enabled document block and rendered every claim with its clause reference; legal signed off in a week. Same model, same accuracy - the citation format was the approval.
CorePrompt caching part 1: the mechanics4 min▶
Every call re-sends your whole prompt. If 45k of those tokens are the same system prompt and the same big document every time, you are paying full input price to re-process identical bytes. A cache_control breakpoint tells the API: everything up to here is stable, keep the processed prefix warm.
- Where to put breakpoints: after the largest stable prefix - system prompt, tool definitions, big reference documents. Up to 4 breakpoints per request for layered prefixes.
- TTL: the cache lives about 5 minutes and every hit refreshes it, so steady traffic keeps it warm indefinitely. A 1-hour TTL option exists for spiky workloads.
- The economics: cache writes cost a bit more than normal input, cache reads cost a small fraction of it. Check
usage.cache_read_input_tokensin every response - that field is your proof the cache is actually hitting.
| Token type | Price vs normal input | Where you see it in usage |
|---|---|---|
| Normal input | 1.0x baseline | input_tokens |
| Cache write (first call) | ~1.25x | cache_creation_input_tokens |
| Cache read (every hit) | ~0.1x | cache_read_input_tokens |
CorePrompt caching part 2: the rules that make or break it4 min▶
Caching fails silently: you never get an error, you just quietly pay full price. Three rules decide whether you hit.
- Rule 1 - minimum length. A prefix below the minimum cacheable size (1024 tokens on most models, 2048 on the fastest ones) is never cached, no matter the breakpoint. Don't bother caching a two-line system prompt.
- Rule 2 - byte-identical prefix. The cache key is the exact bytes of everything before the breakpoint. One changed character - reordered JSON keys, a trailing space, a different tool list - and it's a miss. Serialize your prefix deterministically.
- Rule 3 - order matters. Stable content first, variable content last. The moment something variable appears, everything after it is uncacheable. Structure requests as: tools, then system + big docs (breakpoint), then per-user context, then the question.
The classic mistake: a team put Current time: 2026-07-07 09:14:03 at the TOP of their system prompt. Every request had a different first line, so every request was a cache miss on the entire 40k-token prefix. Their "cached" bill was identical to the uncached one for three weeks before anyone read the usage fields. Moving the timestamp into the user message fixed it in one line.
cache_read_input_tokens / (input_tokens + cache_read_input_tokens) as your cache hit ratio. If it isn't above 80% on a document workload, one of the three rules is being violated - almost always rule 2.
Code execution and the Files API 8 min
Sometimes the right answer to "analyse this CSV" is not prose - it's Claude writing and running pandas. The code execution tool gives Claude a managed Python sandbox; the Files API gets your data into it.
AdvancedUpload a CSV, let Claude run pandas on it5 min▶
Two pieces: upload the file once via the Files API, then reference it in a message with the code execution tool enabled. Claude writes Python, runs it in the sandbox, reads the output, and iterates - the same loop a data scientist runs in a notebook.
- What the sandbox has: Python with the standard data stack (pandas, numpy, matplotlib and friends), a filesystem for your uploaded files, no network access. Claude sees stdout, stderr, and generated files, and can retry when its own code errors.
- Files created in the sandbox (cleaned CSVs, plots) come back as file references you can download via the Files API - so "clean this file and give it back" is a one-message pipeline.
AdvancedManaged sandbox vs DIY tool: which one when3 min▶
- Managed wins when the work is exploratory analysis on uploaded data: you skip building an executor, sandboxing it, capturing output, and handling retries. That's real security engineering you don't have to own.
- DIY (your own code tool from deep dive 6.3) wins when the code must touch YOUR infrastructure: the warehouse, internal packages, live APIs, network calls. The managed sandbox is deliberately isolated - no network is a feature there, a blocker here.
- The hybrid most data teams land on: managed sandbox for ad-hoc file analysis, a narrow read-only warehouse tool for governed data access. Which is exactly where the MCP page (6.6) picks up.
Three exercises ◐ 35-45 min
- 1 · Cache economics, measured. Take a 50-page document (or any 30k+ token text). Ask it 5 different questions through one function with a
cache_controlbreakpoint. Printcache_creation_input_tokensandcache_read_input_tokensfor each call and compute what the 5 questions cost with and without caching. Then break it on purpose: add a timestamp above the breakpoint and watch every hit disappear. - 2 · Citation-grounded policy Q&A. Send a real policy PDF as a citations-enabled document block. Ask 3 questions a colleague actually asked this month. For each answer, print the cited text next to the claim and check it by hand - does the cited passage really support the sentence?
- 3 · Chart screenshot to data table. Screenshot a chart from any dashboard you use. Send it as an image block and prompt for a markdown table of every series, plus one anomaly the chart shows. Compare the extracted numbers against the source data and note where vision reading breaks down (dense legends, stacked areas).
Official courses covered
This page teaches the "Features of Claude" module that all three 8-hour engineering courses share, plus the code execution and Files API lectures specific to the API course.