repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/quota/README.md

Raw

quota

Subscription quota dashboard for Pi.

Install / load

Loaded through the root pi-ext package.

Commands / tools / settings

Behavior

Supports Anthropic, OpenAI Codex, GitHub Copilot, Gemini CLI, MiniMax, MiniMax CN, Zai, and Kimi.

Only the active model provider is fetched. Provider auth is read through Pi model registry auth storage. Providers without configured auth are skipped.

Quota data is cached for 5 minutes outside forced refreshes. Fetch failures keep the last cached row for that provider when available; otherwise no row is shown.

The /quota command writes details to widget id usage. When visible, the widget updates after a forced refresh and on the 5-minute refresh timer.

Footer/status behavior:

OpenAI Codex needs both an auth token and an account id. The account id is read from Pi auth storage first, then ~/.codex/auth.json.

Markdown source
File outline
# quota

Subscription quota dashboard for Pi.

## Install / load

Loaded through the root [pi-ext package](../../README.md).

## Commands / tools / settings

- Command:
  `/quota` — show/hide the quota widget.
  Requires interactive mode.
- Tools:
  none.
- Settings:
  none.
- Hooks/events:
  - `session_start` — clear stale footer/status state, hide widget, start the
    refresh timer, fetch active-provider quota, publish current status.
  - `agent_start` — republish footer/status from cached data.
  - `agent_end` — refresh when cache is expired, then republish footer/status.
  - `model_select` — force refresh quota for the active provider, then republish
    footer/status.
  - `session_shutdown` — stop refresh timer; clear widget, footer, and status
    state.
  - Emits `footer:segment` when `@bugabinga/pi-ext-footer` is loaded.

## Behavior

Supports Anthropic, OpenAI Codex, GitHub Copilot, Gemini CLI, MiniMax, MiniMax
CN, Zai, and Kimi.

Only the active model provider is fetched.
Provider auth is read through Pi model registry auth storage.
Providers without configured auth are skipped.

Quota data is cached for 5 minutes outside forced refreshes.
Fetch failures keep the last cached row for that provider when available;
otherwise no row is shown.

The `/quota` command writes details to widget id `usage`.
When visible, the widget updates after a forced refresh and on the 5-minute
refresh timer.

Footer/status behavior:

- With `@bugabinga/pi-ext-footer`:
  emits one segment for the active visible provider into the `llm` zone with
  `order: 4`.
- Without it:
  writes compact Pi status text under status id `quota`.
- Footer and fallback status text are filtered to the active model provider.
- Footer segment id:
  `quota:${providerName}`.
- Active provider marker:
  `●`; inactive marker:
  `◌`.

OpenAI Codex needs both an auth token and an account id.
The account id is read from Pi auth storage first, then `~/.codex/auth.json`.