A CLI tool that renders streamed LLM output as beautiful markdown in the terminal
  • Go 61.8%
  • Shell 34.3%
  • Makefile 3.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Gaurav Gosain f319e43181 Fix VHS demos: preserve indentation, clean thinking, fix alt scroll
- Stream fixtures now emit fixed-size character chunks instead of
  bash word splitting, so leading whitespace (code indentation,
  blockquote prefixes, etc.) is preserved in the rendered output.
- Thinking demo uses a single-paragraph reasoning string to avoid
  glamour blockquote wrap artifacts where continuation lines lost
  their bar prefix.
- Alt-screen tape waits 7s for streaming to complete before
  demonstrating scrolling, so the auto-scroll behavior does not
  fight the manual scroll keys.
2026-05-09 20:12:30 +04:00
.github Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
vhs Fix VHS demos: preserve indentation, clean thinking, fix alt scroll 2026-05-09 20:12:30 +04:00
.gitignore Add VHS tapes and embed README GIFs 2026-05-09 20:03:48 +04:00
.goreleaser.yml Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
CITATION.cff Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
FUNDING.yml Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
go.mod Bump deps to actual latest versions 2026-05-09 19:56:09 +04:00
go.sum Bump deps to actual latest versions 2026-05-09 19:56:09 +04:00
install.sh Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
LICENSE init 2026-03-06 11:53:49 +04:00
main.go Event-driven streaming, update deps, clean up inline mode 2026-05-09 19:50:33 +04:00
README.md Add VHS tapes and embed README GIFs 2026-05-09 20:03:48 +04:00
SECURITY.md Add release infrastructure and repo metadata 2026-03-06 18:28:34 +04:00
tui.go Event-driven streaming, update deps, clean up inline mode 2026-05-09 19:50:33 +04:00

streamd

A CLI tool that renders streamed LLM output as beautiful markdown in the terminal.

Latest Release GoDoc


streamd rendering streamed markdown in the terminal

streamd takes piped input from any LLM CLI or API endpoint and renders it as beautifully formatted markdown in the terminal. It auto-detects the input format and just works, whether you're piping from curl, ollama run, or plain text.

Table of Contents

Installation

Package Managers

Homebrew (macOS/Linux):

brew tap Gaurav-Gosain/tap
brew install streamd

Other Methods

  • GitHub Releases - Download pre-built binaries
  • Go Install: go install github.com/Gaurav-Gosain/streamd@latest
  • Build from Source: See Development below

Requirements:

  • A terminal with true color support (most modern terminals work fine)
  • Go 1.25+ (if building from source)

Usage

Tip: when piping from curl, use -N (--no-buffer) so each SSE event is flushed immediately. Without it curl batches output until its pipe buffer fills, which makes the stream look frozen.

# Ollama CLI, just pipe it
ollama run gemma3:4b "explain quicksort" | streamd

# Ollama native /api/chat
curl -sN http://localhost:11434/api/chat \
  -d '{"model":"gemma3:4b","messages":[{"role":"user","content":"hello"}],"stream":true}' | streamd

# Ollama /api/generate
curl -sN http://localhost:11434/api/generate \
  -d '{"model":"gemma3:4b","prompt":"explain quicksort","stream":true}' | streamd

# OpenAI-compatible endpoint
curl -sN https://api.example.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"...","messages":[{"role":"user","content":"hello"}],"stream":true}' | streamd

# Any plain text or markdown
cat README.md | streamd
echo "# Hello **world**" | streamd

# Alt-screen mode with scrollable viewport
ollama run gemma3:4b "explain quicksort" | streamd --alt

# Show model info and token usage
curl -sN http://localhost:11434/api/chat \
  -d '{"model":"gemma3:4b","messages":[...],"stream":true}' | streamd --info

# Hide thinking/reasoning output
curl -sN ... | streamd --no-think

# Use a different glamour theme
curl -sN ... | streamd --style dracula

Flags

Flag Short Default Description
--alt false Interactive alt-screen with viewport scrolling
--no-think false Hide thinking/reasoning output
--info -i false Show model name, token usage, and speed after response
--style dark Glamour style: dark, light, dracula, tokyo-night, pink, ascii
--wrap -w 0 Word wrap width (0 = terminal width)

