Skip to main content

Module usage

Module usage 

Source

Structs§

HookExecution
A single hook execution event from a type: "attachment" JSONL record where attachment.type == "hook_success".
ModelPricing
Pricing per 1M tokens (USD) by model family.
ParsedJsonl
Combined result from parsing a single JSONL file.
SessionUsage
Usage summary for a single session, returned to the frontend status bar.
UsageEntry
Flat row representing a single completed assistant turn.

Functions§

context_window_for_model
encode_project_path
Encode a project path the same way Claude Code does.
find_current_session_jsonl
Find the JSONL file for the current session by looking up Claude Code’s active sessions directory, matching on project path. Falls back to finding the newest JSONL created after spawned_at.
parse_jsonl_entries
Parse a single JSONL file into one UsageEntry per unique message.id.
pricing_for_model
Hardcoded as of 2025-02. Requires a code change + release when Anthropic updates pricing.
reduce_session
Reduce a list of UsageEntry for a single session into a SessionUsage.