Skip to content
AnayGarodiaPublic

About

Watch a Server-Sent Events / LLM stream in your terminal — reassembled text, raw frames, and timing, in one command.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

sse

Watch a Server-Sent Events / LLM stream in your terminal — reassembled text, raw frames, and timing, in one command.

If you build on OpenAI, Anthropic, Ollama, or any text/event-stream API, you know the drill: curl -N a streaming endpoint and squint at a firehose of raw data: {...} frames, with the actual answer split across dozens of token deltas and no idea how fast it's going. sse fixes that.

$ sse --preset openai -d @chat.json
Hello, world!

5 frames · 4 tokens · TTFT 240ms · 47.0 tok/s · 1.2s total · [DONE]

That's the whole point: point it at a stream, see the answer assemble live, and get TTFT / tokens/sec for free.

Install

go install github.com/AnayGarodia/sse/cmd/sse@latest

Or grab a binary from the releases page.

Usage

Any SSE endpoint:

sse https://example.com/events

An LLM API, via a preset (fills in the URL, headers, and how to read token deltas):

export OPENAI_API_KEY=sk-...
sse --preset openai -d @chat.json

Raw frames only, pipe-friendly:

sse --raw https://example.com/events | grep token

Flags

Flag Meaning
-d <body> request body, or @file to read from a file (implies POST)
-H 'Name: Value' extra header (repeatable)
-X <method> HTTP method (default GET, or POST with a body)
--preset <name> provider preset: openai, anthropic
--raw print raw frames only, no live view
--version print version

Presets

A preset knows a provider's endpoint, headers, and where the text token lives in each event. With one, sse assembles the reply for you instead of dumping JSON.

Adding a preset is the best first contribution here — it's a few lines. See CONTRIBUTING.md.

How it works

sse is a spec-correct Server-Sent Events parser (multi-line data:, comments, event:/id:/retry:, CRLF, the OpenAI [DONE] sentinel) wired to a streaming HTTP client, with a small renderer that reassembles token deltas and tracks timing. No dependencies beyond the Go standard library for the core.

License

MIT

About

Watch a Server-Sent Events / LLM stream in your terminal — reassembled text, raw frames, and timing, in one command.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages