@hk_net/pi-usage-bars 0.5.0 → 0.7.0
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 +26 -0
- package/LICENSE +21 -21
- package/README.md +160 -139
- package/docs/provider-research.md +38 -4
- package/docs/releasing.md +104 -104
- package/extensions/usage-bars/core.ts +1629 -1274
- package/extensions/usage-bars/index.ts +817 -768
- package/package.json +83 -74
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## [0.7.0] - 2026-09-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added Vercel AI Gateway balance and lifetime-spend reporting through its documented key-authenticated Credits API.
|
|
10
|
+
- Added Fireworks AI current-month account spend reporting through its documented key-authenticated billing API, with explicit account selection when a key can access multiple accounts.
|
|
11
|
+
- Added xAI prepaid-balance and current-cycle-spend reporting through its documented Management API, with a model-less Pi `/login` provider for securely storing the separate read-only Management Key.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Updated the development and test baseline to Pi SDK 0.87.1.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Retry transient Fireworks `429`, `502`, `503`, and `504` responses once, respecting `Retry-After` and request cancellation.
|
|
20
|
+
|
|
21
|
+
## [0.6.0] - 2026-08-29
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Added Baseten current calendar-month credits-used reporting through its documented key-authenticated billing usage API. Baseten has no documented remaining-credit or quota percentage in this API, so the extension renders only the reported usage.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Updated the development and test baseline to Pi SDK 0.84.4.
|
|
30
|
+
|
|
5
31
|
## [0.5.0] - 2026-08-22
|
|
6
32
|
|
|
7
33
|
### Added
|
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,139 +1,160 @@
|
|
|
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 OAuth or 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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
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 OAuth or 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
|
+
| Baseten | `baseten` | Baseten API key |
|
|
28
|
+
| Vercel AI Gateway | `vercel-ai-gateway` | AI Gateway API key |
|
|
29
|
+
| Fireworks AI | `fireworks` | Fireworks API key |
|
|
30
|
+
| xAI | `xai` | Separate read-only xAI Management Key |
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
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. Baseten shows current calendar-month credits used, aggregated across its documented dedicated, training, and Model APIs billing categories; it does not invent a remaining-balance or quota percentage. Vercel AI Gateway shows the team's remaining AI Gateway Credits balance and lifetime spend. Fireworks shows account-wide rated spend for the current UTC calendar month. Its high default monthly-spend quota is not treated as a useful budget percentage. xAI shows the team's prepaid balance and current billing-cycle spend.
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
Google Gemini CLI and Google Antigravity are not supported because Pi removed those built-in providers in version 0.71.0.
|
|
39
|
+
|
|
40
|
+
## Requirements
|
|
41
|
+
|
|
42
|
+
- Pi 0.84.2 or newer (tested with the current Pi 0.87.1 release)
|
|
43
|
+
- Node.js 22.19 or newer when using the npm-distributed Pi CLI
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
xAI keeps inference and billing credentials separate. After authenticating Pi's normal `xai` provider, configure usage reporting with a read-only, team-scoped Management Key:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
/login pi-usage-bars-xai-management
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Select **xAI Management (pi-usage-bars)** and paste the key into Pi's secret prompt. For headless or CI use, `XAI_MANAGEMENT_KEY` is also accepted from the environment. Organization-scoped Management Keys are not selected or aggregated automatically.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
Install the npm package:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pi install npm:@hk_net/pi-usage-bars
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or install the latest source directly from GitHub:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pi install https://github.com/hknet/pi-usage-bars
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Restart Pi after installation, or use `/reload` when the package is already installed.
|
|
70
|
+
|
|
71
|
+
Update an existing npm installation with:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pi update npm:@hk_net/pi-usage-bars
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Use
|
|
78
|
+
|
|
79
|
+
### Footer usage bars
|
|
80
|
+
|
|
81
|
+
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.
|
|
82
|
+
|
|
83
|
+

