sjq: A CLI That Renders AI Server-Sent Event Streams Readably
A developer found that piping AI streaming responses into jq fails because server-sent events are a line-based framing protocol, not JSON. They built sjq, a small MIT-licensed Rust command-line tool that parses OpenAI-compatible SSE streams from chat completions and responses endpoints. The tool prints one short line per event showing only the newly added content, along with timing metrics such as time to first token and tokens per second. It also handles tool calls, reasoning content, refusals, logprobs, and multiple choices, and it can be installed via Homebrew or Cargo.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in