Fluxio
← Back to the blog

Watch Claude Code Live: Terminal Token Streams

Coding agents, liveEN

§1 Claude Code’s live output, without the mystery

Watching Claude Code work is more useful when you can distinguish a live reply from a finished transcript. In this five-minute quick start, you will expose its streaming events, print text as it arrives, and keep a raw event log for troubleshooting.

“Watching it think” does not mean accessing private internal reasoning. You are observing the output and activity that Claude Code exposes: text updates, tool activity, and any reasoning summaries available in your configuration. A quiet terminal does not necessarily mean the model has stopped working.

§2 Minute 1: Check Claude Code and jq

Start in a disposable project directory with Claude Code installed and authenticated. You also need jq, the command-line JSON processor. Run these checks separately:

$ claude --version

jq --version

This walkthrough uses print mode rather than the interactive interface. Print mode makes structured output easier to inspect and pipe into another program. Choose a small, read-only prompt so your first experiment does not involve permission requests or repository changes.

If your installation rejects a flag below, check claude --help and update through your usual installation method. Streaming options can vary between releases.

§3 Minute 2: Expose Claude Code’s JSON event stream

Run this command as one line:

$ claude -p "Explain what a token stream is in three short sentences. Do not use tools." --verbose --output-format stream-json --include-partial-messages

Instead of a single polished answer, you should see newline-delimited JSON records. The stream can include initialization information, message events, incremental updates, and a final result record.

  • – --output-format stream-json selects structured streaming output rather than plain text or one final JSON document.
  • – --include-partial-messages includes incremental message events so you can observe generation before the reply finishes.
  • – --verbose enables the detailed output required for streaming JSON in print mode.

These records are not necessarily individual tokens. An update may contain a fragment of a word, several words, or metadata. Think of them as delivery chunks, not a reliable token counter.

§4 Minute 3: Print only the live text deltas

The raw stream is useful for debugging but noisy for reading. Pipe it through jq to select text deltas:

claude -p "Explain what a token stream is in three short sentences. Do not use tools." --verbose --output-format stream-json --include-partial-messages | jq --unbuffered -rj 'select(.type == "stream_event") | .event | select(.type == "content_block_delta") | .delta | select(.type == "text_delta") | .text'

The filter follows the event wrapper into each content-block delta and prints only its text. The -rj options remove JSON quoting and join fragments without inserting extra newlines. --unbuffered asks jq to flush after each output value, helping preserve the live effect.

This intentionally hides tool events and completion metadata. It is a readable text view, not a complete execution monitor. Your shell prompt may appear immediately after the answer because the filter adds no trailing newline.

§5 Minute 4: Save the stream before filtering it

To keep an inspectable record, insert tee claude-stream.jsonl between the Claude command and jq. The pipeline becomes claude command | tee claude-stream.jsonl | jq filter, using the full command and filter above.

Keep this file private: event logs may contain prompts, generated content, file paths, or tool details. Do not publish a raw trace without reviewing it.

§6 Minute 5: Separate CLI events from relay streaming

Claude Code’s JSON records are a CLI-level format, not raw Server-Sent Events. If you later build a real-time interface, preserve that distinction: upstream API streaming and terminal event rendering are separate layers.

Fluxio fits when you want a streaming-first, pay-per-token relay across compatible tools. Its API base is https://api.fluxioapi.com; OpenAI-style clients append /v1. It works with Claude Code, but use Fluxio’s current Claude Code setup instructions rather than assuming an OpenAI-style endpoint configures the CLI. With authentication working, the terminal workflow above gives you an immediate way to inspect live delivery.

Sign up for Fluxio to try streaming replies.

Create a Fluxio account →

More from the current