|
|
84
|
+
|
|
85
|
+
Usage refresh runs in interactive TUI sessions every two minutes. It does not run in print, JSON, or RPC mode.
|
|
86
|
+
|
|
87
|
+
### `/usage`
|
|
88
|
+
|
|
89
|
+
Run `/usage` to open a searchable list of configured supported providers. The selected provider's details are expanded; use the configured selection and page-navigation keybindings to browse the bounded list.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
### `--usage`
|
|
94
|
+
|
|
95
|
+
Pass `--usage` to print one JSON line for the active model provider and exit without opening the usage UI. This is also useful as a loader and credential smoke test:
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
pi --no-extensions -e C:\hk\code\pi-usage-bars\extensions\usage-bars\index.ts --usage
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The result has `status` set to `ok`, `unconfigured`, `unsupported`, or `error`. No credential is included in the output.
|
|
102
|
+
|
|
103
|
+
## Endpoint configuration
|
|
104
|
+
|
|
105
|
+
First-party monitoring endpoints can be overridden:
|
|
106
|
+
|
|
107
|
+
| Variable | Default |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `PI_ZAI_USAGE_ENDPOINT` | `https://api.z.ai/api/monitor/usage/quota/limit` |
|
|
110
|
+
| `PI_ZAI_CODING_CN_USAGE_ENDPOINT` | `https://open.bigmodel.cn/api/monitor/usage/quota/limit` |
|
|
111
|
+
| `PI_KIMI_USAGE_ENDPOINT` | `https://api.kimi.com/coding/v1/usages` |
|
|
112
|
+
| `PI_MINIMAX_USAGE_ENDPOINT` | `https://api.minimax.io/v1/token_plan/remains` |
|
|
113
|
+
| `PI_MINIMAX_LEGACY_USAGE_ENDPOINT` | `https://api.minimax.io/v1/api/openplatform/coding_plan/remains` |
|
|
114
|
+
| `PI_MINIMAX_CN_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/token_plan/remains` |
|
|
115
|
+
| `PI_MINIMAX_CN_LEGACY_USAGE_ENDPOINT` | `https://api.minimaxi.com/v1/api/openplatform/coding_plan/remains` |
|
|
116
|
+
| `PI_OPENROUTER_CREDITS_ENDPOINT` | `https://openrouter.ai/api/v1/credits` |
|
|
117
|
+
| `PI_OPENROUTER_KEY_ENDPOINT` | `https://openrouter.ai/api/v1/key` |
|
|
118
|
+
| `PI_DEEPSEEK_BALANCE_ENDPOINT` | `https://api.deepseek.com/user/balance` |
|
|
119
|
+
| `PI_MOONSHOT_BALANCE_ENDPOINT` | `https://api.moonshot.ai/v1/users/me/balance` |
|
|
120
|
+
| `PI_MOONSHOT_CN_BALANCE_ENDPOINT` | `https://api.moonshot.cn/v1/users/me/balance` |
|
|
121
|
+
| `PI_BASETEN_USAGE_ENDPOINT` | `https://api.baseten.co/v1/billing/usage_summary` |
|
|
122
|
+
| `PI_VERCEL_AI_GATEWAY_CREDITS_ENDPOINT` | `https://ai-gateway.vercel.sh/v1/credits` |
|
|
123
|
+
| `PI_FIREWORKS_API_ENDPOINT` | `https://api.fireworks.ai/v1` |
|
|
124
|
+
| `PI_FIREWORKS_ACCOUNT_ID` | Automatically discovered when exactly one account is accessible |
|
|
125
|
+
| `PI_XAI_MANAGEMENT_API_ENDPOINT` | `https://management-api.x.ai` |
|
|
126
|
+
|
|
127
|
+
**Security:** the corresponding provider token is sent as a bearer token to the configured endpoint. Only override endpoint variables with an endpoint you trust. `PI_FIREWORKS_ACCOUNT_ID` selects an account already returned by Fireworks account discovery; it may be either the account slug or its `accounts/<slug>` resource name. When a key can access multiple accounts, this variable is required rather than guessing or aggregating across accounts.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
## Financial metrics roadmap
|
|
132
|
+
|
|
133
|
+
Quota percentages and monetary account data have different meaning and color semantics. OpenRouter, DeepSeek, Moonshot, MiniMax, Vercel AI Gateway, Fireworks, and xAI financial data are rendered as neutral account values; percentages are used only when an actual limit exists.
|
|
134
|
+
|
|
135
|
+
### Future: Qwen Token Plan
|
|
136
|
+
|
|
137
|
+
Qwen Token Plan Individual has a documented seven-day Credits quota, but Qwen currently directs users to console usage details and prohibits API-key automation. Add Qwen support only when Qwen documents and authorizes a key-authenticated usage endpoint compatible with Pi's resolved `sk-sp-…` credential. Do not use browser cookies or console-session tokens. The endpoint must expose used Credits, quota limit, reset time, and any separate Credit Pack balance; validate it with redacted fixtures before implementation.
|
|
138
|
+
|
|
139
|
+
See [provider support research](docs/provider-research.md) for the supporting Qwen investigation.
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
Install Node.js 22.19+ and Bun 1.3, then run:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm install
|
|
147
|
+
npm run check
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`npm run check` performs a strict TypeScript check and runs the Bun test suite.
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
|
|
154
|
+
## Credits
|
|
155
|
+
|
|
156
|
+
This extension is based on and inspired by:
|
|
157
|
+
|
|
158
|
+
- [CodexBar](https://github.com/steipete/CodexBar)
|
|
159
|
+
- [rho usage-bars](https://github.com/mikeyobrien/rho/tree/main/extensions/usage-bars)
|
|
160
|
+
- [ajarellanod/pi-usage-bars](https://github.com/ajarellanod/pi-usage-bars)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Provider support research
|
|
2
2
|
|
|
3
|
-
This document records providers considered for usage-bar support
|
|
3
|
+
This document records providers considered for usage-bar support. Recheck blocked findings when a provider publishes a new quota, balance, or billing API.
|
|
4
4
|
|
|
5
5
|
## Qwen Token Plan
|
|
6
6
|
|
|
@@ -22,11 +22,45 @@ Do not estimate account-wide quota from requests observed by this extension: oth
|
|
|
22
22
|
|
|
23
23
|
## Baseten
|
|
24
24
|
|
|
25
|
-
**Status:**
|
|
25
|
+
**Status:** Supported as of 2026-08-28.
|
|
26
|
+
|
|
27
|
+
Pi's `baseten` provider resolves `BASETEN_API_KEY`. Baseten documents `GET https://api.baseten.co/v1/billing/usage_summary`, authenticated with `Authorization: Bearer $BASETEN_API_KEY`, with required UTC `start_date` and `end_date` parameters (maximum range: 31 days). The response reports `credits_used` for dedicated serving, training, and Model APIs. The extension queries the current UTC calendar month and reports the aggregate Credits used; it intentionally does not manufacture a remaining balance or quota percentage.
|
|
28
|
+
|
|
29
|
+
**Recheck when:** Baseten publishes a first-party balance, budget, or quota API that permits a more complete account indicator.
|
|
30
|
+
|
|
31
|
+
## Vercel AI Gateway
|
|
32
|
+
|
|
33
|
+
**Status:** Supported as of 2026-09-24.
|
|
34
|
+
|
|
35
|
+
Pi's `vercel-ai-gateway` provider resolves `AI_GATEWAY_API_KEY`. Vercel documents `GET https://ai-gateway.vercel.sh/v1/credits`, authenticated with the same API key as a bearer token. The response reports the team's remaining AI Gateway Credits balance and total lifetime spend in USD.
|
|
36
|
+
|
|
37
|
+
**Recheck when:** Vercel adds defined-period spend or budget fields that provide more actionable detail than lifetime spend.
|
|
38
|
+
|
|
39
|
+
## Fireworks
|
|
40
|
+
|
|
41
|
+
**Status:** Supported as of 2026-09-24.
|
|
42
|
+
|
|
43
|
+
Fireworks documents bearer-key-authenticated account discovery through `GET https://api.fireworks.ai/v1/accounts` and account-wide rated costs through `GET /v1/accounts/{account_id}/billing/summary`. Fireworks states that any key on the target account can use the API. A live redacted test with an ordinary user API key resolved through Pi's `fireworks` provider returned HTTP 200 for account discovery, billing summary, quotas, and the self-scoped usage-cost query. It exposed one accessible account; no credential, account identifier, or raw response was retained.
|
|
44
|
+
|
|
45
|
+
The extension reports rated spend for the current UTC calendar month from the billing summary. It does not use the `monthly-spend-usd` quota as a budget percentage because validation observed a `9,999,999` default that appears to mean effectively unlimited rather than an actionable budget. Exactly one accessible account is selected automatically. When a key can access multiple accounts, `PI_FIREWORKS_ACCOUNT_ID` must match one of the discovered account IDs; the extension does not guess or aggregate accounts.
|
|
46
|
+
|
|
47
|
+
**Recheck when:** Fireworks documents an account credit balance or a reliable distinction between explicit spend budgets and effectively unlimited quota values.
|
|
48
|
+
|
|
49
|
+
## xAI
|
|
50
|
+
|
|
51
|
+
**Status:** Supported as of 2026-09-24.
|
|
52
|
+
|
|
53
|
+
xAI documents its billing APIs at `https://management-api.x.ai`, authenticated with a Management Key that is deliberately separate from the normal inference API key or subscription OAuth credential used by Pi's `xai` provider. The extension registers the model-less `pi-usage-bars-xai-management` provider so `/login` can prompt for and store a read-only Management Key through Pi's credential system. `XAI_MANAGEMENT_KEY` remains an optional environment fallback.
|
|
54
|
+
|
|
55
|
+
A live redacted test with a read-only, team-scoped key returned HTTP 200 for key validation, prepaid balance, current invoice preview, and postpaid spending limits. The extension validates `SCOPE_TEAM`, obtains the team ID internally, and reports the prepaid accounting total as a positive available balance plus `coreInvoice.totalWithCorr` as current billing-cycle spend. It never logs the key, team ID, ACL contents, or raw response. Organization-scoped keys are rejected rather than guessing or aggregating teams.
|
|
56
|
+
|
|
57
|
+
**Recheck when:** xAI adds team discovery for organization-scoped Management Keys or exposes billing through the ordinary inference credential.
|
|
58
|
+
|
|
59
|
+
## Meta Muse
|
|
26
60
|
|
|
27
|
-
|
|
61
|
+
**Status:** Blocked — no documented account-usage API found as of 2026-09-24.
|
|
28
62
|
|
|
29
|
-
|
|
63
|
+
Pi 0.86.1 added the `meta` provider with Meta Muse subscription OAuth and `META_API_KEY` authentication. No documented first-party endpoint was found for remaining subscription quota, reset timing, account balance, or spend. Do not infer quota from local requests or use undocumented console endpoints.
|
|
30
64
|
|
|
31
65
|
## Acceptance criteria for a new provider
|
|
32
66
|
|