Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Everything here is optional. Defaults are in brackets.

# Where the history database lives [~/.local/share/ai-usage-dashboard/usage.db]
# Where the history database lives [~/.local/share/token-usage-dashboard/usage.db]
# AIUSAGE_DB=/data/usage.db

# Where each tool keeps its transcripts, if you moved them
Expand Down
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Bug reports, typo fixes and whole features are all welcome. By joining in, you a

## Ways to contribute

- 🐛 **Report a bug** - open a [bug report](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=bug_report.yml)
- 💡 **Suggest a feature** - open a [feature request](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=feature_request.yml)
- 🐛 **Report a bug** - open a [bug report](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=bug_report.yml)
- 💡 **Suggest a feature** - open a [feature request](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=feature_request.yml)
- 📖 **Improve the docs** - typos, unclear wording and missing examples are all fair game
- 🔧 **Submit a fix** - see below
- 🔒 **Report a vulnerability** - please _don't_ open a public issue, see [SECURITY.md](./SECURITY.md)
Expand All @@ -18,8 +18,8 @@ Bug reports, typo fixes and whole features are all welcome. By joining in, you a
## Getting started

```bash
git clone git@github.com:NotAFlightRisk/ai-usage-dashboard.git
cd ai-usage-dashboard
git clone git@github.com:NotAFlightRisk/token-usage-dashboard.git
cd token-usage-dashboard
npm install
npm run dev
```
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ body:
required: true
- label: I am running the latest version
required: true
- label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md)
- label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md)
required: true
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ blank_issues_enabled: false

contact_links:
- name: 🔒 Report a Security Vulnerability
url: https://github.com/NotAFlightRisk/ai-usage-dashboard/security/policy
url: https://github.com/NotAFlightRisk/token-usage-dashboard/security/policy
about: Never report vulnerabilities in a public issue. Read our security policy and disclose privately.

- name: 📖 Documentation
url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/README.md
url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/README.md
about: Usage, configuration and deployment docs. Worth checking before filing.

- name: 🙋 Support & Troubleshooting
url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/SUPPORT.md
url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/SUPPORT.md
about: Not sure where something belongs? This explains where to ask what.

- name: 💬 Questions & Ideas
url: https://github.com/NotAFlightRisk/ai-usage-dashboard/discussions
url: https://github.com/NotAFlightRisk/token-usage-dashboard/discussions
about: Ask a question, share an idea, or show what you've built.

- name: 🛠️ Contributing Guide
url: https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CONTRIBUTING.md
url: https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CONTRIBUTING.md
about: Want to fix it yourself? Start here for setup and the PR workflow.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body:
- type: markdown
attributes:
value: |
Thanks for the suggestion! Please [search existing issues and discussions](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues?q=is%3Aissue) first to avoid duplicates.
Thanks for the suggestion! Please [search existing issues and discussions](https://github.com/NotAFlightRisk/token-usage-dashboard/issues?q=is%3Aissue) first to avoid duplicates.

- type: textarea
id: problem
Expand Down Expand Up @@ -52,5 +52,5 @@ body:
options:
- label: I have searched existing issues for duplicates
required: true
- label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md)
- label: I agree to follow this project's [Code of Conduct](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.github/CODE_OF_CONDUCT.md)
required: true
22 changes: 11 additions & 11 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<h1 align="center">AI usage dashboard</h1>
<h1 align="center">Token usage dashboard</h1>
<p align="center">
<i>Beautiful dashboard showing a breakdown of where all of your tokens are going</i><br>
<b><code>npx token-usage-dashboard</code></b>
</p>

<p align="center">
<img src="https://raw.githubusercontent.com/NotAFlightRisk/ai-usage-dashboard/main/.github/screenshot.png" width="800" alt="The dashboard, showing a usage calendar, daily totals and plan windows" />
<img src="https://raw.githubusercontent.com/NotAFlightRisk/token-usage-dashboard/main/.github/screenshot.png" width="800" alt="The dashboard, showing a usage calendar, daily totals and plan windows" />
</p>

