Track your Cursor API spend from the terminal and get a summary in a macOS notification—no VS Code or Cursor window required.
This project adds a CLI and a notification script on top of the logic from the Cursor Spend Tracker extension. It reads the same Cursor auth state and usage APIs to show spend, today/yesterday/last 2h stats.
- Node.js (with
npm) - sqlite3 on your PATH (used to read Cursor’s auth token from its state DB)
- Cursor used at least once on this machine (so the auth token exists)
- macOS (for the notification script; the CLI works on any platform)
Install sqlite3 if needed:
- macOS (Homebrew):
brew install sqlite
git clone https://github.com/rohm1/cursor-spend-tracker-cli.git
npm ci --ignore-scriptsPrint your current Cursor spend summary to stdout:
npm run spendOr:
npx tsx cli.tsExample output:
Spend: $3.96 / $100 ($96.04 left)
Today: 16 reqs, $0.98
Yesterday: 3 reqs, $0.17
Last 2h: 2 reqs, $0.15
Run the CLI and show the same summary in a macOS notification:
./notify-spend.shOr:
npm run notify-spendOn success the notification title is “Cursor Spend”; on error (e.g. not logged in, network issue) it’s “Cursor Spend — Error” and the body shows the error message.
You can run ./notify-spend.sh from cron, launchd, or a keyboard shortcut to check spend without opening Cursor.
cli.ts– Standalone script (no VS Code dependency). Reads the Cursor session token from the Cursor state SQLite DB, calls Cursor’s usage APIs, and prints a short summary.notify-spend.sh– Runscli.tswithnpx tsx, captures the output, and displays it via macOSosascript(AppleScript) as a notification.
The extension UI and logic (auth, API calls, formatting) are from the original Cursor Spend Tracker extension.
The core logic (reading Cursor auth from the state DB, calling Cursor usage APIs, and the usage/event formatting) is derived from:
This repo adds a VSCode-free CLI and a macOS notification wrapper around that logic; it is not affiliated with the original extension author.