Contributing and license
The Token Usage Dashboard is open source. The source code is on GitHub: Flexible-Universe/Token-Usage-Dashboard.
Development environment for the Token Usage Dashboard
To develop the Token Usage Dashboard, all you need is Python 3.11 or newer. No pip install, no venv, no third-party packages. What the standard library does not have is either written or left out. This is how you start the dashboard and run the tests:
python3 app.py # start
python3 -m unittest discover -s tests -t . # tests, from the root directory
Token Usage Dashboard repository layout
The following table lists the main files and directories in the Token Usage Dashboard repository and their purpose:
| File | Purpose |
|---|---|
install.py | sets up the data directory, export scripts, config.toml and jobs |
install.sh, install.cmd | starters for macOS/Linux and Windows: find Python 3.11+, call install.py |
app.py | entry point, HTTP server, routing |
loader.py | configuration, reading monthly files, plausibility |
metrics.py | metrics from the daily data |
sources.py | reads the extra sources projects/, blocks/, sessions/, rtk/, status/ |
insights.py | metrics of the extra sources |
static/ | interface, language catalogues under static/i18n/, Chart.js under static/vendor/ |
export/ | export chain |
tools/make-sample-data.py | generates sample data |
docs/ | detailed documentation in English |
tests/ | tests using unittest |
Token Usage Dashboard tests
This is how you run the Token Usage Dashboard tests:
python3 -m unittest discover -s tests -t .
Always run the tests from the root directory. The interface tests run with node --test through tests/test_frontend.py.
Some reference tests compute against real export files. Without a data directory they skip themselves; the run is then green but covers less. To have them run, name the directory through the environment variable TOKEN_DASHBOARD_REAL_DATA, not through config.toml:
TOKEN_DASHBOARD_REAL_DATA="$HOME/Library/Application Support/Claude-Code-Usage" \
python3 -m unittest discover -s tests -t .
The test of the Windows starter runs on Windows only. On Linux and Windows a few installer tests that need launchd or a POSIX shell skip as well. The installer tests never change a real scheduler.
Conventions for Token Usage Dashboard contributions
A contribution to the Token Usage Dashboard has to follow these rules:
- One task, one commit. After every commit the full test run has to pass. Commit messages are in English.
- No umlauts in source code, comments and Markdown of the repository. Use
ue,ae,oe,ssinstead. - Visible texts only through the language catalogues.
static/i18n/de.jsandstatic/i18n/en.jsmust stay complete and in sync. A new backend message needs a key in its module and a sentence in both catalogues. - Missing calendar days are gaps, not zeros.
- No invented numbers. Estimates are marked visibly.
- Ratios from sums, not as a mean of ratios.
- No silent fallback. Broken files are rejected and reported, and so is a skipped check.
- Timestamps stay ISO-8601 UTC in the backend. Conversion to local time happens in the interface.
- Foreign text never through
innerHTML. Model names, project names, session IDs and message texts are set viacreateElementandtextContent. - Comments give reasons; they do not describe what the line already says.
For new features this order has proven itself: first a design (What does the source really deliver? Which number would be tempting but unfounded?), then a plan, then the test, then the implementation.
Adding a new data source to the Token Usage Dashboard
This is how you add a new data source to the Token Usage Dashboard:
sources.py: write the loader, normalize rows, report broken rows, add it to the list of extra sources.sources.py: add the checks for the source.insights.py: metrics, time series and coverage. If the source does not support a model filter, returnmodelFilterSupported: false.app.py: add the endpoint and add the source toDataStore.SUBDIRS. Without this entry the dashboard does not notice changed files of the source.static/: tab, panel, load and draw function.- Add tests and documentation.
What the Token Usage Dashboard deliberately does not do
The following table lists ideas the Token Usage Dashboard deliberately does not implement, and why:
| Idea | Why not |
|---|---|
| A monetary value for the RTK savings | There is no list price, only an empirical usage ratio |
| An RTK breakdown per command | Only available as an ASCII table; a parser would break silently as soon as the layout changes |
| Reconstructing project paths from the key | A hyphen inside a folder name cannot be told apart from the path separator |
| Trend forecast instead of the daily mean | The projection is meant to stay comprehensible |
| Third-party packages for charts or the server | The dashboard should start on any machine with Python |
Reporting security vulnerabilities in the Token Usage Dashboard
Report security vulnerabilities in the Token Usage Dashboard through GitHub Private Vulnerability Reporting: on the repository's Security tab, choose Report a vulnerability. Do not open a public issue for this, because everyone can read it before a fix is available.
Token Usage Dashboard license
The Token Usage Dashboard is licensed under the AGPL-3.0. The full text is in the LICENSE file in the repository, and the running server serves it at /LICENSE. There is no contributor license agreement; contributions are made under the AGPL-3.0 as well.
Section 13 of the license implies: anyone who runs the application, modified or not, for third parties over a network must offer those users the source code of their version. Anyone running it only for themselves is not affected.
Chart.js 4.4.1 is bundled under static/vendor/ under the MIT license.
Token Usage Dashboard trademark notice
The Token Usage Dashboard project is not affiliated with Anthropic or OpenAI, and is neither endorsed nor reviewed by them. Claude, Claude Code, OpenAI and Codex are trademarks of their respective owners. ccusage and rtk are independent third-party tools; the project merely reads their output.