The style can also be set via the GLAMOUR_STYLE environment variable.

Supported Formats

streamd auto-detects the input format — no flags or configuration needed.

Format Source Example
Plain text / Markdown ollama run, cat, echo, any CLI ollama run gemma3 "hi" | streamd
Ollama /api/chat NDJSON streaming curl -s .../api/chat -d '...' | streamd
Ollama /api/generate NDJSON streaming curl -s .../api/generate -d '...' | streamd
OpenAI Chat Completions SSE streaming & non-streaming curl -s .../v1/chat/completions -d '...' | streamd
OpenAI Responses API SSE with response.output_text.delta events curl -s .../v1/responses -d '...' | streamd

Features

  • Live markdown rendering using glamour v2 with syntax-highlighted code blocks, styled headings, lists, tables, and more
  • Universal input: auto-detects SSE, NDJSON, and plain text so it works with any LLM tool
  • Event-driven rendering with batched SSE reads for instant first-token display
  • Thinking/reasoning support for models that expose chain-of-thought, via the reasoning_content SSE field or inline <think>...</think> tags
  • Clean scrollback: inline mode streams in an alt-screen and prints the final output in one shot, so the result looks like a single command output
  • Interactive alt-screen mode powered by bubbletea with a scrollable viewport, scroll progress bar, and keyboard navigation
  • Usage info (--info): model name, token counts, speed (tok/s), and duration on stderr
  • Multiple themes: dark, light, dracula, tokyo-night, pink, ascii
  • Auto-detected terminal width for proper word wrapping
  • Styled CLI help via fang

Modes

Inline Mode (default)

streamd inline mode

The live view is rendered in an alt-screen so the terminal scrollback stays clean. When streaming finishes the alt-screen is dismissed and the final rendered output is printed in one shot, so the result reads as a single command output.

Alt-Screen Mode (--alt)

streamd alt-screen mode

Opens a full-screen interactive viewport with a scroll bar and status line. The stream auto-scrolls to follow new content; scrolling up pauses auto-scroll and G resumes it.

Keyboard Shortcuts

Key Action
j / k Scroll down / up
d / u Half-page down / up
pgdn / pgup Page down / up
g / G Go to top / bottom
q / esc / ctrl+c Quit

The viewport auto-scrolls to follow the stream. Scrolling up pauses auto-scroll; pressing G resumes it.

Thinking / Reasoning Support

streamd rendering reasoning_content followed by the final answer

streamd supports models that expose their reasoning process. It handles two common patterns:

  1. reasoning_content field (OpenAI-compatible). Reasoning tokens arrive in a separate reasoning_content field in the SSE delta, used by models like Qwen, DeepSeek, and others.

  2. <think> tags. Some models wrap their reasoning in <think>...</think> tags within the regular content field.

Both patterns are detected automatically. Thinking content is rendered as an italic header followed by a blockquote, separated from the main response by a horizontal rule.

Use --no-think to hide reasoning output entirely.

Usage Info

streamd --info shows model and token usage

Pass --info (or -i) and streamd will print the model name, prompt/completion token counts, and (for Ollama) eval speed once the response completes. The info line goes to stderr so it doesn't pollute piped output.

Development

Contributions are welcome. Feel free to open issues or pull requests.

Build from source:

git clone https://github.com/Gaurav-Gosain/streamd.git
cd streamd
go build -o streamd .
./streamd --help

Regenerate README GIFs: the vhs/ directory holds VHS tape scripts and a Makefile that builds every GIF embedded above. See vhs/README.md.

Dependencies

streamd is built on the Charm ecosystem:

Library Purpose
glamour v2 Markdown rendering
bubbletea v2 TUI framework (alt-screen mode)
bubbles v2 Viewport component
lipgloss v2 Terminal styling
fang Styled CLI help

Star History

Star History Chart

GitHub Language Count GitHub Top Language Repo Size GitHub Issues GitHub Closed Issues GitHub Pull Requests GitHub Closed Pull Requests GitHub Contributors GitHub Last Commit

License

This project is licensed under the MIT License. See the LICENSE file for details.