@hk_net/pi-usage-bars 0.4.1 → 0.4.3
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/CHANGELOG.md +28 -0
- package/LICENSE +21 -21
- package/README.md +129 -127
- package/docs/provider-research.md +39 -0
- package/docs/releasing.md +84 -84
- package/extensions/usage-bars/core.ts +1274 -1268
- package/extensions/usage-bars/index.ts +672 -665
- package/package.json +66 -66
- package/docs/financial-metrics-plan.md +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## [0.4.3] - 2026-08-22
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Resolve kimi-coding OAuth credentials that Pi exposes only as a Bearer `Authorization` header (no `apiKey`), so the Kimi For Coding usage indicator no longer reports "auth resolution failed (configured authentication did not resolve a token)". Thanks to [@Rakkael](https://github.com/Rakkael) for the contribution in [#2](https://github.com/hknet/pi-usage-bars/pull/2).
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Updated the development and test baseline to Pi SDK 0.84.2 while retaining runtime compatibility with Pi 0.81.1 and newer.
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
- Recorded Qwen Token Plan and Baseten usage-API research, including the conditions for revisiting provider support.
|
|
18
|
+
|
|
19
|
+
## [0.4.2] - 2026-08-13
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Added support for credit-based ZAI plan tiers that report `CREDIT_LIMIT` quota windows. Thanks to [@chrislucca](https://github.com/chrislucca) for the contribution in [#1](https://github.com/hknet/pi-usage-bars/pull/1).
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Updated the development and test baseline to Pi SDK 0.84.1 while retaining runtime compatibility with Pi 0.81.1 and newer.
|
|
28
|
+
|
|
29
|
+
### Security
|
|
30
|
+
|
|
31
|
+
- Updated the Pi SDK development dependency chain to use `undici` 8.9.0, resolving the advisories affecting earlier 8.x releases.
|
|
32
|
+
|
|
5
33
|
## [0.4.1] - 2026-07-31
|
|
6
34
|
|
|
7
35
|
### Fixed
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 ajarellanod and hknet
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ajarellanod and hknet
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,127 +1,129 @@
|
|
|
1
|
-
# pi-usage-bars
|
|
2
|
-
|
|
3
|
-
Quota, balance, and spend indicators for [Pi](https://github.com/earendil-works/pi).
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
It adds:
|
|
8
|
-
|
|
9
|
-
- a footer status bar for the active supported provider
|
|
10
|
-
- a `/usage` command showing configured quota, balance, and spend data
|
|
11
|
-
|
|
12
|
-
## Supported providers
|
|
13
|
-
|
|
14
|
-
| Provider | Pi provider ID | Authentication |
|
|
15
|
-
| --- | --- | --- |
|
|
16
|
-
| OpenAI Codex | `openai-codex` | ChatGPT subscription OAuth |
|
|
17
|
-
| Anthropic Claude | `anthropic` | Claude Pro/Max OAuth |
|
|
18
|
-
| ZAI Coding Plan (Global) | `zai` | ZAI API key |
|
|
19
|
-
| ZAI Coding Plan (China) | `zai-coding-cn` | ZAI China API key |
|
|
20
|
-
| Kimi For Coding | `kimi-coding` | Kimi Coding Plan API key |
|
|
21
|
-
| MiniMax Coding Plan (Global) | `minimax` | MiniMax Global API key |
|
|
22
|
-
| MiniMax Coding Plan (China) | `minimax-cn` | MiniMax China API key |
|
|
23
|
-
| OpenRouter | `openrouter` | OpenRouter API key |
|
|
24
|
-
| DeepSeek | `deepseek` | DeepSeek API key |
|
|
25
|
-
| Moonshot/Kimi API (Global) | `moonshotai` | Moonshot Global API key |
|
|
26
|
-
| Moonshot/Kimi API (China) | `moonshotai-cn` | Moonshot China API key |
|
|
27
|
-
|
|
28
|
-
DeepSeek shows total, topped-up, and granted balances in the currency returned by the API. Moonshot shows available, cash, and voucher balances; this is separate from the Kimi For Coding subscription provider. Pi uses `MOONSHOT_API_KEY` for both Moonshot regions, so `/usage` automatically hides the expected authentication failure from the region where a shared environment key is not valid.
|
|
29
|
-
|
|
30
|
-
OpenRouter shows the account credit balance and current daily, weekly, and monthly key spend. If the API key has a configured credit limit, that limit is also rendered as a usage bar.
|
|
31
|
-
|
|
32
|
-
MiniMax Subscription Keys can represent an active Token Plan, purchased Credits, or both. The extension shows quota windows when present and a neutral credit-balance line if a first-party key-authenticated response exposes `points_balance`/`credits_balance`. MiniMax currently exposes Credits-only balances through a console endpoint requiring browser-cookie authentication, so a key-only Credits account is shown as “No active Token Plan” with a direction to check the console rather than a fabricated percentage. The extension does not import browser cookies.
|
|
33
|
-
|
|
34
|
-
Google Gemini CLI and Google Antigravity are not supported because Pi removed those built-in providers in version 0.71.0.
|
|
35
|
-
|
|
36
|
-
## Requirements
|
|
37
|
-
|
|
38
|
-
- Pi 0.81.1 or newer
|
|
39
|
-
- Node.js 22.19 or newer when using the npm-distributed Pi CLI
|
|
40
|
-
|
|
41
|
-
Authenticate providers through Pi's `/login` command. The extension resolves credentials through Pi's provider API; it does not read or write `auth.json` itself.
|
|
42
|
-
|
|
43
|
-
## Install
|
|
44
|
-
|
|
45
|
-
Install the npm package:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pi install npm:@hk_net/pi-usage-bars
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Or install the latest source directly from GitHub:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pi install https://github.com/hknet/pi-usage-bars
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Restart Pi after installation, or use `/reload` when the package is already installed.
|
|
58
|
-
|
|
59
|
-
Update an existing npm installation with:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
pi update npm:@hk_net/pi-usage-bars
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Use
|
|
66
|
-
|
|
67
|
-
### Footer usage bars
|
|
68
|
-
|
|
69
|
-
When the active model belongs to a configured supported provider, the footer shows its available quota windows with reset countdowns when provided by the service.
|
|
70
|
-
|
|
71
|
-

|
|
72
|
-
|
|
73
|
-
Usage refresh runs in interactive TUI sessions every two minutes. It does not run in print, JSON, or RPC mode.
|
|
74
|
-
|
|
75
|
-
### `/usage`
|
|
76
|
-
|
|
77
|
-
Run `/usage` to open a searchable list of configured supported providers.
|
|
78
|
-
|
|
79
|
-

|
|
80
|
-
|
|
81
|
-
## Endpoint configuration
|
|
82
|
-
|
|
83
|
-
First-party monitoring endpoints can be overridden:
|
|
84
|
-
|
|
85
|
-
| Variable | Default |
|
|
86
|
-
| --- | --- |
|
|
87
|
-
| `PI_ZAI_USAGE_ENDPOINT` | `https://api.z.ai/api/monitor/usage/quota/limit` |
|
|
88
|
-
| `PI_ZAI_CODING_CN_USAGE_ENDPOINT` | `https://open.bigmodel.cn/api/monitor/usage/quota/limit` |
|
|
89
|
-
| `PI_KIMI_USAGE_ENDPOINT` | `https://api.kimi.com/coding/v1/usages` |
|
|
90
|
-
| `PI_MINIMAX_USAGE_ENDPOINT` | `https://api.minimax.io/v1/token_plan/remains` |
|
|
91
|
-
| `PI_MINIMAX_LEGACY_USAGE_ENDPOINT` | `https://api.minimax.io/v1/api/openplatform/coding_plan/remains` |
|
|
92
|
-
| `PI_MINIMAX_CN_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/token_plan/remains` |
|
|
93
|
-
| `PI_MINIMAX_CN_LEGACY_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/api/openplatform/coding_plan/remains` |
|
|
94
|
-
| `PI_OPENROUTER_CREDITS_ENDPOINT` | `https://openrouter.ai/api/v1/credits` |
|
|
95
|
-
| `PI_OPENROUTER_KEY_ENDPOINT` | `https://openrouter.ai/api/v1/key` |
|
|
96
|
-
| `PI_DEEPSEEK_BALANCE_ENDPOINT` | `https://api.deepseek.com/user/balance` |
|
|
97
|
-
| `PI_MOONSHOT_BALANCE_ENDPOINT` | `https://api.moonshot.ai/v1/users/me/balance` |
|
|
98
|
-
| `PI_MOONSHOT_CN_BALANCE_ENDPOINT` | `https://api.moonshot.cn/v1/users/me/balance` |
|
|
99
|
-
|
|
100
|
-
**Security:** the corresponding provider token is sent as a bearer token to the configured endpoint. Only override these variables with an endpoint you trust.
|
|
101
|
-
|
|
102
|
-
The Codex and Claude usage endpoints are fixed to their first-party services. Claude responses are cached briefly in the system temporary directory to coordinate multiple Pi processes and reduce rate limiting. The cache contains usage values, not credentials.
|
|
103
|
-
|
|
104
|
-
## Financial metrics roadmap
|
|
105
|
-
|
|
106
|
-
Quota percentages and monetary account data have different meaning and color semantics. OpenRouter, DeepSeek, Moonshot, and MiniMax financial data are rendered as neutral account values; percentages are used only when an actual limit exists.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
- [
|
|
1
|
+
# pi-usage-bars
|
|
2
|
+
|
|
3
|
+
Quota, balance, and spend indicators for [Pi](https://github.com/earendil-works/pi).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
It adds:
|
|
8
|
+
|
|
9
|
+
- a footer status bar for the active supported provider
|
|
10
|
+
- a `/usage` command showing configured quota, balance, and spend data
|
|
11
|
+
|
|
12
|
+
## Supported providers
|
|
13
|
+
|
|
14
|
+
| Provider | Pi provider ID | Authentication |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| OpenAI Codex | `openai-codex` | ChatGPT subscription OAuth |
|
|
17
|
+
| Anthropic Claude | `anthropic` | Claude Pro/Max OAuth |
|
|
18
|
+
| ZAI Coding Plan (Global) | `zai` | ZAI API key |
|
|
19
|
+
| ZAI Coding Plan (China) | `zai-coding-cn` | ZAI China API key |
|
|
20
|
+
| Kimi For Coding | `kimi-coding` | Kimi Coding Plan API key |
|
|
21
|
+
| MiniMax Coding Plan (Global) | `minimax` | MiniMax Global API key |
|
|
22
|
+
| MiniMax Coding Plan (China) | `minimax-cn` | MiniMax China API key |
|
|
23
|
+
| OpenRouter | `openrouter` | OpenRouter API key |
|
|
24
|
+
| DeepSeek | `deepseek` | DeepSeek API key |
|
|
25
|
+
| Moonshot/Kimi API (Global) | `moonshotai` | Moonshot Global API key |
|
|
26
|
+
| Moonshot/Kimi API (China) | `moonshotai-cn` | Moonshot China API key |
|
|
27
|
+
|
|
28
|
+
DeepSeek shows total, topped-up, and granted balances in the currency returned by the API. Moonshot shows available, cash, and voucher balances; this is separate from the Kimi For Coding subscription provider. Pi uses `MOONSHOT_API_KEY` for both Moonshot regions, so `/usage` automatically hides the expected authentication failure from the region where a shared environment key is not valid.
|
|
29
|
+
|
|
30
|
+
OpenRouter shows the account credit balance and current daily, weekly, and monthly key spend. If the API key has a configured credit limit, that limit is also rendered as a usage bar.
|
|
31
|
+
|
|
32
|
+
MiniMax Subscription Keys can represent an active Token Plan, purchased Credits, or both. The extension shows quota windows when present and a neutral credit-balance line if a first-party key-authenticated response exposes `points_balance`/`credits_balance`. MiniMax currently exposes Credits-only balances through a console endpoint requiring browser-cookie authentication, so a key-only Credits account is shown as “No active Token Plan” with a direction to check the console rather than a fabricated percentage. The extension does not import browser cookies.
|
|
33
|
+
|
|
34
|
+
Google Gemini CLI and Google Antigravity are not supported because Pi removed those built-in providers in version 0.71.0.
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
- Pi 0.81.1 or newer (tested with the current Pi 0.84.2 release)
|
|
39
|
+
- Node.js 22.19 or newer when using the npm-distributed Pi CLI
|
|
40
|
+
|
|
41
|
+
Authenticate providers through Pi's `/login` command. The extension resolves credentials through Pi's provider API; it does not read or write `auth.json` itself.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
Install the npm package:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pi install npm:@hk_net/pi-usage-bars
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or install the latest source directly from GitHub:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pi install https://github.com/hknet/pi-usage-bars
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Restart Pi after installation, or use `/reload` when the package is already installed.
|
|
58
|
+
|
|
59
|
+
Update an existing npm installation with:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pi update npm:@hk_net/pi-usage-bars
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Use
|
|
66
|
+
|
|
67
|
+
### Footer usage bars
|
|
68
|
+
|
|
69
|
+
When the active model belongs to a configured supported provider, the footer shows its available quota windows with reset countdowns when provided by the service.
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
Usage refresh runs in interactive TUI sessions every two minutes. It does not run in print, JSON, or RPC mode.
|
|
74
|
+
|
|
75
|
+
### `/usage`
|
|
76
|
+
|
|
77
|
+
Run `/usage` to open a searchable list of configured supported providers.
|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
## Endpoint configuration
|
|
82
|
+
|
|
83
|
+
First-party monitoring endpoints can be overridden:
|
|
84
|
+
|
|
85
|
+
| Variable | Default |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `PI_ZAI_USAGE_ENDPOINT` | `https://api.z.ai/api/monitor/usage/quota/limit` |
|
|
88
|
+
| `PI_ZAI_CODING_CN_USAGE_ENDPOINT` | `https://open.bigmodel.cn/api/monitor/usage/quota/limit` |
|
|
89
|
+
| `PI_KIMI_USAGE_ENDPOINT` | `https://api.kimi.com/coding/v1/usages` |
|
|
90
|
+
| `PI_MINIMAX_USAGE_ENDPOINT` | `https://api.minimax.io/v1/token_plan/remains` |
|
|
91
|
+
| `PI_MINIMAX_LEGACY_USAGE_ENDPOINT` | `https://api.minimax.io/v1/api/openplatform/coding_plan/remains` |
|
|
92
|
+
| `PI_MINIMAX_CN_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/token_plan/remains` |
|
|
93
|
+
| `PI_MINIMAX_CN_LEGACY_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/api/openplatform/coding_plan/remains` |
|
|
94
|
+
| `PI_OPENROUTER_CREDITS_ENDPOINT` | `https://openrouter.ai/api/v1/credits` |
|
|
95
|
+
| `PI_OPENROUTER_KEY_ENDPOINT` | `https://openrouter.ai/api/v1/key` |
|
|
96
|
+
| `PI_DEEPSEEK_BALANCE_ENDPOINT` | `https://api.deepseek.com/user/balance` |
|
|
97
|
+
| `PI_MOONSHOT_BALANCE_ENDPOINT` | `https://api.moonshot.ai/v1/users/me/balance` |
|
|
98
|
+
| `PI_MOONSHOT_CN_BALANCE_ENDPOINT` | `https://api.moonshot.cn/v1/users/me/balance` |
|
|
99
|
+
|
|
100
|
+
**Security:** the corresponding provider token is sent as a bearer token to the configured endpoint. Only override these variables with an endpoint you trust.
|
|
101
|
+
|
|
102
|
+
The Codex and Claude usage endpoints are fixed to their first-party services. Claude responses are cached briefly in the system temporary directory to coordinate multiple Pi processes and reduce rate limiting. The cache contains usage values, not credentials.
|
|
103
|
+
|
|
104
|
+
## Financial metrics roadmap
|
|
105
|
+
|
|
106
|
+
Quota percentages and monetary account data have different meaning and color semantics. OpenRouter, DeepSeek, Moonshot, and MiniMax financial data are rendered as neutral account values; percentages are used only when an actual limit exists.
|
|
107
|
+
|
|
108
|
+
See [provider support research](docs/provider-research.md) for providers investigated but currently blocked by the absence of a suitable first-party usage API, including Qwen Token Plan and Baseten.
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
Install Node.js 22.19+ and Bun 1.3, then run:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install
|
|
116
|
+
npm run check
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`npm run check` performs a strict TypeScript check and runs the Bun test suite.
|
|
120
|
+
|
|
121
|
+
Maintainers should follow the complete [release and npm publication guide](docs/releasing.md): prepare the release, stage it for npm browser approval, then finalize it after 2FA approval. Pushing a Git tag does not publish automatically.
|
|
122
|
+
|
|
123
|
+
## Credits
|
|
124
|
+
|
|
125
|
+
This extension is based on and inspired by:
|
|
126
|
+
|
|
127
|
+
- [CodexBar](https://github.com/steipete/CodexBar)
|
|
128
|
+
- [rho usage-bars](https://github.com/mikeyobrien/rho/tree/main/extensions/usage-bars)
|
|
129
|
+
- [ajarellanod/pi-usage-bars](https://github.com/ajarellanod/pi-usage-bars)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Provider support research
|
|
2
|
+
|
|
3
|
+
This document records providers considered for usage-bar support but currently blocked by the absence of a suitable first-party API. Recheck these findings when a provider publishes a new quota, balance, or billing API.
|
|
4
|
+
|
|
5
|
+
## Qwen Token Plan
|
|
6
|
+
|
|
7
|
+
**Status:** Blocked — no account-usage surface found as of 2026-08-13.
|
|
8
|
+
|
|
9
|
+
Pi 0.84.1 supports these provider IDs:
|
|
10
|
+
|
|
11
|
+
- `qwen-token-plan`
|
|
12
|
+
- `qwen-token-plan-individual`
|
|
13
|
+
- `qwen-token-plan-cn`
|
|
14
|
+
|
|
15
|
+
The Individual provider shares the international inference endpoint and `QWEN_TOKEN_PLAN_API_KEY` with the existing international provider, but exposes a narrower model catalog.
|
|
16
|
+
|
|
17
|
+
Research found no documented API-key-authenticated endpoint that reports consumed or remaining quota, percentages, or reset times. Independent probing of eight likely usage/quota paths on `token-plan.ap-southeast-1.maas.aliyuncs.com` returned `404`, and successful inference responses did not include quota or rate-limit headers. Qwen's client can recognize an exhausted-quota error, but that provides no usage percentage or reset timestamp.
|
|
18
|
+
|
|
19
|
+
Do not estimate account-wide quota from requests observed by this extension: other clients and sessions would make that value incomplete and misleading.
|
|
20
|
+
|
|
21
|
+
**Recheck when:** Alibaba Model Studio documents a Token Plan usage endpoint, adds quota headers to inference responses, or exposes a key-authenticated portal API.
|
|
22
|
+
|
|
23
|
+
## Baseten
|
|
24
|
+
|
|
25
|
+
**Status:** Blocked — no account-usage surface found as of 2026-08-13.
|
|
26
|
+
|
|
27
|
+
Pi 0.84.0 added the `baseten` provider using `BASETEN_API_KEY`. Baseten is primarily usage-billed, and research found no documented API-key endpoint for account balance, credits, budget utilization, or billing usage that this extension could safely query.
|
|
28
|
+
|
|
29
|
+
**Recheck when:** Baseten publishes a first-party balance, credits, budget, or billing-usage API accessible with the inference credential or a documented monitoring credential.
|
|
30
|
+
|
|
31
|
+
## Acceptance criteria for a new provider
|
|
32
|
+
|
|
33
|
+
A provider is suitable when a documented first-party API or response header supplies at least one meaningful account-level value:
|
|
34
|
+
|
|
35
|
+
- quota consumed or remaining, ideally with a reset time;
|
|
36
|
+
- account balance or credits; or
|
|
37
|
+
- spend for a defined billing period.
|
|
38
|
+
|
|
39
|
+
Authentication must work through Pi's provider credential API. The extension must not import browser cookies, scrape console pages, estimate account-wide usage from local traffic, or send credentials to third-party services.
|
package/docs/releasing.md
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
# Releasing
|
|
2
|
-
|
|
3
|
-
This repository uses semantic versions. The package version, changelog heading, Git tag, and npm version must agree.
|
|
4
|
-
|
|
5
|
-
Local
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- Write access to `hknet/pi-usage-bars`.
|
|
10
|
-
- Publish access to the npm scope `@hk_net`.
|
|
11
|
-
- Node.js 22.19 or newer.
|
|
12
|
-
- A clean, synchronized `main` branch.
|
|
13
|
-
|
|
14
|
-
Never place an npm token in the repository, command history, or endpoint configuration. Complete npm's browser or OTP authorization when prompted.
|
|
15
|
-
|
|
16
|
-
## Recommended release script
|
|
17
|
-
|
|
18
|
-
From the repository root, provide the exact new semantic version:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
cd /path/to/pi-usage-bars
|
|
22
|
-
scripts/release.sh
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This **default command only prepares the release**. It deliberately stops before npm login or publication, so the pushed release commit can be reviewed first. The launcher first executes an immutable temporary copy of itself, so editing the script while a release is running cannot corrupt that run.
|
|
26
|
-
|
|
27
|
-
Preparation:
|
|
28
|
-
|
|
29
|
-
1. verifies that `main` is clean and synchronized with `origin/main`;
|
|
30
|
-
2. rejects an existing npm version or Git tag;
|
|
31
|
-
3. updates `package.json` and `package-lock.json` without creating an early tag;
|
|
32
|
-
4. promotes the `Unreleased` changelog entries into a dated release while preserving an empty `Unreleased` heading;
|
|
33
|
-
5. installs dependencies with `npm ci --no-audit`, provisions a temporary pinned Bun binary, and runs typecheck, tests, detailed dependency audits, and package dry-run; and
|
|
34
|
-
6. commits and pushes the release source.
|
|
35
|
-
|
|
36
|
-
After reviewing the prepared commit, stage it for browser approval:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
scripts/release.sh
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`stage` submits the package to npm's staged-publishing queue. It **does not publish live**, does not open a browser, and does not tag Git. If npm authentication is needed, run `npm login --auth-type=web` manually first.
|
|
43
|
-
|
|
44
|
-
In [npmjs.com](https://www.npmjs.com), open **Staged Packages**, review the staged tarball, and click **Approve**. npm prompts for 2FA during approval. After npm shows the version as live, finalize the release:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
scripts/release.sh
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
`finalize` refuses to run until the exact version is live in the npm registry. It then verifies registry metadata and creates/pushes the annotated Git tag. It never stages or publishes a package.
|
|
51
|
-
|
|
52
|
-
Use `--yes` only for attended preparation:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
scripts/release.sh
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Recovery
|
|
59
|
-
|
|
60
|
-
Staging and finalization are safe to rerun: `stage` refuses if the exact version is already live, and `finalize` refuses until it is live. Never force-push a release tag.
|
|
61
|
-
|
|
62
|
-
The release script first prints a full dependency audit with package names, dependency paths, affected ranges, and available fixes. This is informational because it includes development-only dependencies. It then runs a blocking production-only audit, which rejects high or critical production findings.
|
|
63
|
-
|
|
64
|
-
Show script help with:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
scripts/release.sh --help
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Post-release verification
|
|
71
|
-
|
|
72
|
-
Confirm installation through Pi:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
pi install npm:@hk_net/pi-usage-bars
|
|
76
|
-
# If already installed from npm:
|
|
77
|
-
pi update npm:@hk_net/pi-usage-bars
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Restart Pi, or use `/reload`, then run `/usage`.
|
|
81
|
-
|
|
82
|
-
## GitHub Actions alternative
|
|
83
|
-
|
|
84
|
-
The **Publish to npm (manual)** workflow is available as an alternative. It requires the `NPM_TOKEN` repository secret and publishes with npm provenance. Do not run it after publishing the same version locally.
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
This repository uses semantic versions. The package version, changelog heading, Git tag, and npm version must agree.
|
|
4
|
+
|
|
5
|
+
Local releases use npm staged publishing followed by browser 2FA approval. Browser login only authenticates the CLI; it does not publish or approve a staged package. The GitHub Actions publish workflow is manual-only; pushing a tag does not publish the package.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Write access to `hknet/pi-usage-bars`.
|
|
10
|
+
- Publish access to the npm scope `@hk_net`.
|
|
11
|
+
- Node.js 22.19 or newer.
|
|
12
|
+
- A clean, synchronized `main` branch.
|
|
13
|
+
|
|
14
|
+
Never place an npm token in the repository, command history, or endpoint configuration. Complete npm's browser or OTP authorization when prompted.
|
|
15
|
+
|
|
16
|
+
## Recommended release script
|
|
17
|
+
|
|
18
|
+
From the repository root, provide the exact new semantic version:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd /path/to/pi-usage-bars
|
|
22
|
+
scripts/release.sh X.Y.Z
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This **default command only prepares the release**. It deliberately stops before npm login or publication, so the pushed release commit can be reviewed first. The launcher first executes an immutable temporary copy of itself, so editing the script while a release is running cannot corrupt that run.
|
|
26
|
+
|
|
27
|
+
Preparation:
|
|
28
|
+
|
|
29
|
+
1. verifies that `main` is clean and synchronized with `origin/main`;
|
|
30
|
+
2. rejects an existing npm version or Git tag;
|
|
31
|
+
3. updates `package.json` and `package-lock.json` without creating an early tag;
|
|
32
|
+
4. promotes the `Unreleased` changelog entries into a dated release while preserving an empty `Unreleased` heading;
|
|
33
|
+
5. installs dependencies with `npm ci --no-audit`, provisions a temporary pinned Bun binary, and runs typecheck, tests, detailed dependency audits, and package dry-run; and
|
|
34
|
+
6. commits and pushes the release source.
|
|
35
|
+
|
|
36
|
+
After reviewing the prepared commit, stage it for browser approval:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
scripts/release.sh X.Y.Z stage
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`stage` submits the package to npm's staged-publishing queue. It **does not publish live**, does not open a browser, and does not tag Git. If npm authentication is needed, run `npm login --auth-type=web` manually first; this only authenticates the CLI.
|
|
43
|
+
|
|
44
|
+
In [npmjs.com](https://www.npmjs.com), open **Staged Packages**, review the staged tarball, and click **Approve**. npm prompts for 2FA during approval. After npm shows the version as live, finalize the release:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
scripts/release.sh X.Y.Z finalize
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`finalize` refuses to run until the exact version is live in the npm registry. It then verifies registry metadata and creates/pushes the annotated Git tag. It never stages or publishes a package.
|
|
51
|
+
|
|
52
|
+
Use `--yes` only for attended preparation:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
scripts/release.sh X.Y.Z --yes # prepare only
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Recovery
|
|
59
|
+
|
|
60
|
+
Staging and finalization are safe to rerun: `stage` refuses if the exact version is already live, and `finalize` refuses until it is live. Never force-push a release tag.
|
|
61
|
+
|
|
62
|
+
The release script first prints a full dependency audit with package names, dependency paths, affected ranges, and available fixes. This is informational because it includes development-only dependencies. It then runs a blocking production-only audit, which rejects high or critical production findings.
|
|
63
|
+
|
|
64
|
+
Show script help with:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
scripts/release.sh --help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Post-release verification
|
|
71
|
+
|
|
72
|
+
Confirm installation through Pi:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pi install npm:@hk_net/pi-usage-bars
|
|
76
|
+
# If already installed from npm:
|
|
77
|
+
pi update npm:@hk_net/pi-usage-bars
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Restart Pi, or use `/reload`, then run `/usage`.
|
|
81
|
+
|
|
82
|
+
## GitHub Actions alternative
|
|
83
|
+
|
|
84
|
+
The **Publish to npm (manual)** workflow is available as an alternative. It requires the `NPM_TOKEN` repository secret and publishes with npm provenance. Do not run it after publishing the same version locally.
|