open-usage 0.3.0 → 0.3.2

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.
Files changed (2) hide show
  1. package/README.md +49 -1
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -83,6 +83,17 @@ 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
+ ### Staying current
87
+
88
+ When a newer version has been published, the header says so:
89
+
90
+ ```
91
+ OPEN USAGE v0.4.0 available ▏ 3 providers ▏ ✓ all clear ▏ updated now
92
+ ```
93
+
94
+ Update with the same command that installed it - `bun install -g open-usage@latest`, or the npm, pnpm or yarn equivalent.
95
+ The check runs at most once a day, and [Configuration](#configuration) below covers switching it off.
96
+
86
97
  ## What it reads
87
98
 
88
99
  | Provider | Limits from | History from |
@@ -91,6 +102,9 @@ Every control is also clickable, and the mouse wheel scrolls views taller than t
91
102
  | Codex | a sandboxed `codex app-server` | `~/.codex/sessions` |
92
103
  | OpenCode Go | local estimate, or the dashboard cookie | `opencode.db` |
93
104
 
105
+ Those three are what ships today.
106
+ More providers are planned, so if a plan you pay for is missing, [open an issue](https://github.com/arionrefat/open-usage/issues) and say which one.
107
+
94
108
  `open-usage` is read-only, and there is no account to create and no key to paste.
95
109
  It reuses the logins your CLIs already have: Claude and Codex limits come from their own signed-in CLIs, so their credentials are never read.
96
110
  The one credential file it opens is OpenCode's `auth.json`, and only to show connection status - the key is masked on read and never displayed, logged, or sent anywhere.
@@ -102,7 +116,7 @@ The other asks `registry.npmjs.org` whether a newer version has been published,
102
116
  Set `OPEN_USAGE_NO_UPDATE_CHECK` to switch it off.
103
117
 
104
118
  OpenCode Go does not publish per-account limits, so its percentages are local estimates and are labelled as such in the UI.
105
- Configuring the cookie below replaces those estimates with exact figures, and is enough on its own: OpenCode itself need not be installed, though without it the Go card has no token history to chart.
119
+ [Exact OpenCode Go limits](#exact-opencode-go-limits) below covers the optional cookie that replaces them with the dashboard's own figures.
106
120
  [docs/PROVIDERS.md](docs/PROVIDERS.md) explains how each number is derived.
107
121
 
108
122
  ## Configuration
@@ -118,6 +132,40 @@ They persist to `~/.config/open-usage/preferences.json` (or `$XDG_CONFIG_HOME/op
118
132
  | `OPEN_USAGE_OPENCODE_COOKIE` | exact OpenCode Go windows, no install needed |
119
133
  | `OPEN_USAGE_NO_UPDATE_CHECK` | set to anything to stop the daily version check |
120
134
 
135
+ ### Exact OpenCode Go limits
136
+
137
+ OpenCode publishes Go plan usage to its dashboard but not to any public API, so the exact numbers sit behind your signed-in `opencode.ai` session.
138
+ Hand `open-usage` that session cookie and the Go card swaps its local estimate for the dashboard's own rolling, weekly, and monthly figures.
139
+
140
+ 1. Sign in at [opencode.ai](https://opencode.ai) and open the dashboard.
141
+ 2. Open devtools and find the cookie store: **Application → Cookies** in Chrome and Edge, **Storage → Cookies** in Firefox and Safari.
142
+ 3. Select `https://opencode.ai` and copy the value of the `auth` cookie - `__Host-auth` if that is the name your browser holds.
143
+ 4. Give it to `open-usage`, either in `~/.config/open-usage/config.json` - a file you create, separate from `preferences.json`:
144
+
145
+ ```json
146
+ { "opencodeCookie": "auth=<value>" }
147
+ ```
148
+
149
+ or per-shell:
150
+
151
+ ```bash
152
+ export OPEN_USAGE_OPENCODE_COOKIE='auth=<value>'
153
+ ```
154
+
155
+ The config file is re-read on every poll, so a cookie pasted there lands within a minute - press `r` to skip the wait.
156
+ The environment variable is read once at launch, so exporting it means restarting the app.
157
+
158
+ The cookie is optional, and it is also sufficient on its own.
159
+ 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.
160
+
161
+ Only the `auth` / `__Host-auth` pair is ever sent, and anything else in a pasted header is stripped before the request leaves your machine.
162
+ The cookie carries its own expiry, and the card warns you through its final seven days and again once it lapses, so a dead session cannot quietly pass for a live one.
163
+ If the dashboard changes shape underneath it, the card falls back to the estimate with a note rather than showing a figure it can no longer stand behind.
164
+
165
+ Treat the value like a password: it is a full dashboard credential, not a usage-scoped token.
166
+ Prefer the config file over the environment variable to keep it out of your shell history, never paste it into a bug report, and know that nobody should ever ask you for it.
167
+ This is deliberately a manual step - `open-usage` never reads your browser's cookie jar for you.
168
+
121
169
  ## Development
122
170
 
123
171
  Requires [Bun](https://bun.sh) 1.0 or newer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-usage",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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",
@@ -54,10 +54,10 @@
54
54
  "typescript": "^5"
55
55
  },
56
56
  "optionalDependencies": {
57
- "@open-usage/darwin-arm64": "0.3.0",
58
- "@open-usage/linux-arm64": "0.3.0",
59
- "@open-usage/linux-x64": "0.3.0",
60
- "@open-usage/win32-arm64": "0.3.0",
61
- "@open-usage/win32-x64": "0.3.0"
57
+ "@open-usage/darwin-arm64": "0.3.2",
58
+ "@open-usage/linux-arm64": "0.3.2",
59
+ "@open-usage/linux-x64": "0.3.2",
60
+ "@open-usage/win32-arm64": "0.3.2",
61
+ "@open-usage/win32-x64": "0.3.2"
62
62
  }
63
63
  }