[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SSE Streaming Protocol
The Streaming Lifecycle
When stream: true is enabled, the API responds with a series of Server-Sent Events (SSE). Understanding the lifecycle is critical for building responsive UIs. The sequence always follows this deterministic path:
message_start: Provides the message ID and initial usage (input tokens).content_block_start: Indicates the start of a text or tool block.content_block_delta: Fires repeatedly with small chunks of text.content_block_stop: Signals the end of that specific content block.message_delta: Contains final metadata and stop reasons.message_stop: The final event in the stream.
// Example text delta event
event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "Hello world"}}⌨ HANDS-ON LABStream a Response Over SSE
⭐ +150 XPWatch the token stream live. Fire a streaming Messages API request with curl, then isolate the SSE event sequence to prove the lifecycle order.
1Send a streaming request: add "stream": true to the JSON body and use curl -N so output isn't buffered.
2Re-run the stream but pipe it through grep to print only the event: lines - the lifecycle order should match the docs.
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
Which SSE event continuously fires as Claude generates text tokens?
message_ping
content_block_delta
stream_output
text_generate