npm i -g @aiusage/cli
AIUsage tracks token usage and costs across all your AI tools and devices,
syncs to your own Cloudflare Worker, and visualizes everything on a public dashboard.
简体中文 | English
A self-hosted, privacy-first system for tracking how much you spend on AI coding tools — across every device you own.
- Scans locally — reads token usage from session logs, never touches conversation content
- Syncs across devices — every machine enrolls with its own secure token, data merges on your Worker
- Visualizes costs — public dashboard with trends, model breakdowns, cost per session, and more
- You own the data — deploys to your Cloudflare account (free tier is enough), no third-party services
graph LR
D1["<b>Device 01</b><br/>MacBook Pro"] -- sync --> W["<b>Cloudflare Worker</b><br/>+ D1 Database"]
D2["<b>Device 02</b><br/>Mac Mini"] -- sync --> W
D3["<b>Device 03</b><br/>Linux Server"] -- sync --> W
W -- public API --> Dashboard["<b>Dashboard</b><br/>read-only web UI"]
Copy this prompt, paste it into your AI coding agent (Claude Code, Codex, Copilot, Gemini, etc.):
Clone https://github.com/ennann/aiusage.git, read skills/aiusage-server/aiusage-server.md,
and help me deploy AIUsage to my Cloudflare account.
After the server is up, follow skills/aiusage-cli/aiusage-cli.md to connect this device.
git clone https://github.com/ennann/aiusage.git
cd aiusage && pnpm install
npx wrangler login
pnpm setupnpm i -g @aiusage/cli
aiusage report --range 7dAIUsage uses a fork-based update model — fork this repo, connect your fork to Cloudflare Workers via Git integration, and updates flow automatically.
- Fork this repository to your GitHub account
- Connect your fork to Cloudflare Workers (Git integration)
- Sync upstream updates via GitHub's "Sync fork" button or
git merge upstream/main - Cloudflare auto-redeploys on every push to your fork
CLI updates are separate: npm update -g @aiusage/cli
See the Update Guide for detailed instructions, including fully automatic sync via GitHub Actions.
| Document | Description |
|---|---|
| Deployment Guide | Full setup walkthrough, CLI reference, API docs |
| Update Guide | Fork-based update mechanism and auto-deploy setup |
| CLI README | CLI tool details and all commands |