Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

API usage primer for Claude changedclaude_api_primer

Nearest release: v2.1.236, published under an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+8added
Lines−8removed
From line 21 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits19to this page, all time

The whole hunk

from line 21, old and new numbered
/
lines
from line 21
2121 
2222### Basic request and response
2323 
24<CodeGroup>
24<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
2525 ```bash CLI
2626 ant messages create \
2727 --model claude-opus-5 \
from line 66
6666 
6767The Messages API is stateless, which means that you always send the full conversational history to the API. You can use this pattern to build up a conversation over time. Earlier conversational turns don't necessarily need to actually originate from Claude. You can use synthetic `assistant` messages.
6868 
69<CodeGroup>
69<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
7070 ```bash CLI
7171 ant messages create <<'YAML'
7272 model: claude-opus-5
from line 105
105105 Claude 4.6 and later models and Claude Mythos Preview do not support assistant message prefill; requests to those models must end with a user message. The examples below use a model that supports prefill.
106106</Note>
107107 
108<CodeGroup>
108<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
109109 ```bash CLI
110110 ant messages create <<'YAML'
111111 model: claude-sonnet-4-5
from line 140
140140 
141141Claude can read both text and images in requests. Both `base64` and `url` source types are supported for images, along with the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
142142 
143<CodeGroup>
143<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
144144 ```bash CLI
145145 IMAGE_URL="https://platform.claude.com/docs/images/vision-example.jpg"
146146 
from line 260
260260 
261261When thinking is on, Claude creates `thinking` content blocks where it outputs its internal reasoning. The API response includes `thinking` content blocks, followed by `text` content blocks.
262262 
263<CodeGroup>
263<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
264264 ```bash CLI
265265 ant messages create \
266266 --transform content --format yaml <<'YAML'
from line 314
314314 
315315### Preserving thinking blocks
316316 
317<CodeGroup>
317<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
318318 ```bash CLI
319319 # First request: capture the assistant content array (thinking + tool_use
320320 # blocks, signatures intact) as compact JSON.
from line 448
448448 
449449On older models that use manual extended thinking (Claude 4, 4.5, and Sonnet 4.6 models), enable interleaved thinking by adding the beta header `interleaved-thinking-2025-05-14` to your API request:
450450 
451<CodeGroup>
451<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
452452 ```bash CLI
453453 ant beta:messages create --beta interleaved-thinking-2025-05-14 <<'YAML'
454454 model: claude-sonnet-4-6
from line 719
719719 
720720### Streaming with SDKs
721721 
722<CodeGroup>
722<CodeGroup exclude="shell:cURL, typescript, csharp, go, java, php, ruby">
723723 ```bash CLI
724724 ant messages create --stream --format jsonl \
725725 --model claude-opus-5 \
Feedback