claude-usage-tracker 0.1.0__py3-none-any.whl

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.
@@ -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,7 @@
1
+ claude_usage_tracker.py,sha256=jSg8T97pN-WAAG5E6wW2AZjdzDV7d9y-ySFFKq2yJbo,77523
2
+ claude_usage_tracker-0.1.0.dist-info/licenses/LICENSE,sha256=qkI_dMDYV22h7JzV4BHpBJ7OBlYrtl5j6xwRJVS5N6Y,1073
3
+ claude_usage_tracker-0.1.0.dist-info/METADATA,sha256=0gckLR2tqs4tO-NQWoGqDWX_b169mvN-L_P5qVvEdeA,6790
4
+ claude_usage_tracker-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
5
+ claude_usage_tracker-0.1.0.dist-info/entry_points.txt,sha256=ihW952pwjhxVrOjKjs6m-A68XomV0QlvVgl1kWfJtto,135
6
+ claude_usage_tracker-0.1.0.dist-info/top_level.txt,sha256=yqoriOz0Smgpc1p1wfMonbItEWLdAaKMvfibT4drezo,21
7
+ claude_usage_tracker-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ claude-usage-tracker = claude_usage_tracker:main
3
+
4
+ [gui_scripts]
5
+ claude-usage-tracker-gui = claude_usage_tracker:main
@@ -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 @@
1
+ claude_usage_tracker