---
Expand Down Expand Up @@ -56,7 +56,7 @@ Most of it lives behind the gear icon: theme, default range, how often to rescan
Anthropic for your plan windows, and price overrides for any model we've got wrong or don't know.

Paths are environment variables, since they're needed before the app starts. See
[`.env.example`](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/.env.example) for the full list. The ones you'll actually want are
[`.env.example`](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/.env.example) for the full list. The ones you'll actually want are
`AIUSAGE_DB`, `AIUSAGE_CLAUDE_DIR` and `AIUSAGE_CODEX_DIR`.

---
Expand All @@ -78,18 +78,18 @@ we can read, it can go in - open an issue with a sample and we'll have a look.

### Option 1: Docker

The image is on DockerHub ([`notaflightrisk/ai-usage-dashboard`](https://hub.docker.com/r/notaflightrisk/ai-usage-dashboard))
The image is on DockerHub ([`notaflightrisk/token-usage-dashboard`](https://hub.docker.com/r/notaflightrisk/token-usage-dashboard))
and GHCR. Mount the directories you want read, plus somewhere to keep the database:

```shell
docker run -p 127.0.0.1:8080:8080 \
-v ~/.claude:/home/node/.claude:ro \
-v ~/.codex:/home/node/.codex:ro \
-v ai-usage:/data \
notaflightrisk/ai-usage-dashboard
-v token-usage:/data \
notaflightrisk/token-usage-dashboard
```

There's a compose file in [`docker/`](https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/docker/compose.yaml) if you'd rather. The container has
There's a compose file in [`docker/`](https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/docker/compose.yaml) if you'd rather. The container has
to bind `0.0.0.0` internally, so publish the port to localhost like that unless something in
front of it is checking who's asking.

Expand All @@ -104,7 +104,7 @@ so it comes back after a reboot:

### Option 3: From a release

Grab the tarball from [releases](https://github.com/NotAFlightRisk/ai-usage-dashboard/releases),
Grab the tarball from [releases](https://github.com/NotAFlightRisk/token-usage-dashboard/releases),
then `npm ci --omit=dev && npm start`.

### Option 4: From source
Expand All @@ -119,8 +119,8 @@ You'll need [Node](https://nodejs.org/) 22.12 or newer, plus [Git](https://git-s
It's a [SvelteKit](https://svelte.dev/docs/kit) app and the build is self-contained so there's no runtime dependencies at all.

```bash
git clone git@github.com:NotAFlightRisk/ai-usage-dashboard.git
cd ai-usage-dashboard
git clone git@github.com:NotAFlightRisk/token-usage-dashboard.git
cd token-usage-dashboard
npm install
npm run dev
```
Expand All @@ -134,6 +134,6 @@ The other scripts you'll want are `npm run check` (types), `npm test` (tests) an
<p align="center">
<a href="https://github.com/NotAFlightRisk"><img width="64" src="https://pixelflare.cc/iain/gif/penguin-dance.gif" /></a><br>
<sup>
<i>Licensed under <a href="https://github.com/NotAFlightRisk/ai-usage-dashboard/blob/main/LICENSE">MIT</a>, © <a href="https://peng.ly">NotAFlightRisk</a> 2026</i>
<i>Licensed under <a href="https://github.com/NotAFlightRisk/token-usage-dashboard/blob/main/LICENSE">MIT</a>, © <a href="https://peng.ly">NotAFlightRisk</a> 2026</i>
</sup>
</p>
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and is never stored or logged.

Acceptable channels:

1. **GitHub** (preferred) - open an [advisory](https://github.com/NotAFlightRisk/ai-usage-dashboard/security/advisories/new) from the Security tab
1. **GitHub** (preferred) - open an [advisory](https://github.com/NotAFlightRisk/token-usage-dashboard/security/advisories/new) from the Security tab
2. **Email** - [security@peng.ly](mailto:security@peng.ly) (PGP: [`A8431F9F332FB0CD`](https://github.com/NotAFlightRisk.gpg))

Include the type of issue, the affected version and file paths, steps to reproduce, a PoC if you've got one, and what an attacker could actually achieve with it.
Expand Down
16 changes: 8 additions & 8 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ Need a hand? Here's where to go 👇

## Before you ask

Have a look at the [README](./README.md), especially [Usage](./README.md#usage) and [Configuration](./README.md#configuration). Then search [existing issues](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues?q=is%3Aissue), because someone's likely hit the same thing.
Have a look at the [README](./README.md), especially [Usage](./README.md#usage) and [Configuration](./README.md#configuration). Then search [existing issues](https://github.com/NotAFlightRisk/token-usage-dashboard/issues?q=is%3Aissue), because someone's likely hit the same thing.

---

## Where to ask

| I want to... | Go here |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Ask a question or share an idea | [Discussions](https://github.com/NotAFlightRisk/ai-usage-dashboard/discussions) |
| Report a bug | [Bug report](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=bug_report.yml) |
| Request a feature | [Feature request](https://github.com/NotAFlightRisk/ai-usage-dashboard/issues/new?template=feature_request.yml) |
| Report a vulnerability | [Security policy](./SECURITY.md) - **not** a public issue |
| Contribute a change | [Contributing guide](./CONTRIBUTING.md) |
| I want to... | Go here |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| Ask a question or share an idea | [Discussions](https://github.com/NotAFlightRisk/token-usage-dashboard/discussions) |
| Report a bug | [Bug report](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=bug_report.yml) |
| Request a feature | [Feature request](https://github.com/NotAFlightRisk/token-usage-dashboard/issues/new?template=feature_request.yml) |
| Report a vulnerability | [Security policy](./SECURITY.md) - **not** a public issue |
| Contribute a change | [Contributing guide](./CONTRIBUTING.md) |

---

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ jobs:
env:
TAG: ${{ inputs.tag }}
run: |
tar -czf "ai-usage-dashboard-$TAG.tar.gz" build bin package.json package-lock.json .env.example
tar -czf "token-usage-dashboard-$TAG.tar.gz" build bin package.json package-lock.json .env.example
echo "Run it with: npm ci --omit=dev && npm start" >> "$GITHUB_STEP_SUMMARY"
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
gh release create "$TAG" "ai-usage-dashboard-$TAG.tar.gz" \
gh release create "$TAG" "token-usage-dashboard-$TAG.tar.gz" \
--title "$TAG" \
--generate-notes \
--repo "$GITHUB_REPOSITORY"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ USER node
VOLUME /data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1:8080/ > /dev/null || exit 1
CMD ["node", "bin/ai-usage-dashboard.js", "--no-open"]
CMD ["node", "bin/token-usage-dashboard.js", "--no-open"]
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ process.env.PORT = String(port);
const shown = host === '0.0.0.0' || host === '::' ? 'localhost' : host;
const url = `http://${shown.includes(':') ? `[${shown}]` : shown}:${port}`;
await import(resolve(root, 'build', 'index.js'));
console.log(`\n AI usage dashboard is on ${url}\n`);
console.log(`\n Token usage dashboard is on ${url}\n`);

const wantsBrowser = flag('--open') || (process.stdout.isTTY && !flag('--no-open'));
if (wantsBrowser) {
Expand Down
8 changes: 4 additions & 4 deletions docker/compose.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
services:
ai-usage-dashboard:
image: notaflightrisk/ai-usage-dashboard:latest
token-usage-dashboard:
image: notaflightrisk/token-usage-dashboard:latest
ports:
- '8080:8080'
volumes:
- ${HOME}/.claude:/home/node/.claude:ro
- ${HOME}/.codex:/home/node/.codex:ro
- ai-usage:/data
- token-usage:/data
restart: unless-stopped

volumes:
ai-usage:
token-usage:
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dev": "vite dev",
"build": "vite build",
"prepublishOnly": "npm run build",
"start": "node bin/ai-usage-dashboard.js",
"start": "node bin/token-usage-dashboard.js",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"test": "vitest run",
Expand Down Expand Up @@ -40,10 +40,10 @@
"cost"
],
"license": "MIT",
"homepage": "https://github.com/NotAFlightRisk/ai-usage-dashboard",
"bugs": "https://github.com/NotAFlightRisk/ai-usage-dashboard/issues",
"homepage": "https://github.com/NotAFlightRisk/token-usage-dashboard",
"bugs": "https://github.com/NotAFlightRisk/token-usage-dashboard/issues",
"bin": {
"aiusage": "bin/ai-usage-dashboard.js"
"aiusage": "bin/token-usage-dashboard.js"
},
"files": [
"bin",
Expand All @@ -56,7 +56,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/NotAFlightRisk/ai-usage-dashboard.git"
"url": "git+https://github.com/NotAFlightRisk/token-usage-dashboard.git"
},
"imports": {
"#lib/*": "./src/lib/*"
Expand Down
8 changes: 4 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ set -euo pipefail
port="${1:-4747}"
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
node="$(command -v node)"
unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/ai-usage-dashboard.service"
unit="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user/token-usage-dashboard.service"

[ -d "$dir/build" ] || { echo "No build/ yet. Run: npm ci && npm run build" >&2; exit 1; }

mkdir -p "$(dirname "$unit")"
sed -e "s|__DIR__|$dir|g" -e "s|__NODE__|$node|g" -e "s|__PORT__|$port|g" \
"$dir/scripts/ai-usage-dashboard.service" > "$unit"
"$dir/scripts/token-usage-dashboard.service" > "$unit"

systemctl --user daemon-reload
systemctl --user enable --now ai-usage-dashboard.service
systemctl --user enable --now token-usage-dashboard.service
loginctl enable-linger "$USER" 2>/dev/null || true

echo "Running on http://127.0.0.1:$port"
echo "Logs: journalctl --user -u ai-usage-dashboard -f"
echo "Logs: journalctl --user -u token-usage-dashboard -f"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=AI usage dashboard
Description=Token usage dashboard
After=network.target

[Service]
Expand All @@ -8,7 +8,7 @@ WorkingDirectory=__DIR__
Environment=NODE_ENV=production
Environment=HOST=127.0.0.1
Environment=PORT=__PORT__
ExecStart=__NODE__ __DIR__/bin/ai-usage-dashboard.js --no-open
ExecStart=__NODE__ __DIR__/bin/token-usage-dashboard.js --no-open
Restart=on-failure
RestartSec=5

Expand Down
2 changes: 1 addition & 1 deletion src/lib/logos/Logo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
width={size}
height={size}
role="img"
aria-label="AI usage dashboard"
aria-label="Token usage dashboard"
>
<rect width="32" height="32" rx="8" fill="var(--accent)" />
{#each cells as cell (`${cell.row}-${cell.column}`)}
Expand Down
7 changes: 6 additions & 1 deletion src/lib/server/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { existsSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';

const home = homedir();
const env = (name: string, fallback: string) => (process.env[name] || '').trim() || fallback;

const dataHome = env('XDG_DATA_HOME', join(home, '.local', 'share'));
const dataDirs = ['token-usage-dashboard', 'ai-usage-dashboard'].map((name) =>
join(dataHome, name)
);
const dataDir = dataDirs.find((dir) => existsSync(dir)) ?? dataDirs[0];

export const config = {
dbPath: env('AIUSAGE_DB', join(dataHome, 'ai-usage-dashboard', 'usage.db')),
dbPath: env('AIUSAGE_DB', join(dataDir, 'usage.db')),
claudeDir: env('AIUSAGE_CLAUDE_DIR', join(home, '.claude')),
codexDir: env('AIUSAGE_CODEX_DIR', join(home, '.codex')),
openCodeDir: env('AIUSAGE_OPENCODE_DIR', join(dataHome, 'opencode')),
Expand Down
4 changes: 2 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@
</script>

<svelte:head>
<title>AI usage dashboard</title>
<title>Token usage dashboard</title>
</svelte:head>

<header class="bar">
<a class="brand" href="/">
<Logo />
<span>AI usage</span>
<span>Token usage</span>
</a>

<div class="filters">
Expand Down
Loading