Custom integration exposing your MiniMax token plan quota in Home Assistant — including rolling consumption deltas (last hour / last 2 hours).
Polls https://www.minimax.io/v1/token_plan/remains every 60 s and creates:
| Sensor | Type | Description |
|---|---|---|
| 5h usage | % | Usage in the current 5-hour window |
| 5h reset | timestamp | End of the current 5h window |
| Weekly usage | % | Usage in the current weekly window |
| Weekly reset | timestamp | End of the current weekly window |
| Δ 5h usage last hour / 2 hours | percentage points | Rolling-window consumption |
| Δ weekly usage last hour | percentage points | Rolling-window consumption |
A second device “— Video” exposes the weekly sensors for the video model group. The misleading "5h" value the API returns for video (it is actually a 24 h window) is intentionally hidden.
Every poll is stored as a sample in a rolling 48 h history (.storage/minimax_usage.samples, private file). Deltas are computed from sample differences. When the time window resets between two samples, only the new value counts as increment — resets never produce phantom consumption. History starts empty; all windows are filled after ~1–2 h of polling.
- Home Assistant ≥ 2024.12 (tested on 2026.10)
- An active MiniMax token/subscription plan
- A subscription API key from platform.minimax.io
Requires the integration to be installed first (HACS or manual).
- HACS → Integrations → ⋮ (top right) → Custom repositories
- Add
https://github.com/e-p-s/ha-minimax-usage, category Integration - Install → restart Home Assistant
- Copy
custom_components/minimax_usage/to/config/custom_components/ - Restart Home Assistant (a full restart, not just a reload)
Settings → Devices & Services → Add Integration → “MiniMax Usage” → paste your API key. The key stays editable afterwards via the integration's Configure (gear) button.
- The API key is stored only in the local config entry (
.storage, private). - The only outbound calls go to
minimax.io. - The sample history contains percentage values only.
| Problem | Cause / fix |
|---|---|
| Integration not in the search list | Full restart required after first install |
| Entry shows an error | Restart Core; check Settings → System → Logs |
| Deltas stay 0 | History needs to build up (≥ 1–2 h) |
MIT — see LICENSE.
