In this article
Read timings from the regular response or the final message_delta event and measure canceled streams separately.
The llama.cpp b12855 prerelease, published on November 30, adds a timings object to Anthropic-compatible requests handled by its local server. The upstream change says consumers such as llama-swap could otherwise receive no usable prompt or generation speed for this endpoint. The feature changes where measurement data appears. It does not change the timing behavior of Anthropic’s hosted service.
Inspect both response shapes
A regular response to /v1/messages includes the object in its body. In a streamed response, it appears in the final message_delta event. The subsequent message_stop event still carries no timing data. A client that looks for metrics only when it sees the stream’s stop event will miss values even when the server sent them successfully.
Preserve absent measurements
Track a normal completion and a stream canceled before its final delta as separate outcomes. A missing server timing cannot be safely converted to zero tokens per second. Record a client-side clock for observed duration and time to the first visible token. Those measures include effects that server prompt and generation rates may omit, such as client buffering or transport.
Verify the monitoring path
Send a small fixed prompt with streaming enabled and disabled. Inspect the raw response and confirm that your collector emits one timing observation for each complete request. Then cancel a stream and confirm that metrics distinguish the incomplete run. Compare throughput between API routes only after confirming that the collector extracts equivalent fields under equivalent cache and load conditions.
Report throughput with its denominator
A prompt speed can change when the server reuses a prefix or processes several requests together. Keep separate records for cached and uncached requests. Capture the prompt length, generated length and concurrency alongside each timing. In a dashboard, pair completion throughput with the share of streams from which a timing was available. A recent change in cancellation rate can shift that share before it affects overall service performance. For a capacity test, pin a build and compare the same sequence of workload runs across routes.
Sources
Related reading
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.