Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/quota/README.md

Raw
Rendered preview
quota

quota

Use quota to see how much of your current AI subscription allowance remains without leaving Pi. It shows the active provider's usage and reset time in Pi's status area when available.

Quota demo with synthetic allowance figures, not a real provider account

Start

Install or update through Installation, then run /reload after rebuilding. Nothing needs invoking for the compact status view in interactive Pi. Run /quota to show or hide the detailed usage widget.

/quota

Quota follows your selected model provider. With a routing model, quota shows the provider that answered last, labeled with its name, and appears after the first successful response. It supports Anthropic, OpenAI Codex, GitHub Copilot, MiniMax international, Zai (international and CN), Kimi, OpenRouter, Groq, DeepSeek, and Moonshot (international and CN) when Pi has credentials for that provider. Groq reports requests per day for the model that answered last, and only after a Groq response. DeepSeek and Moonshot show remaining balance. Google, Mistral, NVIDIA, xAI, and Hetzner Inference quota are not supported; their API keys cannot read usage or quota. Other extensions can report non-chat use of a supported provider, such as MiniMax media or search while chatting with Anthropic, by emitting quota:provider-activity with { provider: "minimax" } on Pi's event bus. Quota then shows that provider beside the active one, labeled with its name, until the next session starts. MiniMax international M Plan shows reported percentages and reset times without treating zero placeholder counts as known absolute allowance. MiniMax windows use their reported lengths, such as daily image or speech pools; unlimited windows show as unlimited, and models outside the plan are omitted. A MiniMax weekly boost scales the reported weekly percentage, so a boosted allowance can show 0% used. Plan tier and purchased Credits balance are not inferred from that response. MiniMax CN M Plan quota is unavailable until its current route is established; no legacy or cross-region fallback is used. Copilot, Kimi, Zai CN, DeepSeek, and Moonshot adapters are best-effort until account access can verify their APIs. Codex quota uses only Pi's active-session token; identity is read from that token, never from Codex CLI auth files. No row is shown when the provider has no configured auth or no usage result is available. The detail widget lists each reported allowance, scoped limit, balance, or spending cap separately. The footer shows the account-wide allowance closest to running out, so an exhausted weekly allowance is visible even while the five-hour window is idle. Model-specific limits and paid balances appear only in the widget; the footer label identifies the selected allowance. Percentages show usage, not remaining allowance. Missing values are not treated as unused allowance; known but unreadable measurements show as unknown. If a refresh fails after a successful fetch, the last fetched usage may remain visible with its original observation age in the widget.

Refreshing

Pi refreshes visible quota periodically and when you select a model. The default refresh interval is five minutes. Change quota.refreshIntervalMs only when you need a different polling interval.

Reference

Commands

Command Purpose
/quota Show/hide subscription quota usage

Setting names

Setting Environment
quota.refreshIntervalMs PI_QUOTA_REFRESH_INTERVAL_MS

Setting values

Setting Default Valid values Purpose
quota.refreshIntervalMs 300000 Integer 10000–2147483647 Quota refresh interval: Milliseconds between quota refreshes.
<img src="assets/banner.svg" alt="quota" height="70">

# quota

Use quota to see how much of your current AI subscription allowance remains without leaving Pi.
It shows the active provider's usage and reset time in Pi's status area when available.

![Quota demo with synthetic allowance figures, not a real provider account](assets/demo.gif)

## Start

Install or update through [Installation](../../README.md#install), then run `/reload` after rebuilding.
Nothing needs invoking for the compact status view in interactive Pi.
Run `/quota` to show or hide the detailed usage widget.

```
/quota
```

Quota follows your selected model provider.
With a routing model, quota shows the provider that answered last, labeled with its name, and appears after the first successful response.
It supports Anthropic, OpenAI Codex, GitHub Copilot, MiniMax international, Zai (international and CN), Kimi, OpenRouter, Groq, DeepSeek, and Moonshot (international and CN) when Pi has credentials for that provider.
Groq reports requests per day for the model that answered last, and only after a Groq response.
DeepSeek and Moonshot show remaining balance.
Google, Mistral, NVIDIA, xAI, and Hetzner Inference quota are not supported; their API keys cannot read usage or quota.
Other extensions can report non-chat use of a supported provider, such as MiniMax media or search while chatting with Anthropic, by emitting `quota:provider-activity` with `{ provider: "minimax" }` on Pi's event bus.
Quota then shows that provider beside the active one, labeled with its name, until the next session starts.
MiniMax international M Plan shows reported percentages and reset times without treating zero placeholder counts as known absolute allowance.
MiniMax windows use their reported lengths, such as daily image or speech pools; unlimited windows show as unlimited, and models outside the plan are omitted.
A MiniMax weekly boost scales the reported weekly percentage, so a boosted allowance can show 0% used.
Plan tier and purchased Credits balance are not inferred from that response.
MiniMax CN M Plan quota is unavailable until its current route is established; no legacy or cross-region fallback is used.
Copilot, Kimi, Zai CN, DeepSeek, and Moonshot adapters are best-effort until account access can verify their APIs.
Codex quota uses only Pi's active-session token; identity is read from that token, never from Codex CLI auth files.
No row is shown when the provider has no configured auth or no usage result is available.
The detail widget lists each reported allowance, scoped limit, balance, or spending cap separately.
The footer shows the account-wide allowance closest to running out, so an exhausted weekly allowance is visible even while the five-hour window is idle.
Model-specific limits and paid balances appear only in the widget; the footer label identifies the selected allowance.
Percentages show usage, not remaining allowance.
Missing values are not treated as unused allowance; known but unreadable measurements show as unknown.
If a refresh fails after a successful fetch, the last fetched usage may remain visible with its original observation age in the widget.

## Refreshing

Pi refreshes visible quota periodically and when you select a model.
The default refresh interval is five minutes.
Change `quota.refreshIntervalMs` only when you need a different polling interval.

## Reference

<!-- config:start -->
### Commands

| Command | Purpose |
| --- | --- |
| `/quota` | Show/hide subscription quota usage |

### Setting names

| Setting | Environment |
| --- | --- |
| `quota.refreshIntervalMs` | `PI_QUOTA_REFRESH_INTERVAL_MS` |

#### Setting values

| Setting | Default | Valid values | Purpose |
| --- | --- | --- | --- |
| `quota.refreshIntervalMs` | `300000` | Integer 10000–2147483647 | Quota refresh interval: Milliseconds between quota refreshes. |
<!-- config:end -->