claude-usage-tracker 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_usage_tracker-0.1.0/LICENSE +21 -0
- claude_usage_tracker-0.1.0/PKG-INFO +165 -0
- claude_usage_tracker-0.1.0/README.md +142 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/PKG-INFO +165 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/SOURCES.txt +10 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/dependency_links.txt +1 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/entry_points.txt +5 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/requires.txt +4 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.egg-info/top_level.txt +1 -0
- claude_usage_tracker-0.1.0/claude_usage_tracker.py +1811 -0
- claude_usage_tracker-0.1.0/pyproject.toml +41 -0
- claude_usage_tracker-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 paris-paraskevas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-usage-tracker
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Windows tray widget + dashboard for Claude plan usage (5-hour & weekly limits)
|
|
5
|
+
Author: paris-paraskevas
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/paris-paraskevas/claude-usage-tracker
|
|
8
|
+
Project-URL: Issues, https://github.com/paris-paraskevas/claude-usage-tracker/issues
|
|
9
|
+
Keywords: claude,anthropic,usage,tray,widget,windows
|
|
10
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pystray>=0.19
|
|
19
|
+
Requires-Dist: Pillow>=10
|
|
20
|
+
Requires-Dist: winotify>=1.1
|
|
21
|
+
Requires-Dist: pywebview>=5.0
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
<p align="center"><img src="docs/icon.png" width="84" alt="Claude Usage Tracker"></p>
|
|
25
|
+
|
|
26
|
+
# Claude Usage Tracker
|
|
27
|
+
|
|
28
|
+
A small Windows desktop widget that tracks your Claude plan limits — the **5-hour**
|
|
29
|
+
and **weekly** usage windows, the exact numbers the `/usage` command shows — with a
|
|
30
|
+
live always-on-top widget, a glass dashboard, a tray icon, and a toast notification
|
|
31
|
+
every time usage crosses a 20% mark.
|
|
32
|
+
|
|
33
|
+
It reads the OAuth token Claude Code already stores on your machine and calls the
|
|
34
|
+
same endpoint `/usage` uses. **Read-only** — it never modifies your credentials and
|
|
35
|
+
talks to nothing but that one Anthropic endpoint.
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="docs/widget.png" alt="Always-on-top mini widget" width="420"><br>
|
|
39
|
+
<em>The always-on-top mini widget (sample data)</em>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="docs/dashboard.png" alt="Dashboard" width="560"><br>
|
|
44
|
+
<em>The full dashboard — gauges, live reset countdowns, burn-rate, history, credits (sample data)</em>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **Always-on-top mini widget** — a tiny frameless, draggable strip that stays on
|
|
50
|
+
top so your usage is always glanceable. Toggle it from the tray.
|
|
51
|
+
- **Full dashboard** — animated ring gauges, live reset countdowns, a **burn-rate /
|
|
52
|
+
time-to-limit projection** ("≈7%/h · hits 100% in ~1h 10m"), a usage history
|
|
53
|
+
sparkline, overage credits, and per-model (Opus/Sonnet) scoped weekly limits.
|
|
54
|
+
- **Live tray icon** — two bars (left = 5h, right = weekly) that fill and change
|
|
55
|
+
colour with usage.
|
|
56
|
+
- **20% notifications** — a Windows toast each time the 5h or weekly window crosses
|
|
57
|
+
20 / 40 / 60 / 80 / 100%. The first reading is recorded silently, so you only get
|
|
58
|
+
pinged on *future* crossings, never a burst at startup.
|
|
59
|
+
- **Auto-start on login**, single-instance, graceful rate-limit (HTTP 429) back-off,
|
|
60
|
+
and automatic pickup of account/token changes (it re-reads your login each poll).
|
|
61
|
+
|
|
62
|
+
### Colour scale
|
|
63
|
+
|
|
64
|
+
Bars and gauges share one scale (low → high):
|
|
65
|
+
|
|
66
|
+
| Range | 0–20% | 20–60% | 60–80% | 80–90% | 90–99% | 100% |
|
|
67
|
+
|-------|:-----:|:------:|:------:|:------:|:------:|:----:|
|
|
68
|
+
| Colour | green | blue | orange | red | black | yellow |
|
|
69
|
+
|
|
70
|
+
The 90–99% "black" band gets a red glow/outline so it reads as danger rather than
|
|
71
|
+
empty.
|
|
72
|
+
|
|
73
|
+
<p align="center">
|
|
74
|
+
<img src="docs/tray-icons.png" alt="Tray icon at various usage levels" width="560"><br>
|
|
75
|
+
<em>Tray icon at 5/40, 45/72, 85/94, 95/100, and 0/0 percent</em>
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
**Requirements**
|
|
81
|
+
- Windows 10 / 11
|
|
82
|
+
- Python 3.11+ — install from [python.org](https://www.python.org/downloads/) and tick
|
|
83
|
+
**"Add python.exe to PATH"**
|
|
84
|
+
- Claude Code installed and logged in, so `~/.claude/.credentials.json` exists
|
|
85
|
+
- Edge **WebView2** runtime (preinstalled on Windows 11; otherwise a free
|
|
86
|
+
[download](https://developer.microsoft.com/microsoft-edge/webview2/)) — for the
|
|
87
|
+
dashboard/widget windows
|
|
88
|
+
|
|
89
|
+
**Steps**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/paris-paraskevas/claude-usage-tracker.git
|
|
93
|
+
cd claude-usage-tracker
|
|
94
|
+
python install.py
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
That's all. `install.py` will:
|
|
98
|
+
1. create a local virtualenv (`.venv`) and install dependencies,
|
|
99
|
+
2. generate the app icon,
|
|
100
|
+
3. add **Desktop + Start Menu + Startup** shortcuts (so it auto-starts on login).
|
|
101
|
+
|
|
102
|
+
Then launch **Claude Usage Tracker** from the Start Menu or Desktop (or run the
|
|
103
|
+
command `install.py` prints). The mini widget appears top-right and a tray icon
|
|
104
|
+
appears by the clock. Uninstall the shortcuts any time with `python uninstall.py`.
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
Launch "Claude Usage Tracker" from the Start Menu/Desktop, or run it directly:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Tray menu: **Show/Hide widget**, **Open dashboard** (native window), **Open in
|
|
115
|
+
browser**, **Refresh now**, open config/log, **Quit**. The widget has a `×` to hide
|
|
116
|
+
it; drag it anywhere.
|
|
117
|
+
|
|
118
|
+
CLI:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once # print status once
|
|
122
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once --debug # + raw API JSON
|
|
123
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --widget # just the widget
|
|
124
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --window # just the dashboard window
|
|
125
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --uninstall-autostart
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
Edit `config.json` (created on first run, in the app's data dir), then restart:
|
|
131
|
+
|
|
132
|
+
| Key | Default | Meaning |
|
|
133
|
+
|-----|---------|---------|
|
|
134
|
+
| `poll_interval_seconds` | `60` | How often to check usage. |
|
|
135
|
+
| `threshold_step` | `20` | Ping every N percent. |
|
|
136
|
+
| `windows` | `["five_hour", "seven_day"]` | Which limits to notify on. |
|
|
137
|
+
| `notify_at_100` | `true` | Ping when a limit hits 100%. |
|
|
138
|
+
| `notify_on_start` | `true` | One summary toast at launch. |
|
|
139
|
+
| `dashboard_port` | `8787` | Local dashboard port. |
|
|
140
|
+
| `show_widget_on_start` | `true` | Show the mini widget at launch. |
|
|
141
|
+
| `widget_width` / `widget_height` | `392` / `150` | Widget size in pixels. |
|
|
142
|
+
|
|
143
|
+
## How it works
|
|
144
|
+
|
|
145
|
+
`GET https://api.anthropic.com/api/oauth/usage` with the bearer token from
|
|
146
|
+
`~/.claude/.credentials.json` (`claudeAiOauth.accessToken`) and the
|
|
147
|
+
`anthropic-beta: oauth-2025-04-20` header. The response carries `five_hour`,
|
|
148
|
+
`seven_day`, scoped per-model weekly limits, overage `spend`, and reset timestamps —
|
|
149
|
+
the same data the CLI's `/usage` renders.
|
|
150
|
+
|
|
151
|
+
Token refresh is handled by Claude Code itself; if your login expires, the tracker
|
|
152
|
+
shows an error state until you run any `claude` command to refresh it. The token is
|
|
153
|
+
only ever read — never written, logged, or sent anywhere but that endpoint.
|
|
154
|
+
|
|
155
|
+
## Layout
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
claude_usage_tracker.py the whole app (tray, server, dashboard+widget HTML, poller)
|
|
159
|
+
install.py / uninstall.py shortcut setup / teardown
|
|
160
|
+
requirements.txt pystray, Pillow, winotify, pywebview
|
|
161
|
+
docs/ screenshots
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Runtime files (`config.json`, `state.json`, `history.json`, `*.log`) live next to the
|
|
165
|
+
script (or in `%LOCALAPPDATA%\ClaudeUsageTracker` when packaged) and are git-ignored.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<p align="center"><img src="docs/icon.png" width="84" alt="Claude Usage Tracker"></p>
|
|
2
|
+
|
|
3
|
+
# Claude Usage Tracker
|
|
4
|
+
|
|
5
|
+
A small Windows desktop widget that tracks your Claude plan limits — the **5-hour**
|
|
6
|
+
and **weekly** usage windows, the exact numbers the `/usage` command shows — with a
|
|
7
|
+
live always-on-top widget, a glass dashboard, a tray icon, and a toast notification
|
|
8
|
+
every time usage crosses a 20% mark.
|
|
9
|
+
|
|
10
|
+
It reads the OAuth token Claude Code already stores on your machine and calls the
|
|
11
|
+
same endpoint `/usage` uses. **Read-only** — it never modifies your credentials and
|
|
12
|
+
talks to nothing but that one Anthropic endpoint.
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="docs/widget.png" alt="Always-on-top mini widget" width="420"><br>
|
|
16
|
+
<em>The always-on-top mini widget (sample data)</em>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="docs/dashboard.png" alt="Dashboard" width="560"><br>
|
|
21
|
+
<em>The full dashboard — gauges, live reset countdowns, burn-rate, history, credits (sample data)</em>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Always-on-top mini widget** — a tiny frameless, draggable strip that stays on
|
|
27
|
+
top so your usage is always glanceable. Toggle it from the tray.
|
|
28
|
+
- **Full dashboard** — animated ring gauges, live reset countdowns, a **burn-rate /
|
|
29
|
+
time-to-limit projection** ("≈7%/h · hits 100% in ~1h 10m"), a usage history
|
|
30
|
+
sparkline, overage credits, and per-model (Opus/Sonnet) scoped weekly limits.
|
|
31
|
+
- **Live tray icon** — two bars (left = 5h, right = weekly) that fill and change
|
|
32
|
+
colour with usage.
|
|
33
|
+
- **20% notifications** — a Windows toast each time the 5h or weekly window crosses
|
|
34
|
+
20 / 40 / 60 / 80 / 100%. The first reading is recorded silently, so you only get
|
|
35
|
+
pinged on *future* crossings, never a burst at startup.
|
|
36
|
+
- **Auto-start on login**, single-instance, graceful rate-limit (HTTP 429) back-off,
|
|
37
|
+
and automatic pickup of account/token changes (it re-reads your login each poll).
|
|
38
|
+
|
|
39
|
+
### Colour scale
|
|
40
|
+
|
|
41
|
+
Bars and gauges share one scale (low → high):
|
|
42
|
+
|
|
43
|
+
| Range | 0–20% | 20–60% | 60–80% | 80–90% | 90–99% | 100% |
|
|
44
|
+
|-------|:-----:|:------:|:------:|:------:|:------:|:----:|
|
|
45
|
+
| Colour | green | blue | orange | red | black | yellow |
|
|
46
|
+
|
|
47
|
+
The 90–99% "black" band gets a red glow/outline so it reads as danger rather than
|
|
48
|
+
empty.
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<img src="docs/tray-icons.png" alt="Tray icon at various usage levels" width="560"><br>
|
|
52
|
+
<em>Tray icon at 5/40, 45/72, 85/94, 95/100, and 0/0 percent</em>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
**Requirements**
|
|
58
|
+
- Windows 10 / 11
|
|
59
|
+
- Python 3.11+ — install from [python.org](https://www.python.org/downloads/) and tick
|
|
60
|
+
**"Add python.exe to PATH"**
|
|
61
|
+
- Claude Code installed and logged in, so `~/.claude/.credentials.json` exists
|
|
62
|
+
- Edge **WebView2** runtime (preinstalled on Windows 11; otherwise a free
|
|
63
|
+
[download](https://developer.microsoft.com/microsoft-edge/webview2/)) — for the
|
|
64
|
+
dashboard/widget windows
|
|
65
|
+
|
|
66
|
+
**Steps**
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/paris-paraskevas/claude-usage-tracker.git
|
|
70
|
+
cd claude-usage-tracker
|
|
71
|
+
python install.py
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
That's all. `install.py` will:
|
|
75
|
+
1. create a local virtualenv (`.venv`) and install dependencies,
|
|
76
|
+
2. generate the app icon,
|
|
77
|
+
3. add **Desktop + Start Menu + Startup** shortcuts (so it auto-starts on login).
|
|
78
|
+
|
|
79
|
+
Then launch **Claude Usage Tracker** from the Start Menu or Desktop (or run the
|
|
80
|
+
command `install.py` prints). The mini widget appears top-right and a tray icon
|
|
81
|
+
appears by the clock. Uninstall the shortcuts any time with `python uninstall.py`.
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
Launch "Claude Usage Tracker" from the Start Menu/Desktop, or run it directly:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Tray menu: **Show/Hide widget**, **Open dashboard** (native window), **Open in
|
|
92
|
+
browser**, **Refresh now**, open config/log, **Quit**. The widget has a `×` to hide
|
|
93
|
+
it; drag it anywhere.
|
|
94
|
+
|
|
95
|
+
CLI:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once # print status once
|
|
99
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once --debug # + raw API JSON
|
|
100
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --widget # just the widget
|
|
101
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --window # just the dashboard window
|
|
102
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --uninstall-autostart
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
Edit `config.json` (created on first run, in the app's data dir), then restart:
|
|
108
|
+
|
|
109
|
+
| Key | Default | Meaning |
|
|
110
|
+
|-----|---------|---------|
|
|
111
|
+
| `poll_interval_seconds` | `60` | How often to check usage. |
|
|
112
|
+
| `threshold_step` | `20` | Ping every N percent. |
|
|
113
|
+
| `windows` | `["five_hour", "seven_day"]` | Which limits to notify on. |
|
|
114
|
+
| `notify_at_100` | `true` | Ping when a limit hits 100%. |
|
|
115
|
+
| `notify_on_start` | `true` | One summary toast at launch. |
|
|
116
|
+
| `dashboard_port` | `8787` | Local dashboard port. |
|
|
117
|
+
| `show_widget_on_start` | `true` | Show the mini widget at launch. |
|
|
118
|
+
| `widget_width` / `widget_height` | `392` / `150` | Widget size in pixels. |
|
|
119
|
+
|
|
120
|
+
## How it works
|
|
121
|
+
|
|
122
|
+
`GET https://api.anthropic.com/api/oauth/usage` with the bearer token from
|
|
123
|
+
`~/.claude/.credentials.json` (`claudeAiOauth.accessToken`) and the
|
|
124
|
+
`anthropic-beta: oauth-2025-04-20` header. The response carries `five_hour`,
|
|
125
|
+
`seven_day`, scoped per-model weekly limits, overage `spend`, and reset timestamps —
|
|
126
|
+
the same data the CLI's `/usage` renders.
|
|
127
|
+
|
|
128
|
+
Token refresh is handled by Claude Code itself; if your login expires, the tracker
|
|
129
|
+
shows an error state until you run any `claude` command to refresh it. The token is
|
|
130
|
+
only ever read — never written, logged, or sent anywhere but that endpoint.
|
|
131
|
+
|
|
132
|
+
## Layout
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
claude_usage_tracker.py the whole app (tray, server, dashboard+widget HTML, poller)
|
|
136
|
+
install.py / uninstall.py shortcut setup / teardown
|
|
137
|
+
requirements.txt pystray, Pillow, winotify, pywebview
|
|
138
|
+
docs/ screenshots
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Runtime files (`config.json`, `state.json`, `history.json`, `*.log`) live next to the
|
|
142
|
+
script (or in `%LOCALAPPDATA%\ClaudeUsageTracker` when packaged) and are git-ignored.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-usage-tracker
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Windows tray widget + dashboard for Claude plan usage (5-hour & weekly limits)
|
|
5
|
+
Author: paris-paraskevas
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/paris-paraskevas/claude-usage-tracker
|
|
8
|
+
Project-URL: Issues, https://github.com/paris-paraskevas/claude-usage-tracker/issues
|
|
9
|
+
Keywords: claude,anthropic,usage,tray,widget,windows
|
|
10
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Topic :: Utilities
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: pystray>=0.19
|
|
19
|
+
Requires-Dist: Pillow>=10
|
|
20
|
+
Requires-Dist: winotify>=1.1
|
|
21
|
+
Requires-Dist: pywebview>=5.0
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
<p align="center"><img src="docs/icon.png" width="84" alt="Claude Usage Tracker"></p>
|
|
25
|
+
|
|
26
|
+
# Claude Usage Tracker
|
|
27
|
+
|
|
28
|
+
A small Windows desktop widget that tracks your Claude plan limits — the **5-hour**
|
|
29
|
+
and **weekly** usage windows, the exact numbers the `/usage` command shows — with a
|
|
30
|
+
live always-on-top widget, a glass dashboard, a tray icon, and a toast notification
|
|
31
|
+
every time usage crosses a 20% mark.
|
|
32
|
+
|
|
33
|
+
It reads the OAuth token Claude Code already stores on your machine and calls the
|
|
34
|
+
same endpoint `/usage` uses. **Read-only** — it never modifies your credentials and
|
|
35
|
+
talks to nothing but that one Anthropic endpoint.
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="docs/widget.png" alt="Always-on-top mini widget" width="420"><br>
|
|
39
|
+
<em>The always-on-top mini widget (sample data)</em>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="docs/dashboard.png" alt="Dashboard" width="560"><br>
|
|
44
|
+
<em>The full dashboard — gauges, live reset countdowns, burn-rate, history, credits (sample data)</em>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **Always-on-top mini widget** — a tiny frameless, draggable strip that stays on
|
|
50
|
+
top so your usage is always glanceable. Toggle it from the tray.
|
|
51
|
+
- **Full dashboard** — animated ring gauges, live reset countdowns, a **burn-rate /
|
|
52
|
+
time-to-limit projection** ("≈7%/h · hits 100% in ~1h 10m"), a usage history
|
|
53
|
+
sparkline, overage credits, and per-model (Opus/Sonnet) scoped weekly limits.
|
|
54
|
+
- **Live tray icon** — two bars (left = 5h, right = weekly) that fill and change
|
|
55
|
+
colour with usage.
|
|
56
|
+
- **20% notifications** — a Windows toast each time the 5h or weekly window crosses
|
|
57
|
+
20 / 40 / 60 / 80 / 100%. The first reading is recorded silently, so you only get
|
|
58
|
+
pinged on *future* crossings, never a burst at startup.
|
|
59
|
+
- **Auto-start on login**, single-instance, graceful rate-limit (HTTP 429) back-off,
|
|
60
|
+
and automatic pickup of account/token changes (it re-reads your login each poll).
|
|
61
|
+
|
|
62
|
+
### Colour scale
|
|
63
|
+
|
|
64
|
+
Bars and gauges share one scale (low → high):
|
|
65
|
+
|
|
66
|
+
| Range | 0–20% | 20–60% | 60–80% | 80–90% | 90–99% | 100% |
|
|
67
|
+
|-------|:-----:|:------:|:------:|:------:|:------:|:----:|
|
|
68
|
+
| Colour | green | blue | orange | red | black | yellow |
|
|
69
|
+
|
|
70
|
+
The 90–99% "black" band gets a red glow/outline so it reads as danger rather than
|
|
71
|
+
empty.
|
|
72
|
+
|
|
73
|
+
<p align="center">
|
|
74
|
+
<img src="docs/tray-icons.png" alt="Tray icon at various usage levels" width="560"><br>
|
|
75
|
+
<em>Tray icon at 5/40, 45/72, 85/94, 95/100, and 0/0 percent</em>
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
**Requirements**
|
|
81
|
+
- Windows 10 / 11
|
|
82
|
+
- Python 3.11+ — install from [python.org](https://www.python.org/downloads/) and tick
|
|
83
|
+
**"Add python.exe to PATH"**
|
|
84
|
+
- Claude Code installed and logged in, so `~/.claude/.credentials.json` exists
|
|
85
|
+
- Edge **WebView2** runtime (preinstalled on Windows 11; otherwise a free
|
|
86
|
+
[download](https://developer.microsoft.com/microsoft-edge/webview2/)) — for the
|
|
87
|
+
dashboard/widget windows
|
|
88
|
+
|
|
89
|
+
**Steps**
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/paris-paraskevas/claude-usage-tracker.git
|
|
93
|
+
cd claude-usage-tracker
|
|
94
|
+
python install.py
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
That's all. `install.py` will:
|
|
98
|
+
1. create a local virtualenv (`.venv`) and install dependencies,
|
|
99
|
+
2. generate the app icon,
|
|
100
|
+
3. add **Desktop + Start Menu + Startup** shortcuts (so it auto-starts on login).
|
|
101
|
+
|
|
102
|
+
Then launch **Claude Usage Tracker** from the Start Menu or Desktop (or run the
|
|
103
|
+
command `install.py` prints). The mini widget appears top-right and a tray icon
|
|
104
|
+
appears by the clock. Uninstall the shortcuts any time with `python uninstall.py`.
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
Launch "Claude Usage Tracker" from the Start Menu/Desktop, or run it directly:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Tray menu: **Show/Hide widget**, **Open dashboard** (native window), **Open in
|
|
115
|
+
browser**, **Refresh now**, open config/log, **Quit**. The widget has a `×` to hide
|
|
116
|
+
it; drag it anywhere.
|
|
117
|
+
|
|
118
|
+
CLI:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once # print status once
|
|
122
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --once --debug # + raw API JSON
|
|
123
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --widget # just the widget
|
|
124
|
+
.venv\Scripts\pythonw.exe claude_usage_tracker.py --window # just the dashboard window
|
|
125
|
+
.venv\Scripts\python.exe claude_usage_tracker.py --uninstall-autostart
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Configuration
|
|
129
|
+
|
|
130
|
+
Edit `config.json` (created on first run, in the app's data dir), then restart:
|
|
131
|
+
|
|
132
|
+
| Key | Default | Meaning |
|
|
133
|
+
|-----|---------|---------|
|
|
134
|
+
| `poll_interval_seconds` | `60` | How often to check usage. |
|
|
135
|
+
| `threshold_step` | `20` | Ping every N percent. |
|
|
136
|
+
| `windows` | `["five_hour", "seven_day"]` | Which limits to notify on. |
|
|
137
|
+
| `notify_at_100` | `true` | Ping when a limit hits 100%. |
|
|
138
|
+
| `notify_on_start` | `true` | One summary toast at launch. |
|
|
139
|
+
| `dashboard_port` | `8787` | Local dashboard port. |
|
|
140
|
+
| `show_widget_on_start` | `true` | Show the mini widget at launch. |
|
|
141
|
+
| `widget_width` / `widget_height` | `392` / `150` | Widget size in pixels. |
|
|
142
|
+
|
|
143
|
+
## How it works
|
|
144
|
+
|
|
145
|
+
`GET https://api.anthropic.com/api/oauth/usage` with the bearer token from
|
|
146
|
+
`~/.claude/.credentials.json` (`claudeAiOauth.accessToken`) and the
|
|
147
|
+
`anthropic-beta: oauth-2025-04-20` header. The response carries `five_hour`,
|
|
148
|
+
`seven_day`, scoped per-model weekly limits, overage `spend`, and reset timestamps —
|
|
149
|
+
the same data the CLI's `/usage` renders.
|
|
150
|
+
|
|
151
|
+
Token refresh is handled by Claude Code itself; if your login expires, the tracker
|
|
152
|
+
shows an error state until you run any `claude` command to refresh it. The token is
|
|
153
|
+
only ever read — never written, logged, or sent anywhere but that endpoint.
|
|
154
|
+
|
|
155
|
+
## Layout
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
claude_usage_tracker.py the whole app (tray, server, dashboard+widget HTML, poller)
|
|
159
|
+
install.py / uninstall.py shortcut setup / teardown
|
|
160
|
+
requirements.txt pystray, Pillow, winotify, pywebview
|
|
161
|
+
docs/ screenshots
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Runtime files (`config.json`, `state.json`, `history.json`, `*.log`) live next to the
|
|
165
|
+
script (or in `%LOCALAPPDATA%\ClaudeUsageTracker` when packaged) and are git-ignored.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
claude_usage_tracker.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
claude_usage_tracker.egg-info/PKG-INFO
|
|
6
|
+
claude_usage_tracker.egg-info/SOURCES.txt
|
|
7
|
+
claude_usage_tracker.egg-info/dependency_links.txt
|
|
8
|
+
claude_usage_tracker.egg-info/entry_points.txt
|
|
9
|
+
claude_usage_tracker.egg-info/requires.txt
|
|
10
|
+
claude_usage_tracker.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
claude_usage_tracker
|