[Plugin] Token Usage — Live Claude Code token tracking in your Obsidian sidebar

Disclaimer

Is this plugin open source? Yes
Is this plugin completely free? Yes
Is this plugin vibe-coded beyond the author’s ability to comprehend how it works? No
Community Directory: Token Usage


Hey everyone,

I’ve been using Claude Code daily for months and wanted to see my token consumption without leaving Obsidian or opening a separate dashboard. There was no plugin for that, so I built one.

The problem I solved

Claude Pro subscribers don’t have an organization API key, so you can’t pull usage data directly from Anthropic. Third-party dashboards exist, but they’re just another tab on another screen — exactly what I didn’t want.

How it works

Claude Code stores all session data as local JSONL files on your machine. Every message contains the model, timestamp, session ID, and token counts. Token Usage reads those files directly — no API key, no external requests, no data leaving your device.

What it shows

Directly in your sidebar, in real time:

  • Last Action — model, input, output and cache tokens for your most recent command
  • This Session — running total for the current Claude Code session
  • Today — all sessions combined
  • 7 Days — color-coded bar chart (green = low, red = high)
  • 30 Days — monthly overview

Install

Settings → Community Plugins → Browse → search for “Token Usage”

Or: GitHub - beolatn/TokenUsage: Live token usage tracking for Claude Code inside Obsidian · GitHub

One honest note

The concept, design and use case came from me. The actual code was written with Claude Code assistance — felt right to be transparent about that in a plugin that tracks Claude Code usage.

This is my first Obsidian plugin. Happy to hear feedback, bug reports or feature ideas.

1 Like

Here’s what it actually looks like in use — both the sidebar panel and the official plugin page.

The sidebar:

The 7-day bar chart shows intensity over time (green = low, red = high). The numbers you see here are real — this is my actual usage from an active week of working with Claude Code. Cache tokens dominate at scale, which I wouldn’t have known without this view.

The plugin directory:

Health: Excellent, Review: Satisfactory — live in the community directory since July 31st.

Happy to answer questions. And if you find bugs or want to request features, this thread is the right place.

Update — a lot has changed since v1.0.2

The initial release was a minimal sidebar: last action, session, today, 7-day chart. That’s it. Here’s what’s been added since.


5-hour session window
A rolling window matching Claude Code’s own rate-limit period. Shows Input, Output, C.Write, and C.Read as separate rows. The footer counts down to the next reset.

C.Write and C.Read — split display
Cache tokens are now two distinct rows throughout the sidebar, because they have very different cost implications. C.Write (purple) costs ~1.25× regular input. C.Read (amber) costs ~0.10× — ten times cheaper than reprocessing. The ratio between them is the Reuse Factor: how efficiently you’re reusing the same context across requests.

Model distribution
A stacked bar under the 7-day chart shows which model family you actually used — Haiku, Sonnet, Opus, Fable — colored consistently across the whole panel.

Dashboard
The chart icon generates a self-contained HTML file and opens it in your browser. 30-day summary cards, daily stacked bar chart by model, model distribution donut, request size histogram, top sessions table, and a cache efficiency section with C.Write vs C.Read over time.

Report
The document icon writes a Markdown snapshot directly into your vault — last action, session, today, 7-day and 30-day summaries, cache efficiency ratio. Configurable path in Settings.

Logo and visual polish
The plain text header is replaced by a proper logo — gradient text with a small bar chart icon. Cleaner and immediately recognizable.

Built-in Help panel
The “?” button toggles a full glossary without leaving Obsidian — tokens, C.Write, C.Read, Reuse Factor, 5h countdown, model colors, cost reference. A link at the bottom opens the full documentation page.

Help website
The glossary links to a dedicated documentation page — available in English and German, with automatic language detection based on your browser settings.


Current version is v1.4.1, available through the Community Plugin Directory — updates run automatically.


One more thing: this is still my first Obsidian plugin, and I genuinely wasn’t sure anyone would use it. The feedback and questions from this community since the initial post have shaped almost every feature listed above. So — thank you. If something is still missing or broken, the GitHub issues page is open and I read everything.

Update - Token Usage v1.5.0 — context labels, Back button, sticky header, and more

Hey everyone,

I’m back with a meaningful update. Token Usage v1.5.0 is live in the community plugin directory.

What changed

The biggest visible change is context sub-labels under each section title. Every time range now shows a short note explaining exactly what you’re looking at:

  • Last 5 Hour Session → “Rolling window · counts toward rate limit”
  • This Session → “Started today at 09:27” (or “Started yesterday · spans multiple days” if your session crosses midnight)
  • Today → “Calendar day · since midnight”

This came out of a real point of confusion I noticed: the three time views — 5h window, This Session, and Today — are independent cuts through the same data. They don’t nest automatically. A session in Claude Code can span multiple calendar days, so “This Session” can legitimately be larger than “Today.” The sub-labels make that visible at a glance. There’s also a new glossary entry explaining the relationship in full, and the help page has a dedicated section on it.

Other changes in v1.5.0:

  • ← Back button in the header when the glossary is open — no more hunting for the ? button to return to the data view
  • Logarithmic minibar scale — all four token types (Input, Output, C.Write, C.Read) are now visually readable even when they differ by several orders of magnitude
  • Sticky header — the logo and buttons stay pinned at the top when the panel is small or when you scroll down
  • Bugfix — the C.Write (Cache Write) bar was invisible due to a missing CSS class. Fixed.
  • GitHub artifact attestations — release assets are now cryptographically signed via GitHub’s attestation workflow

What’s next

v1.6.0 is in planning. The main feature is multilanguage support (i18n). English and German are already covered through the help page — the next step is bringing that into the plugin itself with a language selector in Settings and string files for community translations. French, Italian, and Spanish are the first target languages.

If you speak one of those languages and would be interested in contributing a translation once the infrastructure is ready, drop a reply or watch the GitHub repo — I’ll open a dedicated issue when it’s time.

Thanks for the feedback and downloads so far — appreciate it.

Nice idea. Reading Claude Code’s local JSONL files instead of relying on an API makes this feel much more practical for Pro users.

I’d be interested in a small warning when daily or 7-day usage suddenly spikes compared with the usual pattern.

1 Like

Thanks for the feedback — glad the local-first approach resonates.

The spike warning idea is interesting. All the data needed is already there (daily totals going back 30 days), so a rolling baseline comparison is technically straightforward. Something like a subtle indicator when today’s usage is significantly above your personal average — plan-agnostic, since it compares your current usage to your own historical pattern rather than a fixed limit.

I’ll add it to the backlog for the upcoming version 1.6 coming later in August.

Token Usage v1.6.0 — multilingual UI, automatic rate limit detection, and a community-suggested feature

Hey everyone,

Token Usage v1.6.0 is about to go live in the community plugin directory. This is the biggest update since launch, so here’s the full rundown.

Multilingual UI

The plugin now speaks English, German, French, and Italian. A language dropdown in Settings switches the entire sidebar and glossary instantly, no restart needed. French and Italian were each reviewed by a native speaker before release, not just machine-translated and shipped. More languages are in progress with community help.

Rate limit auto-detection

This is the feature I’m most excited about. Session and weekly rate limit hits are now detected automatically by reading Claude Code’s own local session files. No manual logging, no button to click. The plugin recognizes the exact moment a limit was hit and whether it was a session limit or a weekly limit, then shows you the token count that actually triggered it.

The dashboard now has a dedicated Rate Limits section: a table of every detected limit event with the relevant metric (5-hour window total for session limits, full billing-week total for weekly limits), plus empirical threshold estimates built from your own usage history. There’s also a 6-week consumption chart aligned to the billing cycle, with weeks where the weekly limit was hit visually highlighted.

None of this comes from Anthropic’s documentation, since the exact limits aren’t published. It’s all derived from your own local data.

Spike warning — straight from this forum

A member of this community suggested a while back that the plugin flag unusually high usage days. That idea is now live: an amber badge appears next to Today when daily usage is at least 2x your personal 29-day average. It compares you to your own historical pattern rather than a fixed number, so it works the same regardless of which plan you’re on. Thanks for the suggestion, it’s a genuinely useful addition.

Smaller improvements

  • Settings button in the header opens the plugin’s settings directly
  • Last Action now shows four colored chips instead of a plain-text line
  • All five time-range sections can be individually collapsed, and the state persists
  • A green indicator now shows when the 5-hour window has fully reset after a break
  • Fixed a bug where zero-token noise entries were throwing off the 5-hour countdown

What’s next

More community translations are underway, plus a longer-term usage archive so trends beyond 30 days become visible (Claude Code only keeps session data for a limited window). If you’d like to help translate into a language not yet covered, feel free to reply here or open an issue on the repo.

Thanks again for the feedback so far, this update genuinely came out better because of it.

1 Like

Update: v1.7.2 is out

Biggest release since the initial post. Highlights:

  • NextGen sidebar (opt-in, Settings → Sidebar appearance) — icon rail navigation (Today / Overview / Settings), a 7-day activity heatmap, and colored KPI tiles with trend sparklines. Classic sidebar stays the default, unchanged.
  • Vault Token Usage Controlling — the Dashboard’s new Projects view breaks token usage down by vault and sub-project, so you can track and compare consumption across multiple vaults (e.g. separate client workspaces) from one place. Sortable tables, plus a standalone Markdown export for billing.
  • Redesigned Dashboard — 5 KPI cards (weekly forecast, limit health, cache efficiency, daily velocity, focus score), a week status bar with on-track forecast, a period dropdown (30/60/180/360 days), and a new Reports tab.
  • Historical reporting beyond 30 days — daily usage is now archived directly in your vault, so long-range views keep working even after Claude Code rolls off its own local logs.
  • Configurable Claude data retention — control how long the original session log files stay on disk, right from plugin settings.
  • In-app “What’s new” popup — a short summary appears once after updating, reopen anytime via Command Palette.

Went through Community Plugin review without issues (only the expected filesystem-access warning, since reading local session files is the whole point of the plugin).

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

Update: v1.8.0 is out

  • Activity calendar (NextGen sidebar) — a month grid pinned to the bottom of every rail page, one colored dot per day sized against your own recent daily average (green below, amber around, red for a 2×+ spike). Navigate back through your history; toggle it off under Settings → Activity calendar
  • Claude desktop app usage now counts — the agent mode built into the desktop app runs Claude Code and writes the same JSONL session logs to its own location; the plugin now reads those too, so that consumption no longer goes missing from your totals and rate-limit estimates
  • Dashboard: expandable sub-project detail — the Projects view stays one row per vault by default; tick “Show sub-project detail” to expand any vault and see its per-subfolder token split inline, not only in the Markdown export
  • Clearer scope — a new “What is measured” glossary entry makes explicit that the plugin covers Claude Code everywhere, but not ordinary Claude chat (which writes no local token counts)

Went through Community Plugin review without issues (only the expected filesystem-access warning, since reading local session files is the whole point of the plugin).

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

Hi everyone,

and happy Monday.

I’m Björn, I built the Token Usage plugin (Claude Code token tracking in the sidebar, no API key needed). I only have Windows here, so I need a quick favor from a Mac or Linux user.

If you use Claude Desktop’s Agent Mode:

  1. Open Claude Desktop, use Agent Mode to do something small (e.g. ask it to create or edit a file).
  2. Open Terminal and run:
    ls -lat ~/.claude/projects/ | head -5
    This lists your 5 most recently changed session folders. Does one of them show a timestamp matching what you just did in step 1?
  3. Also run:
    ls -la ~/Library/Application\ Support/Claude/ 2>/dev/null
    What does this show — nothing, or some folder structure?

Just reply with what both commands printed, that’s all I need and kindly ask for. Trying to confirm whether Agent Mode sessions on macOS/Linux land in the same folder as regular Claude Code sessions, or somewhere separate like they do on Windows.

Thanks in advance and best from Germany…:wink:

Update: v1.9.0 is out

This one is about seeing where you stand against your rate limit, without hunting for it.

  • Limit Hero on the Dashboard — a banner at the very top: your current 5-hour session, today against a fair daily share of your estimated weekly limit, and this billing week so far. The estimates are empirical (Anthropic doesn’t publish the limits) and get more precise the longer you use Claude Code. If there isn’t enough data yet, each panel says so instead of guessing.

  • Limit Pulse in the sidebar (NextGen layout) — the same Today and This Week numbers right at the top of the Today page, visible the moment you open the sidebar. Same calculation as the Dashboard, so the two can never disagree.

  • Activity calendar — the tooltip now lives on the whole day cell instead of just the small dot, and you can click any day to add a short personal note about that day’s usage (“big refactor, expected spike”). Notes stay local, in the plugin settings.

  • macOS and Linux — the core reading of ~/.claude/projects/ has always been platform-neutral, and I have now confirmed it running on a Mac. The Claude Desktop Agent Mode finder from v1.8.0 turned out to be a Windows-only necessity because of the MSIX sandbox, so I scoped it accordingly and removed a path guess for macOS that I couldn’t back up.

If you use Agent Mode on macOS or Linux and notice usage that doesn’t show up, please tell me. That part is based on documentation rather than my own test on real hardware.

Went through Community Plugin review without issues (only the expected filesystem-access warning, since reading local session files is the whole point of the plugin).

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

This is a bigger release than the number suggests, because most of it is corrections. Three things the plugin believed about Anthropic’s rate limits turned out to be wrong, so if your numbers look different after updating, that is the point.

What was wrong and is now fixed

  1. There is no daily limit. Earlier versions compared today against a “fair daily share” of the weekly limit, a number I invented by dividing it by seven. Today is now measured against your own 29-day average per active day. It claims no quota, it just tells you whether today is busier or quieter than usual.

  2. The 5-hour window is anchored, not rolling. It opens with your first message and runs exactly five hours; the next one starts only after that, in fixed blocks, independent of the weekly reset. I found this when my weekly gauge reset on a Sunday at 18:00 and the 5-hour window did not. My first explanation of it was wrong as well, so the docs were corrected twice.

  3. Only input and output count toward a limit. I tested a weighted model against 80+ observed limit hits, and the best fitting weights for both cache types were zero. The cache rows are still shown because they are real volume, they just don’t move the gauge.

A fourth one turned up a few days before release: the gauge and the estimate behind it were measured differently, a fixed window for the gauge and a sliding five-hour look-back for the estimate. On my own data that made the estimate 341.5K instead of 290.2K, so the ring read too low. Both now use the anchored window. The estimate also comes with a usual band, the middle half of your observed hits (mine is 214K to 364K), because a single number suggests more precision than the data has. Other Claude use the plugin cannot see, such as claude.ai in the browser, draws on the same limit.

New

The activity heatmap is built around your billing week, with twelve 2-hour cells per day. The weekly reset hour is now detected from your own session history instead of being guessed. There is a CSV export for projects, daily detail and key figures, the calendar shows two months, and the UI is available in Spanish. The colours follow one rule now: a colour either identifies a token type or signals status, never both. The Classic sidebar is gone, what used to be NextGen is simply the sidebar.

The help page (docs and glossary, now also in Spanish) is updated for 2.0.

Community Plugin review is through. It shows two warnings: the expected filesystem access, since reading local session files is the whole point, and a CSS lint note about :has that I will clean up in 2.1.

What’s next

2.1 is planned for around the end of October. Among other things I want to check whether individual models have their own weekly limit, since that could skew the weekly estimate. If you notice one model hitting a weekly limit earlier than the others, I would like to hear about it.

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

Hej there,

Björn here and thanks, this is a very useful detail.

I checked it against my own session logs: the cache_creation object is there on every cache write, the one hour and five minute parts add up exactly to the total, and about 90 percent of my written tokens are the one hour kind. Subagent writes are all five minutes, just as you describe.

So for a subscription the 1.25x in the C.Write explanation is incomplete, and I will correct the text in the next release and look at splitting the row.

One clarification: the gauges and the limit estimate only count input and output, cache has weight zero there (I measured that against more than 80 observed limit hits), so this affects the cost explanation rather than the limit numbers.

I will also re-run that measurement with the one hour and five minute parts separated to be sure neither of them counts.

Best from Germany, 2.1 will come and thumbs up!

Hi everyone,

2.1.0 is out, and your numbers will drop after updating. Here is why, starting with what we got wrong.

1. Long responses were counted many times over. Claude Code writes one response to its log once per content block, for long output up to about 75 times, and every line repeats the full token counts. The plugin added them all up. In one measured half hour the sidebar showed 1.31M tokens against a real 70K. Each response is now counted once.

2. Subagent work was never counted. Claude Code logs subagents in a subfolder of the session, and the plugin never looked there. Small on average, but up to 47K tokens inside a single 5-hour window that hit its limit. Included now.

3. Cache does count. We were wrong about this in 2.0.0. The 2.0.0 notes said cache reads and writes do not count toward a limit, “verified against 80+ observed limit hits”. That analysis ran on the double-counted totals from point 1, so it could not show what it claimed. Measured since against the official percentages Claude Code reports: cache writes clearly count toward the 5-hour window, cache reads a little. Example from our own data: a long session that had to rebuild its cache after a pause used 17% of a fresh window on just 4.4K input and output tokens. The plugin still counts input and output only, so the official percentage can run ahead of it, most of all at the start of a window. The help now says so.

4. The weekly estimate could sit far too low. It is the lowest week that ever reached the cap. On our data that was 1.14M tokens against about 2.7M implied by the official percentages, and the sidebar showed 141% while Claude Code said 61%.

5. “29-day average” was not what we computed. Today was compared against every stored day, not 29. The labels now say what is actually computed.

6. Cache prices were incomplete. We wrote that a cache write costs about 1.25x the input price. That is the 5-minute cache. The 1-hour cache costs 2x, and it is the usual kind for Claude Code on a subscription, about 90% in our own logs, while subagents write 5-minute caches. A user here in the thread pointed this out after the 2.0 post, thank you. Glossary, README and help now follow the official pricing page as of October, and hovering over a C.Write row shows the 1-hour and 5-minute split. Cache reads on Opus 5.5 and Sonnet 5.5 cost 0.05x rather than 0.1x, and the price table on the help page now has the newest models.

Changed: the Today ring is neutral grey. There is no daily limit, and traffic-light colours next to two real limits read like a warning. A busy day is a change in how you work, not a risk.

New, optional: Claude Code hands every status line script the official 5-hour and weekly percentages of your plan. A small script in the extras folder of the repository on GitHub shows them in your status line and logs them on your machine. With it, the plugin starts the 5-hour window when the official window starts and shows exactly the official percentage at every reading, counting on with your tokens in between. Without it, nothing changes. Setup is described in the README and on the help page.

Known limits: between two readings the plugin adds input and output only, so a cache rebuild shows up with the next reading. Archived days older than your retention window keep their old figures, because the logs to recount them no longer exist. Whether 1-hour and 5-minute cache writes weigh differently on the limit is still open: in every segment we could measure, all cache writes were the 1-hour kind.

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

Hi everyone,

2.5.0 is out. The version jumps from 2.1 to 2.5 because the core of the plugin changes, and that change starts with a decision of ours that was wrong.

Percentages now come from Anthropic only. Up to 2.1 the plugin estimated a percentage for the 5-hour window and for the week from your own limit hits. We put that estimate next to the official figures for eleven days (37 readings, 6 to 17 October). For the 5-hour window it was off by 36 points on average, and at the moment a window was officially full, our ring showed anything between 61 and 217 percent. How fast a window fills up depends heavily on how much context a session carries, and the local logs cannot tell that reliably. The rings suggested a precision they never had. That was our decision, and it was wrong.

From 2.5 on, the 5-hour and week rings show a percentage only when it comes from Anthropic, together with the time it was read. That needs the optional feed: a small file with the official percentages Claude Code reports, written by one of two scripts in the extras folder on GitHub. Between two readings the week is carried forward with your counted tokens and labelled as projected, because the weekly limit proved stable in the same measurement (1.2 points off on average). Without the feed you see what is certain: counted tokens, the time to the reset, and the span at which your 5-hour window has filled up so far. The Today ring now shows a multiple of your usual day instead of a percentage.

If you work inside Obsidian: there is no status line there, so readings come from a scheduled poll, which is a tiny real request each time. New in 2.5: started with --only-when-active, the poll asks only while you are actually working, so it can run every 30 minutes without opening a 5-hour window of its own. In my own test before the release, three fixed polls a day left the 5-hour ring grey most of the time, which is why this exists.

Security. Our own check in October found two gaps, and we want to name them plainly. The dashboard put folder and model names into the page unescaped, so a crafted folder name, for example of a cloned repository, could have run script inside the dashboard page in your browser. CSV exports did not neutralise formulas, so a text cell starting with = or @ could have run as a formula in a spreadsheet. Both are fixed, and the release workflow now pins its actions to fixed commits. We have no indication that any of this was ever used. The sidebar inside Obsidian was not affected.

Fixed:

  • The weekly reset was an hour off after the switch to winter time. Anthropic resets at a fixed moment in UTC, and the plugin now keeps it as exactly that.
  • With usage credits, the weekly limit derived from the feed grew with every credit token. Readings at 100% and anything after them in the same week are no longer used for it.
  • The trend lines of the 7-day tiles on the Analytics page were flat, partly since 2.0. We only noticed it on the new store screenshots; the old ones already showed it.
  • The CSS lint note about :has from the community review is gone. I promised that fix for 2.1 in this thread and missed it twice. Sorry about that.

Closing a point from 2.1.0.** In the 2.1.0 notes we listed as open whether 1-hour and 5-minute cache writes weigh differently on the limit. It stayed unmeasurable: in every segment we could measure up to 17 October, practically all cache writes were the 1-hour kind. Since 2.5 the plugin estimates no limits at all, so the question no longer affects any figure it shows.

Also new: the help page is rebuilt, with the same sections in English, German, French, Spanish and now Italian.

As always: feedback, bug reports and feature requests are very welcome here or on GitHub.

Hi everyone,

2.5.1 is a small patch for two mistakes of ours, and I want to be upfront about both.

Obsidian froze for seconds at a time. On every refresh the sidebar read all Claude Code session logs again, on Obsidian’s main thread, and the file watcher started a refresh after every write to the session log, which a busy session does many times a minute. On my own machine (245 log files, 1.1 GB) each refresh blocked Obsidian for about four seconds and came every four to six seconds. Long histories and Claude Code inside Obsidian made it worst. I only caught it this week, when my own window kept stalling. That one is on us, and I am sorry if it hit you too.

Now each log is parsed once, and after that only what was added gets read. A refresh takes about a tenth of a second instead of four, and while a session is busy the sidebar refreshes at most every 30 seconds.

Our Windows guide for the poll opened a console window on every run, every 30 minutes with our recommended setup. The guide now starts it through conhost --headless, with a short command that switches an existing task over. Two caveats, plainly: Microsoft does not document this switch, and some security software flags hidden console starts. If yours does, the plain start is still in the guide. We now also recommend every hour instead of every 30 minutes. Both are on the help page and in the extras guide on GitHub.

Feedback and bug reports are, as always, very welcome here or on GitHub.

Are you running Claude mostly inside Obsidian?

1 Like

Yes, Obsidian is my local umbrella for pretty much everything, and Claude Code supports that setup really well. I wrote a book in it, I maintain this plugin in it, and I use it to keep my own business organised. That is also why the freeze hit me so hard: lots of long Claude Code sessions inside Obsidian.