VS Code / Cursor extension that reads your local Cursor login credentials and syncs official billing / usage data into SQLite, then visualizes day / month / year usage with ECharts.
No Electron hook or network capture is required.
- Reads
cursorAuth/accessTokenfrom Cursor's localstate.vscdb - Calls official endpoints:
api2.cursor.sh— period usage (plan spend / limits)cursor.com/api— usage summary + per-request events (token / cost)
- Stores billing period + usage events in
~/.cursor-usage-tracker/db/usage.db - Dashboard charts model distribution, kind breakdown, tokens, and cost
npm install
npm run buildThen press F5 (Run Extension) or install the extension from this folder.
| Command | Description |
|---|---|
| CursorUsage: Show Dashboard | Open usage charts |
| CursorUsage: Sync Billing | Force refresh from official APIs |
| CursorUsage: Export Data | Export usage events as CSV |
| CursorUsage: Open Tokens Log | Open ~/.cursor-usage-tracker/logs/usage-tokens.jsonl |
| CursorUsage: Show Status | Show local DB / tokens log status |
- Cursor must be signed in on this machine (so
state.vscdbhas a valid access token) - Network access to
api2.cursor.shandcursor.com
All data lives under ~/.cursor-usage-tracker/:
| Path | Purpose |
|---|---|
db/usage.db |
SQLite: billing periods + usage events |
logs/usage-tokens.jsonl |
Last sync's full tokenUsage dump |
tmp/ |
Temporary files for atomic writes |
npm install
npm run packageThis typechecks, builds with esbuild, and produces cursor-usage-tracker-<version>.vsix.
Install locally:
# Cursor / VS Code CLI
cursor --install-extension cursor-usage-tracker-*.vsix
# or
code --install-extension cursor-usage-tracker-*.vsixOr use Extensions: Install from VSIX… in the command palette.
GitHub Actions (.github/workflows/ci.yml) runs on push / PR to main or master:
npm ci- Typecheck
- Package VSIX
- Upload artifact
cursor-usage-tracker(cursor-usage-tracker.vsix)
Pushing a tag v* (e.g. v0.2.2) also:
- Creates a GitHub Release with the VSIX attached
- Publishes the same VSIX to Open VSX (Cursor marketplace mirror)
- Sign in at open-vsx.org (GitHub / Eclipse account)
- Create an access token: User Settings → Tokens
- Add it as a repo secret:
gh secret set OVSX_PATPublisher namespace must match package.json → publisher (cursor-usage). CI creates the namespace on first publish if needed.
Manual publish without a new tag: Actions → CI → Run workflow → enable Also publish… to Open VSX.
npm run previewServes the dashboard HTML with mock data for UI work outside the extension host.
Network capture / Electron patching has been removed. If you previously ran Install Hook:
- Restore Cursor's
main.jsfrom~/.cursor-usage-tracker/main.js.bak(or reinstall Cursor) - Restart Cursor
- Use Sync Billing — data now comes only from official APIs
Old requests.jsonl / capture tables are no longer used. Billing events already in usage.db are kept.