
Demo project. An offline test provider stands in for the model, and the Claude streaming provider is included. A production-style API in front of an LLM. POST /v1/chat streams output as Server-Sent Events (or returns one JSON response), with a request ID on every response. A background writer fed by a bounded queue turns the streamed chunks into one JSON log line per request, and when the queue is full, writers wait (backpressure) instead of dropping logs. Each request gets an OpenTelemetry span with request ID, time to first token, chunk count and status. A provider failure mid-stream becomes an SSE error event, is logged and is counted in /metrics. Health and metrics endpoints report requests, errors and average time to first token. 7 automated tests cover streaming, request-ID propagation, lossless logging, mid-stream failure, validation and the Claude provider with a stubbed client.
0 likes · 0 views · Nov 23, 2026
Built a streaming LLM API with queued structured logging, OpenTelemetry tracing, error handling and metrics.