A Tiny LLM Request Recorder I Use to Reproduce Production Failures
The article describes a lightweight LLM request recorder built by a developer to address the difficulty of reproducing production failures. The author notes that LLM failures are often easy to describe but hard to reproduce, citing examples like empty answers, disappearing tool calls, or provider rejections. Standard logs showing '400 Bad Request' are deemed operationally useless. The recorder, built around fetch, captures a unique request ID, timestamp, duration, URL, model, sanitized request body, HTTP status, raw response body, and network or timeout errors. It deliberately omits the Authorization header and redacts prompt content by default; full payload capture requires explicit enabling to avoid creating worse problems than the bug being investigated. The tool runs on Node.js 18 or newer with no external dependencies. It stores enough information to inspect or replay a failed call without logging the API key.
Provides a simple, dependency-free way to capture exact LLM request shapes for debugging.