token-ledger
Installation
SKILL.md
Token Ledger (SQLite)
What this skill provides
- A SQLite ledger at
~/.openclaw/ledger.dbwith per-call usage rows. - A watcher daemon that tails OpenClaw session JSONL files and writes usage into SQLite (near-real-time).
- Deterministic, low-token SQL-first finance reports (no JSONL rescans).
This skill is designed to be public/reusable: prefer stable paths, versioned pricing (price_versions table), and minimal assumptions.
Canonical usage definitions (do not mix these)
input_tokens: uncached input tokens for the call (can be tiny)cache_write_tokens: tokens written to cache (can be huge)cache_read_tokens: tokens read from cache (can be huge)output_tokens: generated tokens- total_context_tokens (effective prompt size) =
input_tokens + cache_write_tokens + cache_read_tokens