{"_id":"@anibx/token-tracker","_rev":"3-e45db30afcba5df2a83e0d7771501367","name":"@anibx/token-tracker","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.2":{"name":"@anibx/token-tracker","version":"1.0.2","_id":"@anibx/token-tracker@1.0.2","maintainers":[{"name":"ani0x53","email":"Anirudh.bh@gmail.com"}],"bin":{"token-tracker":"bin/launch.cjs"},"dist":{"shasum":"a5cf2071bfb31a2450298f7c6670f0736ec51e97","tarball":"https://registry.npmjs.org/@anibx/token-tracker/-/token-tracker-1.0.2.tgz","fileCount":4,"integrity":"sha512-u4Ob0at+G32YcXeDspdNM9hO3JP9FAQcfmPNFmSyMqnNfx5W8GAsdJxuC3xbZJwjciHwh2RaSVw8KJ7rBMNvrg==","signatures":[{"sig":"MEYCIQCYWQNTnlWEfMjSGDbNflhHt+3fYtq8Vdx5ggzM/j+TPQIhAO4MxBMm4OJ/f6AFMjgAaak7sZUkDPPFh+WPFEFBGDzW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12122},"type":"module","gitHead":"b56de81a5db25a027a7e7984f576285675d7fa30","scripts":{"dev":"vite","build":"tsc && vite build","tauri":"tauri","preview":"vite preview","postinstall":"node scripts/postinstall.cjs"},"_npmUser":{"name":"ani0x53","email":"Anirudh.bh@gmail.com"},"_npmVersion":"11.8.0","description":"Real-time token usage and cost tracker for Anthropic and OpenAI APIs","directories":{},"_nodeVersion":"24.13.1","dependencies":{"react":"^19.1.0","zustand":"^5.0.11","recharts":"^3.7.0","react-dom":"^19.1.0","lucide-react":"^0.575.0","@tauri-apps/api":"^2","@tanstack/react-query":"^5.90.21","@tauri-apps/plugin-sql":"^2.3.2","@tauri-apps/plugin-opener":"^2","@tauri-apps/plugin-notification":"^2.3.3"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.0.4","typescript":"~5.8.3","tailwindcss":"^4.2.1","@types/react":"^19.1.8","@tauri-apps/cli":"^2","@types/react-dom":"^19.1.6","@tailwindcss/vite":"^4.2.1","@vitejs/plugin-react":"^4.6.0"},"_npmOperationalInternal":{"tmp":"tmp/token-tracker_1.0.2_1772079185047_0.8156723792307714","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@anibx/token-tracker","version":"1.0.3","_id":"@anibx/token-tracker@1.0.3","maintainers":[{"name":"ani0x53","email":"Anirudh.bh@gmail.com"}],"bin":{"token-tracker":"bin/launch.cjs"},"dist":{"shasum":"a2e2cfd07ad62a4df0ea36a167bb04d4b7185089","tarball":"https://registry.npmjs.org/@anibx/token-tracker/-/token-tracker-1.0.3.tgz","fileCount":4,"integrity":"sha512-lRZcTHWD88gn7Ar/c28pGSHckM4HsC6mQ4h4M/UlzRnPQ1KRcxocaSyb3gvCN4DAB6Dm8ytkGJ9vvR3TKfx20g==","signatures":[{"sig":"MEUCIQCmLTJQwuucTgb/dsiOnMg6FclnCEMuShzWg08wTRft5QIgYjR1M3KK3Jn6ukhYwbd5cjVYhdqLz5wu2aCvPmxHeO0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12122},"type":"module","gitHead":"68f14bfac2c9766df66e0fc3d1588ab2ce0555a2","scripts":{"dev":"vite","build":"tsc && vite build","tauri":"tauri","preview":"vite preview","postinstall":"node scripts/postinstall.cjs"},"_npmUser":{"name":"ani0x53","email":"Anirudh.bh@gmail.com"},"_npmVersion":"11.8.0","description":"Real-time token usage and cost tracker for Anthropic and OpenAI APIs","directories":{},"_nodeVersion":"24.13.1","dependencies":{"react":"^19.1.0","zustand":"^5.0.11","recharts":"^3.7.0","react-dom":"^19.1.0","lucide-react":"^0.575.0","@tauri-apps/api":"^2","@tanstack/react-query":"^5.90.21","@tauri-apps/plugin-sql":"^2.3.2","@tauri-apps/plugin-opener":"^2","@tauri-apps/plugin-notification":"^2.3.3"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.0.4","typescript":"~5.8.3","tailwindcss":"^4.2.1","@types/react":"^19.1.8","@tauri-apps/cli":"^2","@types/react-dom":"^19.1.6","@tailwindcss/vite":"^4.2.1","@vitejs/plugin-react":"^4.6.0"},"_npmOperationalInternal":{"tmp":"tmp/token-tracker_1.0.3_1772086540224_0.8180305639737329","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@anibx/token-tracker","version":"1.0.4","description":"Real-time token usage and cost tracker for Anthropic and OpenAI APIs","type":"module","bin":{"token-tracker":"bin/launch.cjs"},"scripts":{"dev":"vite","build":"tsc && vite build","preview":"vite preview","tauri":"tauri","postinstall":"node scripts/postinstall.cjs"},"dependencies":{"@tanstack/react-query":"^5.90.21","@tauri-apps/api":"^2","@tauri-apps/plugin-notification":"^2.3.3","@tauri-apps/plugin-opener":"^2","@tauri-apps/plugin-sql":"^2.3.2","lucide-react":"^0.575.0","react":"^19.1.0","react-dom":"^19.1.0","recharts":"^3.7.0","zustand":"^5.0.11"},"devDependencies":{"@tailwindcss/vite":"^4.2.1","@tauri-apps/cli":"^2","@types/react":"^19.1.8","@types/react-dom":"^19.1.6","@vitejs/plugin-react":"^4.6.0","tailwindcss":"^4.2.1","typescript":"~5.8.3","vite":"^7.0.4"},"gitHead":"1cfea485a371206fd12ad16c8464596b97c7a1e9","_id":"@anibx/token-tracker@1.0.4","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-q6k6Wjdhmc/ktoXPXnXOhnILUpUDdfa26VmAFINa4BdsaVUvtBLPb/UzaWgktySOFkZCiX65PD9upbLIXHm19A==","shasum":"4062fe70455fcfb8b090001cc89ab3d400d20de1","tarball":"https://registry.npmjs.org/@anibx/token-tracker/-/token-tracker-1.0.4.tgz","fileCount":4,"unpackedSize":12122,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGwZwjggaa06AOXhqcvGsoCjL8LReBynSZoIcRZEFfx4AiEA5cYaVdiYGYPKbJn4yPU1ikNh0JYWnpeexvweqVTthXc="}]},"_npmUser":{"name":"ani0x53","email":"Anirudh.bh@gmail.com"},"directories":{},"maintainers":[{"name":"ani0x53","email":"Anirudh.bh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/token-tracker_1.0.4_1772091636270_0.5686650396944286"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-26T04:13:04.948Z","modified":"2026-02-26T07:40:36.610Z","1.0.2":"2026-02-26T04:13:05.205Z","1.0.3":"2026-02-26T06:15:40.360Z","1.0.4":"2026-02-26T07:40:36.448Z"},"description":"Real-time token usage and cost tracker for Anthropic and OpenAI APIs","maintainers":[{"name":"ani0x53","email":"Anirudh.bh@gmail.com"}],"readme":"# Token Tracker\n\nA cross-platform desktop app that shows real-time and historical token usage + costs for **Anthropic (Claude)** and **OpenAI (GPT)** APIs.\n\nBuilt with **Tauri v2** (Rust backend) + **React 19 + TypeScript** (frontend).\n\n---\n\n## Install\n\n```sh\nnpm install -g @anibx/token-tracker\ntoken-tracker\n```\n\nOr download a binary directly from the [latest release](https://github.com/ani0x53/token-tracker/releases/latest).\n\n---\n\n## Features\n\n- **Real-time polling** — fetches usage from Anthropic and OpenAI APIs on a configurable interval (default 5 min)\n- **30-day history** — stored locally in SQLite, persists across restarts\n- **Daily line chart** — cost over time per provider\n- **Model breakdown bar chart** — cost per model (Claude Sonnet, Opus, GPT-4o, etc.)\n- **Spending alerts** — OS-level notifications when daily/monthly thresholds are exceeded\n- **System tray** — shows today's total cost, click to open window\n- **Dark UI** — Tailwind CSS dark theme\n\n---\n\n## Prerequisites\n\n### macOS / Windows\nTauri's prerequisites are automatically handled by the platform toolchain.\n\n### Linux (Ubuntu/Debian)\n```bash\nsudo apt-get install -y \\\n  libwebkit2gtk-4.1-dev \\\n  libgtk-3-dev \\\n  libayatana-appindicator3-dev \\\n  librsvg2-dev \\\n  pkg-config\n```\n\n### Rust\n```bash\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\nsource \"$HOME/.cargo/env\"\n```\n\n---\n\n## Setup\n\n```bash\n# 1. Install JS dependencies\nnpm install\n\n# 2. Run in development mode\nnpm run tauri dev\n\n# 3. Build a release binary\nnpm run tauri build\n```\n\n---\n\n## Configuration\n\nOn first launch the Settings panel opens automatically. Enter your API keys there.\n\n**Keys are stored only on your machine** — in your OS app data directory. They are never sent anywhere except the respective API provider.\n\n| Setting | Where to get it |\n|---------|----------------|\n| **Anthropic Admin Key** | [console.anthropic.com/settings/admin-keys](https://console.anthropic.com/settings/admin-keys) — must be an **Admin** key, not a regular API key |\n| **OpenAI API Key** | [platform.openai.com/api-keys](https://platform.openai.com/api-keys) |\n| **Poll Interval** | Seconds between data fetches (default 300) |\n| **Daily Alert ($)** | OS notification when daily spend exceeds this amount |\n| **Monthly Alert ($)** | OS notification when monthly spend exceeds this amount |\n\nYou can leave out either key if you only use one provider.\n\n---\n\n## Architecture\n\n```\ntoken-tracker/\n├── src/                          # React frontend\n│   ├── App.tsx\n│   ├── components/\n│   │   ├── Dashboard.tsx         # Main layout\n│   │   ├── ProviderCard.tsx      # Per-provider summary card\n│   │   ├── UsageChart.tsx        # Line chart — daily usage\n│   │   ├── ModelBreakdown.tsx    # Bar chart — cost per model\n│   │   └── AlertSettings.tsx    # Settings modal\n│   ├── hooks/\n│   │   ├── useUsageData.ts       # SQLite query + event listeners\n│   │   └── useAlerts.ts          # Spending alert logic\n│   └── store/\n│       └── settingsStore.ts      # Zustand store for settings\n├── src-tauri/\n│   └── src/\n│       ├── lib.rs                # Tauri commands + app setup\n│       ├── api/\n│       │   ├── anthropic.rs      # Anthropic usage API client\n│       │   └── openai.rs         # OpenAI usage API client\n│       ├── poller.rs             # Background polling loop\n│       ├── storage.rs            # SQLite schema constants\n│       └── tray.rs               # System tray setup\n```\n\n### Data flow\n\n1. Rust `poller` fetches both APIs every N seconds\n2. New snapshots are emitted as `new-snapshots` Tauri events\n3. Frontend `useUsageData` hook receives events and upserts into local SQLite\n4. React Query re-fetches from DB and re-renders charts\n5. Tray tooltip is updated with today's total cost\n\n---\n\n## Tech Stack\n\n| Layer | Choice |\n|-------|--------|\n| Desktop shell | Tauri v2 |\n| Frontend | React 19 + TypeScript |\n| Styling | Tailwind CSS v4 |\n| Charts | Recharts |\n| State | Zustand |\n| DB | SQLite (tauri-plugin-sql) |\n| HTTP | reqwest (Rust) |\n| Notifications | tauri-plugin-notification |\n","readmeFilename":"README.md"}