open-usage 0.9.0 → 0.11.1
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.
- package/README.md +48 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -83,6 +83,50 @@ open-usage --help
|
|
|
83
83
|
|
|
84
84
|
Every control is also clickable, and the mouse wheel scrolls views taller than the terminal.
|
|
85
85
|
|
|
86
|
+
### Background daemon
|
|
87
|
+
|
|
88
|
+
The dashboard only refreshes while it is open.
|
|
89
|
+
If you would rather have current numbers waiting for you, run a daemon: it polls every provider on its own interval and keeps the same cache the dashboard reads, so the app opens on fresh figures instead of fetching them while you watch.
|
|
90
|
+
|
|
91
|
+
It is off until you start it.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
open-usage daemon start --interval 5 # minutes; remembered for next time
|
|
95
|
+
open-usage daemon status
|
|
96
|
+
open-usage daemon logs
|
|
97
|
+
open-usage daemon stop
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`status` reports the pid, the interval, how long ago the last poll ran, and the last error if one is standing:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
running · pid 4821 · every 5m · last poll 42s ago
|
|
104
|
+
log: ~/.config/open-usage/daemon.log
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A provider that stops working - an expired credential, a stale cookie - is named rather than counted as a healthy poll, and `last success` stops advancing until it recovers:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
running · pid 4821 · every 5m · last poll 42s ago
|
|
111
|
+
last error: cl: claude live limits unavailable (last success 3h ago)
|
|
112
|
+
log: ~/.config/open-usage/daemon.log
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The interval accepts 1 to 1440 minutes and is saved in `preferences.json`, so a later `daemon start` with no flag reuses it.
|
|
116
|
+
Starting a second daemon is refused while one is running; `daemon restart --interval 10` is how you change the cadence.
|
|
117
|
+
|
|
118
|
+
A daemon does not double your API traffic.
|
|
119
|
+
The dashboard treats a reading the daemon has cached as one of its own - at launch, and on every tick after - so a dashboard open beside a running daemon polls nothing the daemon has already fetched.
|
|
120
|
+
That includes the OpenCode dashboard's month history and usage table, which is the expensive part of a Go refresh: the daemon walks it, and the dashboard reads the result.
|
|
121
|
+
|
|
122
|
+
The log is kept to a megabyte while the daemon runs, with the previous stretch left beside it as `daemon.log.1`.
|
|
123
|
+
|
|
124
|
+
On Windows `daemon stop` terminates the daemon rather than asking it to finish, because Windows does not deliver the signal the other platforms use.
|
|
125
|
+
Nothing is lost by that: every file the daemon writes is written through a sibling and renamed into place, so an interrupted poll leaves the previous record intact.
|
|
126
|
+
|
|
127
|
+
The daemon does not survive a reboot on its own.
|
|
128
|
+
Start it from your login items, or supervise `open-usage daemon run --interval 5` with launchd or systemd - that form stays in the foreground and logs to stdout, which is what those want.
|
|
129
|
+
|
|
86
130
|
### Staying current
|
|
87
131
|
|
|
88
132
|
When a newer version has been published, the header says so:
|
|
@@ -142,6 +186,7 @@ OpenCode Go does not publish per-account limits, so its percentages are local es
|
|
|
142
186
|
|
|
143
187
|
Settings live in the app, on the `5` screen.
|
|
144
188
|
They persist to `~/.config/open-usage/preferences.json` (or `$XDG_CONFIG_HOME/open-usage/`).
|
|
189
|
+
The same directory holds the cached limits the app opens on (`usage-cache.json`), the cached Go history (`go-history.json`, about a megabyte for a busy workspace), the spend record (`spend-history.json`), and, while a daemon runs, its record and log (`daemon.json`, `daemon.log`).
|
|
145
190
|
|
|
146
191
|
| Variable | Purpose |
|
|
147
192
|
| ---------------------------- | ---------------------------------------------- |
|
|
@@ -175,6 +220,9 @@ Hand `open-usage` that session cookie and the Go card swaps its local estimate f
|
|
|
175
220
|
The config file is re-read on every poll, so a cookie pasted there lands within a minute - press `r` to skip the wait.
|
|
176
221
|
The environment variable is read once at launch, so exporting it means restarting the app.
|
|
177
222
|
|
|
223
|
+
The exact limits are two requests; the month history and the 30-day activity chart behind the Go screen are many more, so they are read every half hour rather than every poll, and `r` leaves them alone while the last reading is under five minutes old.
|
|
224
|
+
The first read walks the whole usage table - a busy workspace is several thousand rows - and the numbers on the overview do not wait for it; after that each read pages back only to the rows already held.
|
|
225
|
+
|
|
178
226
|
The cookie is optional, and it is also sufficient on its own.
|
|
179
227
|
Without it the Go card still works, on the local estimate; with it, OpenCode need not be installed at all, though a machine with no `opencode.db` has no token history to chart and the card says so.
|
|
180
228
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-usage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "A terminal dashboard for unified AI plan usage across Claude Code, Codex, and OpenCode Go",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-only",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"typescript": "^5"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"@open-usage/darwin-arm64": "0.
|
|
59
|
-
"@open-usage/linux-arm64": "0.
|
|
60
|
-
"@open-usage/linux-x64": "0.
|
|
61
|
-
"@open-usage/win32-arm64": "0.
|
|
62
|
-
"@open-usage/win32-x64": "0.
|
|
58
|
+
"@open-usage/darwin-arm64": "0.11.1",
|
|
59
|
+
"@open-usage/linux-arm64": "0.11.1",
|
|
60
|
+
"@open-usage/linux-x64": "0.11.1",
|
|
61
|
+
"@open-usage/win32-arm64": "0.11.1",
|
|
62
|
+
"@open-usage/win32-x64": "0.11.1"
|
|
63
63
|
}
|
|
64
64
|
}
|