Incremental SSE usage extractor for Anthropic-messages-shaped streams.
Shape assumptions (based on the documented Anthropic streaming format; verify against the live API before production use — see README):
message_start
message.usage.input_tokens
message_delta
usage.output_tokens
delta.stop_reason
The parser is passthrough-safe: it never modifies bytes, only observes. Unknown or malformed events are ignored.
Incremental SSE usage extractor for Anthropic-messages-shaped streams.
Shape assumptions (based on the documented Anthropic streaming format; verify against the live API before production use — see README):
message_startevent carriesmessage.usage.input_tokensmessage_deltaevents carry cumulativeusage.output_tokensmessage_deltathat ends the message carriesdelta.stop_reasonThe parser is passthrough-safe: it never modifies bytes, only observes. Unknown or malformed events are ignored.