Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

I kept hitting jq: parse error on AI streams, so I built sjq

说明与用途

sjq 是一个 CLI 工具,用于解析 LLM 的服务器发送事件流,按事件输出简洁可读的行,并提供时间指标,替代冗长的 JSON 封装。

问题

Parsing OpenAI-compatible server‑sent event streams with jq fails because the stream is not JSON.

结果

sjq transforms noisy SSE envelopes into readable, delta‑focused lines with timing metrics, improving debugging and monitoring of LLM streams.

工作流

  • 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.

证据

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).

来源

  • 记录日期: 2026-10-16T01:41:16.737Z