Token Usage
Status-bar cost and tokens for the current session. Claude Code is the reliable path (local transcripts, no login). Cursor is optional and only works when you are already signed in on this machine.
$(graph) $0.42 · last $0.18 ↑12.4k ↓5.9k · $31.50 left
Click the graph icon bottom-left ($— until there is spend). If you cannot see it, open the status bar … overflow, or search Token Usage in the Command Palette. Reload Window after installing a new vsix.
Disclaimer — this does not spend tokens
The extension does not call any AI model and does not add request quota.
- Claude Code: JSONL transcripts already on disk (
~/.claude/projects)
- Cursor: the same usage dashboard Cursor already shows you, using Cursor’s stored session on this computer (never sent anywhere else)
No native modules, no downloads, no background completions.
Cursor uses a private API (cursor.com/api/dashboard/*). It is undocumented and can change. If it breaks, Claude Code readings are unaffected.
Setup
- Install
build/token-usage-0.4.16.vsix and Developer: Reload Window.
- Open a folder (not a single file).
- Use an agent in that folder:
- Claude Code — works once a transcript exists. No sign-in.
- Cursor — only if you are already signed in to Cursor here. The extension never prompts for credentials.
- If it looks empty, click the status bar item or run Token Usage: Why is this empty?
On a company laptop where Cursor login is blocked, pin tokenUsage.provider to claude-code. If neither agent has local history, there is nothing to show.
Remote SSH / WSL: install the extension on the remote side too. Settings are per machine unless Settings Sync is on.
Settings that matter
Search Token Usage in Settings, or put this in settings.json:
{
"tokenUsage.provider": "auto",
"tokenUsage.display": "cost-and-tokens",
"tokenUsage.cursor.costMode": "billed",
"tokenUsage.budget.claudeUSD": 600,
"tokenUsage.budget.cursorUSD": 50,
"tokenUsage.budget.combinedUSD": 0,
"tokenUsage.budget.cycleStartDay": 1,
"tokenUsage.budget.warnAtPercent": [75, 90, 100]
}
| Setting |
Default |
|
tokenUsage.provider |
auto |
auto (sticky while both are fresh), or pin claude-code / cursor |
tokenUsage.auto.freshnessMinutes |
3 |
Keep the current auto source if it moved within this window |
tokenUsage.sessionScope |
conversation |
conversation, today, or 7d |
tokenUsage.display |
cost-and-tokens |
Or cost / tokens for a shorter bar |
tokenUsage.cursor.costMode |
billed |
billed = what Cursor charged. tokens = rate table × token counts (an estimate) |
tokenUsage.budget.cursorUSD / claudeUSD |
0 |
Monthly cap; 0 disables that source’s budget |
tokenUsage.budget.combinedUSD |
0 |
Shared Claude + Cursor cap; 0 disables. Scans both accounts every 5 minutes |
tokenUsage.budget.cycleStartDay |
1 |
Local calendar day the cycle starts |
tokenUsage.budget.warnAtPercent |
[75, 90, 100] |
Toast only if spend is ahead of even pace, or at 100% |
tokenUsage.pricing |
{} |
USD per million tokens, e.g. { "claude-sonnet-5": { "input": 3, "output": 15 } } |
tokenUsage.claudeProjectsPath |
~/.claude/projects |
Transcript root |
tokenUsage.warnThresholdUSD |
0 |
Highlight the bar above this session spend |
tokenUsage.statusBar.alignment |
left |
left (easier to see) or right (often in …) |
tokenUsage.statusBarPriority |
10 |
Higher sits further left within that side |
Budget notes
- Spend is account-wide, not this workspace. Claude and Cursor are separate bills. The dashboard can show both this cycle and a sum. Set
tokenUsage.budget.combinedUSD if that sum should warn as one cap.
- After a warning threshold, the bar shows $/day left. The toast can open the dashboard, raise this cycle (this period only), or snooze until tomorrow.
- Leave both budgets at
0 to skip the 5-minute account scan.
Cursor tokens mode is a local estimate. Unknown models use the Opus fallback and are listed in diagnostics — never treated as free.
Commands
Search Token Usage in the Command Palette: Show Dashboard, Why is this empty?, Refresh, Select Source, Copy Session Summary / Copy Recent Prompts as CSV / Copy Cycle as CSV / JSON.
The dashboard ranks model mix, this session of the cycle, today, yesterday, and this week.
Local cost (not AI)
| What |
How often |
Touches |
| Claude Code session |
file change + 10s safety poll |
tail of the current transcript |
| Cursor session |
60s |
one page of Cursor’s usage API + a read-only SQLite query |
| Monthly budget |
5 min, only if a budget is set |
Cursor: paginated usage API. Claude: transcripts modified this cycle |
| Auto source |
30s, only when provider is auto |
one stat and one SQLite MAX(), no network |
Pin tokenUsage.provider to skip auto-detect. Charts are inline SVG (enableScripts: false).
Built-in rates (USD / million tokens)
| Family |
Input |
Output |
| claude-fable-5, claude-mythos-5 |
10 |
50 |
| claude-opus-5, claude-opus-4-* |
5 |
25 |
| claude-sonnet-5, claude-sonnet-4-* |
3 |
15 |
| claude-haiku-4-5 |
1 |
5 |
| anything else |
5 |
25 |
Cursor suffixes (-thinking-high, …) match the family. Override with tokenUsage.pricing.
Development
npm install && npm run compile
npm run test:fixtures && npm run test:cursor-api && npm run test:detect
npm run test:sqlite && npm run test:budget && npm run test:dashboard
npm run package
npm run package writes build/token-usage-<version>.vsix. Older vsix files stay in build/ too.