kcode-k1-codex-token-usage 0.1.0

Pure decoding of Codex token-usage notifications for K1
Documentation
1
2
3
4
5
# kcode-k1-codex-token-usage

`decode_token_usage_updated(Value) -> TokenUsageUpdated` decodes the exact `thread/tokenUsage/updated` notification. `TokenUsageUpdated` is `Absent`, `Malformed(kcode_k1_codex_conversations::Error)`, or `Valid(TokenUsage)`. `TokenUsage` contains public `scope`, `total`, `last`, and `model_context_window` fields; `TokenUsageScope` has public `thread_id` and `turn_id` fields; `TokenUsageBreakdown` has public `input_tokens`, `cached_input_tokens`, `cache_write_input_tokens`, `output_tokens`, `reasoning_output_tokens`, and `total_tokens` fields.

Decoding allocates only the returned strings and is linear in their combined length for a fixed-size notification.