Streaming Chunk Reassembler

Reassemble SSE/streaming LLM chunks into a clean full response.

Ad placeholder (leaderboard)

Streaming chunk reassembler

When you call an LLM with stream: true, the response arrives as a sequence of tiny Server-Sent Events — each carrying one or two tokens inside a JSON delta. Reading that raw stream by hand is miserable. This tool takes the raw SSE body, parses every data: line, pulls the incremental token out of each chunk, and stitches them back into the single, complete response the model produced.

How it works

The parser scans the input line by line. For each line beginning with data:, it strips the prefix, skips the [DONE] sentinel, and attempts to JSON-parse the payload. It then extracts the incremental content from the common streaming shapes — OpenAI’s choices[0].delta.content, Anthropic’s delta.text, and a few fallbacks — and appends it to a growing buffer. Lines that are plain text rather than JSON are appended directly. The result is the full reassembled string, along with a count of how many chunks contributed and a pretty-printed view if the output is valid JSON.

Tips and notes

  • Grab the raw body, not the parsed view. In Chrome DevTools, use the network entry’s raw response so the data: framing is intact.
  • Blank lines are fine. SSE separates events with blank lines; the parser ignores them, so you can paste the stream exactly as captured.
  • Mixed formats. If a stream interleaves event types (e.g. Anthropic’s content_block_delta and message_delta), only the text-bearing deltas are concatenated, which is usually what you want.
  • Everything is local. No network calls are made, so sensitive transcripts stay on your machine.
Ad placeholder (rectangle)