← Catalog

@cwillam/pi-minimax-usage

Pi extension: live MiniMax Token Plan usage (5h + weekly) in the status bar. Not affiliated with MiniMax Inc.

Extension

Install

Install with PiG

pig install npm:@cwillam/pi-minimax-usage

Install with Pi

pi install npm:@cwillam/pi-minimax-usage
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 1.1.0 (README.md). PiG does not review it.

pi-minimax-usage

Pi extension that puts your MiniMax Token Plan usage in the status bar.

MiniMax 5h●43% ↺3h12m  wk●12% ↺4d8h

Two windows: the 5-hour rolling quota and the weekly quota, each as used-percent with a reset countdown. Colour shifts at 70 % (yellow) and 90 % (red). Automatically adapts to narrow laptop screens and split panes (compact / minimal mode). The block vanishes when you switch away from MiniMax.

Not affiliated with, endorsed by, or sponsored by MiniMax Inc. "MiniMax" is a trademark of MiniMax Inc. This extension only reads the publicly documented quota endpoint.

Install

pi install npm:@cwillam/pi-minimax-usage

Make sure the minimax provider is configured in pi (API key available). Restart Pi, switch to a MiniMax model, the block shows up in the footer within about a second.

Slash command

/minimax-usage           show current snapshot with visual progress bars
/minimax-usage refresh   force-poll now
/minimax-usage help      command help

Example snapshot:

MiniMax Token Plan (global • mode: compact)
  5h : [████░░░░░░]  43% used ↺ in 3h 12m (19:22)
  wk : [█░░░░░░░░░]  12% used ↺ in 4d 8h (Mon 14:00)
endpoint: https://www.minimax.io/v1/token_plan/remains
last poll: 14s ago (interval: 60s)

Settings

Optional, under minimaxUsage in ~/.pi/agent/settings.json:

{
  "minimaxUsage": {
    "refreshIntervalMs": 30000,   // min 5000, default 60000
    "host": "global",             // "global" or "cn"
    "endpoint": "https://www.minimax.io/v1/token_plan/remains",  // overrides host, must be on the allowlist
    "displayMode": "auto",        // "auto" (default), "full", "compact", or "minimal"
    "prefix": "full"              // "full" (MiniMax), "short" (MM), or "none"
  }
}

Display modes (laptop & split pane friendly)

  • auto (default): Dynamically adapts to your terminal columns (full on ≥ 115 cols, compact on ≥ 85 cols, minimal on < 85 cols).
  • full: MiniMax 5h●43% ↺3h12m wk●12% ↺4d8h (~36 chars)
  • compact: MM 5h●43% ↺3h wk●12% ↺4d (~25 chars)
  • minimal: 5h●43% wk●12% (~14 chars, keeps the footer ultra-clean)

The endpoint setting only accepts the two documented MiniMax URLs (exact match). Anything else is ignored, falls back to host.

How it works

On session start or model switch, it grabs the API key for the minimax provider via ctx.modelRegistry.getApiKeyForProvider() and polls GET /v1/token_plan/remains every refreshIntervalMs. The response's general bucket gives two *_remaining_percent fields (5h + weekly); the extension inverts them to consumed-% and paints the footer.

Wire-format details the parser handles:

  • HTTP 200 even on auth failure — the real code lives in base_resp.status_code (1004 = no key, 2049 = wrong host)
  • The *_remaining_percent fields are remaining, not consumed — inverted to match the rest of the app
  • Timestamps are epoch milliseconds, not seconds
  • Only the general bucket is shown; video/other buckets are ignored

Troubleshooting

SymptomCauseFix
MiniMax no api keyNo credential for minimax providerConfigure it like any other pi provider
MiniMax 1004 or MiniMax invalid keyKey rejected for this hostFlip host between global / cn, or set endpoint to the matching URL
Block doesn't appearActive provider isn't minimaxCheck with /model
Stale data after model switchCached state cleared on switchNext poll (~1 s) repopulates it

Run /minimax-usage to see the current snapshot, error, and last-poll timestamp.

Credits

Wire-format field names came from ai-usagebar (Rust). Architectural pattern borrowed from @d3ara1n/pi-usage-block.

License

MIT — see LICENSE.