Adds a "用量" section to the DSH Settings page that shows your MiniMax Token Plan usage (5h and weekly windows with reset countdowns), per-model breakdown, and video bonus credits; fetches `/v1/token_plan/remains` via a trusted plugin that holds the API key, auto-hides when no key is configured. MIT.
Install
# from npm (prebuilt)
dsh plugin --profile web add @floatingdeaming/minimax-usage
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:Floating-Dreaming/dsh-minimax-usage#path:/trusted-plugin
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time. Only install sources you trust, and pin a commit (github:owner/repo#sha).
README
DSH (DeepSeek Harness) trusted plugin that exposes the user's MiniMax Token Plan usage data via the
minimaxUsageservice.
What it does
Runs in the DSH main Node process and provides:
ctx.minimaxUsage.getUsage({ force?: boolean }) // Promise<{ ok, models, ... }>
ctx.minimaxUsage.hasApiKey() // boolean
Backed by https://www.minimaxi.com/v1/token_plan/remains. Features:
- 60s in-memory cache + 10s rate limit
- 2-attempt retry on transient errors (timeout / 5xx / 429)
- API key resolved from
MINIMAX_API_KEYenv var or~/.dsh/.credentials.yaml - Normalized response shape with plan-level
remainingPercent*fields
Installation
This is a DSH trusted plugin, not a regular npm dependency. DSH loads it via
pnpm workspace + cordis composition patch. See the parent repo
dsh-minimax-usage for the
install.ps1 / install.sh scripts that wire it into DSH.
If you want to publish to your own npm registry:
# from this directory
npm login
npm publish --access public
Then in the DSH profile's package.json:
{
"dependencies": {
"@floatingdeaming/minimax-usage": "^1.0.0"
}
}
…and run pnpm install in the profile root.
API key
Set MINIMAX_API_KEY to a Token Plan / Subscription key (not the metered-billing
key). Sources checked in order:
process.env.MINIMAX_API_KEY~/.dsh/.credentials.yaml—MINIMAX_API_KEY: '<value>'
Changes take effect after restarting DSH.
Response shape
{
ok: true,
statusCode: 0,
summary: '查询成功',
models: [
{
modelName: 'general',
total5h: 0,
remaining5h: 0,
used5h: 0,
usedPercent5h: 17,
remainingPercent5h: 83, // ← from current_interval_remaining_percent
status5h: 1,
windowStart: '2026-08-15T12:00:00.000Z',
windowEnd: '2026-08-15T16:00:00.000Z',
resetIn5hMs: 9758306,
resetIn5hLabel: '2:42:39',
// same shape for totalWeek/remainingWeek/usedWeek/usedPercentWeek/remainingPercentWeek
},
// ...
],
fetchedAt: '2026-08-15T13:17:21.569Z',
cached: false
}
On error:
{
ok: false,
statusCode: 1004, // or 401, 503, null
summary: '请检查 MINIMAX_API_KEY(需要 MiniMax Token Plan/Subscription Key,不是按量计费 API Key)',
models: [],
errorCode: 'auth_error', // missing_key | auth_error | rate_limited | http_error | network_error | timeout | api_error
fetchedAt: '2026-08-15T13:17:21.569Z'
}
Why a trusted plugin?
DSH sandboxes dynamic plugin code — they cannot make network calls or read env vars
directly. To bridge to MiniMax's API we need a plugin that runs in the DSH main
process, which DSH calls "trusted". The dynamic client-side plugin (cordis_define
cordis_runin a session) callsctx.minimaxUsage.getUsage()via Host RPC.
License
MIT
Links
More in this category
bowenliang123/dsh-context★ 249
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
zh667/TokenLedger★ 95
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Han-1413141/dsh-cost-meter★ 90
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
Ychris12138/dsh-usage-stats★ 68
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
feibi-mochi/deepseek-harness-control-center★ 31
DeepSeek Harness control center for official balance monitoring, per-session costs and tokens, third-party token totals, completion alerts, official recharge, flexible layouts, and agent-assisted session controls.
zhu168/dsh-save-money#plugin★ 31
Pause and resume tasks automatically during user-defined time windows to avoid peak-hour API costs; includes account balance display and 10-minute granularity spend bar chart.