go-llm-stream

PublicGitHub · MIT licence · v1.3.0

An open-source Go library, for reading the JSON a language model sends piece by piece.

What it does

  • Each field can be used as soon as it is complete, without waiting for the end of the answer.
  • When the answer is cut off or wrapped in markdown fences, it repairs it: open strings, arrays and objects are closed.
  • The parser state can be saved, then resumed after a reconnect.
  • It reads OpenAI-shaped and Anthropic-shaped streams.

Reliability

  • The scanner and the repair step are fuzz-tested and cross-checked against encoding/json.Valid.

What it does not do

  • In my June 2026 benchmark, the standard library’s Decoder was 2 to 3 times faster than go-llm-stream per operation, on chunked input.

Terminal · camsh

camsh, a small shell written in TypeScript, runs in your browser. Its files, read-only, are the content of this site. Type help, Tab to complete, Escape to close.

Try: