Claude Code UsageThe local Claude Code and Codex usage coach in your status bar. Not a billing tool. Claude keeps its cost and quota views; Codex adds provider-specific token and behaviour insights through the same dashboard tabs, render functions, and visual system without pretending both providers expose the same data.
🌐 Multi-language documentation: English · Deutsch · 繁體中文 · 简体中文 · 日本語 · 한국어 · Português (Brasil) · Bahasa Indonesia Screenshotsv2.3 Claude, Codex and CompareThe five v2.3 images below are reproducible captures of the production dashboard renderer with synthetic fixtures and VS Code Light+/Dark+ theme variables, not personal usage or billing evidence. Native VSIX installation is verified separately.
Today and Last 30 days share the configured calendar timezone. CLI usage is counted only when normal persistent sessions leave usage-bearing local logs; calls made without session persistence cannot be reconstructed.
The corrected Codex overview uses one configured-timezone calendar model for Today, Last 30 days, months, models, effort, and all-time totals.
Observed quota windows retain reset evidence locally. A valid used fraction can produce labelled total and unused subscription-durability estimates, including for the current window. Approximate evidence remains visible with low confidence. Period details start collapsed; expand them to inspect the numeric evidence.
Compare combines provider daily activity without double-counting Codex cached input or reasoning. Its preview-first share studio offers an Academic Violet default, curated/custom colors, deterministic local SVG, and privacy-safe Markdown. It is enabled by default and can be hidden with the single sharing workspace setting. Card settings sit below the preview; intensity can use quantile, logarithmic, or linear scaling. The metric is activity volume, not productivity or billing.
Projects now adds a Token-only 30/90-day project × day heatmap and stacked daily trend for both providers. Exact tooltips, explicit coverage, bounded rows, and an Other-projects tail keep the view auditable without rereading source logs. Claude status barCodex uses a compact Today token usage item and a separate remaining quota
item: observed 36% weekly utilisation displays
Today's cost · current-session cost · 5-hour and weekly quota utilisation. Hover the quota indicator for a breakdown:
Real ⚙ Settings offers a compact quota-format dropdown: Built-in (default), 5-hour only, Weekly only, or Custom. Only Custom reveals the template field. Dashboard
Click the status bar to open the full dashboard. Stacked token-composition chart, hourly breakdown, cache hit rate, cost composition by token type, plus per-model and per-day tables below. Content tab — where your tokens actually go
Estimated breakdown of which content consumes tokens — your prompts vs.
tool results (by tool) vs. assistant output / thinking. This is the lever
for optimising your usage. Scoped to the last 30 days
( AI advice — evidence first, sending optionalv2.3 keeps one readable path from a local observation to its evidence, recommendation, action, feedback, and guarded result. It is off by default. Local evidence appears before any model is involved; Helpful, Not helpful, and Applied stay on this device. Once enough reliable, similar before/after tasks exist, the card reports the frozen comparison result; otherwise it says that the evidence is insufficient. Each recommendation can be snoozed for a bounded period; it leaves the default summary and returns after expiry or when you choose to show it again. AI personalisation is a separate choice. Aggregate-only is the default and prompt samples remain off until separately allowed. The extension prepares the complete request once and shows its exact JSON, byte count, and SHA-256. Preview sends nothing; Send this exact request is a second explicit action, using the same canonical bytes and your own configured key/endpoint. Claude Code OAuth credentials are never used as a generative backend. A flavour of what it returns (illustrative):
Usage Optimizer
Paste a rough, half-formed request; get back one clean, paste-ready prompt (plain text, no Markdown) plus a recommended reasoning effort / thinking / model shown as chips. Three optional toggles refine it (flag vague references · condense long pastes · suggest a style direction). Experimental, off by default; only the text you paste is included — never your files or the terminal. It now uses the same full-request preview and separate explicit Send action as AI advice. What's new in 2.4
This is a production-renderer capture with synthetic usage and VS Code theme variables, not evidence from an installed VSIX or a real account. The Claude Share Card and 360 px dark-theme view use the same fixture boundary. What's new in 2.3
What's new in 2.2
What's new in 2.1
What's new in 2.0
Full changelog: CHANGELOG.md. Closes upstream issues #7, #10, #11, #13. InstallVS Code MarketplaceSearch for
Cursor / Windsurf / Antigravity (Open VSX)Same extension is published at the Open VSX Registry: GrowthJack.claude-code-usage. From a
|
| Setting | Default | What it does |
|---|---|---|
language |
"auto" |
UI language: auto / en / de-DE / zh-TW / zh-CN / ja / ko / pt-BR / id. |
dataDirectory |
"" |
Custom Claude data dir; empty = auto-detect. |
codex.dataDirectory |
"" |
Custom Codex home; empty = CODEX_HOME or ~/.codex. |
Everything else — refresh interval, status-bar items, number/date formatting,
project grouping, content analysis, and all the AI advice / Optimizer options —
is in the dashboard's ⚙ Settings tab. Upgrading keeps your existing values: a
one-time migration copies them out of settings.json on first launch.
For a custom quota status-bar layout, choose Custom in ⚙ Settings. The
template accepts {5h.pct}, {wk.pct} (or {7d.pct}), and
{model:Fable.pct}; each window also supports .label and .reset.
Reset styles include :decimal, :units, :clock, and :at, for example
{5h.pct} | {wk.reset:at}. Missing windows and their separators are omitted.
The built-in choice leaves the existing quota options unchanged.
How costs are calculated
The status-bar cost is Σ (tokens × per-million rate) across input,
output, cache-write and cache-read, summed by model.
- Per-million rates come from the bundled pricing table, which is verified against the public Anthropic pricing page and supplemented with reference rates for non-Anthropic models that may appear in proxied setups.
Refresh Model Pricing(command + button in the dashboard) pulls live prices from LiteLLM's public dataset as runtime overrides.- Unknown model snapshots are priced against the current tier of their detected family (Opus / Sonnet / Haiku / GPT / Gemini / DeepSeek / Kimi / GLM / Qwen) instead of falling back blindly.
Claude transcript totals are counted by response identity, not by JSONL
row. One response can produce both a thinking row and a text row carrying
the same messageId, requestId, and complete usage vector. The extension
keeps the largest vector for that response once; Claude Code's stats-cache
adds the rows. The two totals can therefore differ.
What the status bar does not know:
- Your actual Anthropic invoice (discounts, free credits, plan caps).
- Whether your proxy provider charges different rates.
- Anything not recorded in your local
.jsonllog files.
The 5h / weekly quota indicator is different — it queries Claude
Code's real /usage endpoint via the OAuth session and shows the actual
percentage Anthropic is tracking for your account. That number is
authoritative.
Privacy
The complete user-facing inventory, retention rules, clearing behavior, and remote boundaries are in Local data and privacy (简体中文).
| Data | Stored locally | Remote behavior | Clear path |
|---|---|---|---|
| Claude/Codex source logs | Provider-owned and read-only; never copied wholesale | None by default | Managed by the provider tools, not deleted by this extension |
| Codex derived index | Bounded pseudonymous numeric/structural aggregates | None | Rebuild or clear derived index |
| Quota observations | Bounded anonymous window facts; no raw account ID | Claude quota fetch only when enabled; Codex evidence stays local | Clear by provider/account epoch or all |
| UI/share preferences | Tab/filter state plus optional title/range and GitHub destination strings | Publish only after exact explicit confirmation | Reset UI or sharing preferences independently |
| Advice data/key | Bounded aggregate evidence; key only in SecretStorage | Exact previewed request only after separate Send | Clear advice data and key independently |
- All Claude token / cost / session analysis runs locally by reading your
~/.claude/projects/**/*.jsonlfiles. - Codex usage records are discovered only from
sessions/**/*.jsonlandarchived_sessions/**/*.jsonlbelow your Codex home. Separately, the extension streams exactly$CODEX_HOME/session_index.jsonlfor theid→thread_namemapping used by truthful thread titles. Absolute paths in those titles are redacted and the titles remain memory-only. Credentials, databases, and unknown files are not read. Usage-record JSONL lines are streamed and temporarily parsed only for allowlisted metadata; prompt, response, command, and tool-argument fields are not inspected or used for analysis and are never retained. Deterministic insights make no network request. - The Codex persistent index stores machine-salted pseudonymous keys, numeric and structural aggregates, and sanitized project, directory, agent, model, effort, role, time, and quality metadata. It never stores raw IDs, full paths or repository URLs, thread titles, or conversation bodies.
- The quota indicator calls
api.anthropic.com/api/oauth/usageusing Claude Code's existing OAuth token. If that token has expired, the extension sends the existing refresh token toconsole.anthropic.com/v1/oauth/tokenand writes the refreshed credentials back to the selected Claude credential file or macOS Keychain item. See Local data and privacy. - AI advice and the Usage Optimizer are the only features that call a
model — and only after you preview and explicitly send a prepared request.
Advice defaults to allowlisted aggregates; prompt samples and optional user
context require separate consent. The Optimizer includes only the text you
paste into it (never your files or terminal). Both use the exact previewed
bytes, the endpoint in
advice.apiUrl, and your ownadvice.apiKey. Bring your own key; no key or generative OAuth credential is shipped.
Known limits
- A reset absent from an official response or local structured event cannot be reconstructed; day-only evidence lowers confidence.
- One Codex home may contain several sign-ins. The current period may therefore show a low-confidence blended estimate from the latest real observation; ambiguous completed periods remain used-only rather than inventing an account split.
- API-equivalent values depend on current known API prices and visible pricing coverage. They are not bills or subscription prices.
- Source-log retention belongs to Claude Code and Codex. Uninstall may leave host-managed extension storage behind, so the explicit clear controls are the reliable deletion route.
Troubleshooting
"No Claude Code Data"
- Make sure Claude Code is installed and you have used it at least once.
- Check the
dataDirectorysetting; auto-detection looks at~/.claude/projectsand~/.config/claude/projects.
One-shot Claude CLI activity is missing
- Calls made with
--no-session-persistencecan leave a prompt-history entry but no project transcript and no tokenusagefields. The extension does not invent token or cost totals from prompt history. Run future audited calls without that flag if they should appear; past unpersisted token usage cannot be reconstructed locally.
Quota row shows 5h:--% wk:--%
- Claude Code's OAuth token is missing or expired. Log in to the active Claude
profile once. Credentials follow explicit
dataDirectory, then the first validCLAUDE_CONFIG_DIR, then~/.claude; the single global macOS Keychain item is never substituted for a selected custom profile.
Get AI Usage Advice returns 404
- DeepSeek's current endpoint does not use a
/v1prefix. Usehttps://api.deepseek.com/chat/completions. The extension auto-strips/v1if present.
Send this exact request is unavailable
- Enable the default-off advice-effectiveness setting, allow aggregate data,
and configure your own
claudeCodeUsage.advice.apiKey. Previewing is always local; without a key the request remains unsent.
High CPU or sluggish refresh on a large history (Linux included)
- V2.2.1 removes the hidden 8-second active polling override and bounds the first-timestamp scan. Until you install it, set Live refresh delay to Off, set Refresh interval to 300–900 seconds, and optionally turn Content analysis off. Turning Dashboard auto-refresh off by itself does not stop status-bar parsing.
- If V2.2.1 still runs hot, open Show Diagnostic Logs and attach only the
anonymous
refresh:lines to issue #70; they contain counts and timings, not prompts, paths, session IDs, credentials, or raw log lines.
Usage history disappears or is missing older months
- Claude Code automatically deletes conversation logs older than
cleanupPeriodDays(default: 30 days). Once deleted, those records cannot be recovered. To retain more history, add this to your~/.claude/settings.json:
This only affects logs kept from now on; already-deleted logs cannot be restored. Thanks to @nickearnshaw for documenting this ([PR #21](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/21)).{ "cleanupPeriodDays": 365 }
Token counts are lower than Claude Code's stats-cache
- A single response can be written as separate
thinkingandtexttranscript rows with the samemessageId,requestId, and completeusagevector. The extension counts that response identity once and keeps its largest vector; Claude Code'sstats-cachesums the rows. The extension does not apply a multiplier to make these different mechanisms agree.
Token counts appear lower than the model provider's own dashboard
- If you use Claude Code with a third-party proxy that routes requests
through sub-agents or background workflows (e.g. ultracode / dynamic
workflows), each agent writes its own
.jsonllog file inside a sub-directory. The extension reads all these files, but some proxy configurations may not write agent-level records at all. Until native workflow attribution is added in a future release, the total shown here may be lower than the provider's upstream count. Your actual spend is always on your provider's billing page.
Credits
Maintained by @Carl723000, who forked it
from @jack21's original
ClaudeCodeUsage and now also helps own and
maintain the upstream organization
ClaudeCodeUsage/ClaudeCodeUsage.
MIT-licensed. The 2.x work documented here (everything under "What's new") is by
@Carl723000 with Claude Code; it has grown well
beyond the 2.0 baseline — see CHANGELOG.md.
Development-tool credit: repository maintenance uses both
Claude Code and
OpenAI Codex. This credits the tools
separately from human contributors: Codex is not added to Release Drafter's
contributor list, and no fabricated Co-Authored-By identity is used for it.
Contributors whose upstream PRs / issues are incorporated here:
- @Dobidop —
[PR #9](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/9), the OAuth
approach for reading real
/usagedata; the quota indicator is adapted from that work. - @nickearnshaw —
[PR #8](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/8) locale-aware
number/date formatting;
[PR #20](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/20) fix for
the webview/status-bar getting stuck on "Loading…" (re-entrancy guard +
spinner only on cold start);
[PR #21](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/21) docs on
cleanupPeriodDaysfor retaining usage history; [PR #24](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/24) quota-window rollover handling (drop a window once its reset has passed). - @ScherbakovAl —
[PR #31](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/31), the
original status-bar context-window indicator and the
showCosttoggle. - @wheelbarrel00 —
[PR #38](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/38), the opt-in
weekly Opus limit in the status bar, which grew into today's API-named
showScopedWeekly. - @brenoneill — [PR #14](https://github.com/ClaudeCodeUsage/ClaudeCodeUsage/pull/14), custom data directory (merged into upstream 1.0.8).
- @mxzinke — Opus 4.5 / Haiku 4.5 prices
- German translation (upstream 1.0.8).
Also closed along the way: the test-suite seed (#25) and unreliable context-window detection for proxied/custom models (#31).
Many code changes in this fork were drafted with assistance from
Claude Code (commits include
Co-Authored-By: Claude <noreply@anthropic.com>).
Changelog
The current changelog lives in CHANGELOG.md. The most recent 2.1 entry summarises every feature, fix and personalisation option in this release.
Pre-2.0 history (upstream 1.0.x)
v1.0.8 (2025-11-28)
- Converted code comments from Traditional Chinese to English.
- Improved internationalisation standards.
- Pricing: added Opus 4.5 / Haiku 4.5 (thanks @mxzinke).
- Added German (de-DE) translation (thanks @mxzinke).
v1.0.7 (2025-11-28)
- Multilingual translation for hourly usage labels.
- Removed hardcoded Chinese text; switched to i18n.
v1.0.6 (2025-08-10)
- Added support for Claude Opus 4.1 pricing.
v1.0.5 (2025-01)
- Hourly usage statistics + visualisation.
v1.0.4 (2025-01)
- All-time data calculation; "All Time" translations.
v1.0.3 (2025-01)
- Repository URL migration + README image link fixes.
v1.0.0 (2025-01)
- Initial complete release.
Contributing
Issues and pull requests are welcome on the GitHub repository.










