I kept hitting jq: parse error on AI streams, so I built sjq
Description and use
sjq is a CLI tool that parses server‑sent event streams from LLMs, outputting each event in a concise, readable line with timing metrics, replacing bulky JSON envelopes.
Problem
Parsing OpenAI-compatible server‑sent event streams with jq fails because the stream is not JSON.
Outcome
sjq transforms noisy SSE envelopes into readable, delta‑focused lines with timing metrics, improving debugging and monitoring of LLM streams.
Workflow
- 1. Install sjq via Homebrew or cargo.
- 2. Run
sjq curl -s $BASE/v1/chat/completions -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"model":"gemini-4-argon","stream":true,"messages":[{"role":"user","content":"hi"}]}' - 3. Observe per‑event output lines with content, timing, and labels.
- 4. Use output for debugging provider latency or content inspection.
Evidence
jq: parse error: Invalid numeric literal at line 1, column 9
sjq — jq, but for AI streaming. A small Rust CLI that parses OpenAI-compatible server-sent event streams and prints one short line per event, showing only what each event added.
Instead of 99% envelope JSON, you watch the actual content arrive — plus a timing line: TTFT, total, tokens/sec.
brew tap vivgrid/tap brew trust vivgrid/tap # Homebrew 6+ requires trusting third‑party taps brew install sjq
Or from source: cargo install --git https://github.com/vivgrid/sjq (one dependency: serde_json).
- Record date: 2026-10-16T01:41:16.737Z