Björn-Olaf Lange31 downloadsReal-time Claude Code token tracking inside Obsidian — sidebar with 5 time ranges, Cache Write/Read split, 7-day model chart, HTML dashboard and built-in glossary. No API key needed.
Token Usage is an Obsidian plugin that tracks Claude Code token consumption from locally stored session files.
Instead of relying on API access or external dashboards, Token Usage reads Claude Code's local JSONL files and displays real-time token statistics directly inside Obsidian — broken down by type, time range, and model.
As Claude Code usage grows, understanding where tokens actually go becomes important for both cost awareness and workflow optimization.
Most existing solutions require organization-level API access or live in separate dashboards outside your daily workflow.
Claude Code already stores detailed usage information locally in JSONL session files. Those files contain all token data, timestamps, session identifiers, and model information.
Token Usage brings those insights directly into Obsidian, where many users already manage their projects, notes, and knowledge base.
Token Usage scans Claude Code session files stored at ~/.claude/projects/ and extracts token data from every recorded interaction.
Example JSONL entry:
{
"input_tokens": 3,
"cache_creation_input_tokens": 16926,
"cache_read_input_tokens": 0,
"output_tokens": 252
}
The plugin aggregates all four token fields across sessions and time ranges. All calculations run locally on your device.
A live file watcher detects new activity the moment Claude Code writes a response. A configurable fallback polling interval runs in parallel.

Real-time Claude Code token usage in the Obsidian sidebar.
A rolling window covering the past 5 hours — matching Claude Code's own rate-limit period. Shows Input, Output, C.Write, and C.Read as separate rows.
Four time-range sections, each showing the same four token rows with a small intensity bar for quick visual comparison.
A stacked percentage bar showing the model distribution across the past 7 days, colored by model family:
| Model | Color |
|---|---|
| Haiku | Cyan |
| Sonnet | Blue |
| Opus | Purple |
| Fable | Amber |
| Other | Gray |
Cache Write (C.Write) and Cache Read (C.Read) are shown as separate rows throughout the sidebar because they have very different cost implications:
The ratio C.Read ÷ C.Write is the Reuse Factor. A high value means the same context is being reused efficiently across many requests.
The dashboard button in the sidebar header generates a self-contained HTML report and opens it in your default browser.
The dashboard includes:
The dashboard uses Chart.js (loaded once from CDN) and works offline after the first load.
The "?" button in the sidebar header toggles between the data view and a built-in glossary. The glossary explains:
A link at the bottom of the glossary opens the full help page at langeatn.de/docs/token-usage/ in your browser. The page is available in English and German.
The "Create Token Usage report" command (also available via the document icon in the sidebar header) writes a Markdown report file to your vault. The report covers:
The report path is configurable in Settings.
main.js, manifest.json, styles.css<vault>/.obsidian/plugins/token-usage/After enabling the plugin:
No additional setup, API keys, or cloud services required.
| Command | Action |
|---|---|
| Open Token Usage | Opens the sidebar panel |
| Create Token Usage report | Writes a Markdown report to your vault |
| Open Token Usage dashboard | Generates and opens the HTML dashboard |
| Setting | Default | Description |
|---|---|---|
| Auto-Refresh (seconds) | 30 | Fallback polling interval in addition to the live file watcher |
| Report path | Token Usage Report.md | Vault-relative path for the generated Markdown report |
| Dashboard path | Token Usage Dashboard.html | Vault-relative path for the generated HTML dashboard |
Token Usage is built with a local-first philosophy.
Your Claude Code usage data stays on your machine.
Version number in the sidebar footer shows an outdated version after an update.
This is not a code bug. Obsidian caches the loaded plugin manifest in memory. Toggling the plugin off and on may not fully reinitialize the manifest object. Fix: perform a full Obsidian restart after updating the plugin files. The correct version will display after restart.
Contributions, bug reports, feature requests, and suggestions are welcome.
If you encounter a problem or have an idea for improvement, please open an issue in the GitHub repository.
Full documentation and glossary: langeatn.de/docs/token-usage/
MIT License — see the LICENSE file for details.
Built to answer a simple question:
"Where did all my tokens actually go?"