在 DSH 设置页「用量」section 展示 MiniMax Token Plan 的 5 小时 / 周窗口用量(带重置倒计时)、单模型明细与视频赠送额度;通过 trusted plugin 调 `/v1/token_plan/remains` 拿 key,未配置 key 时整段 section 自动隐藏。MIT。
安装
# npm 包(预构建)
dsh plugin --profile web add @floatingdeaming/minimax-usage
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:Floating-Dreaming/dsh-minimax-usage#path:/trusted-plugin
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 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
链接
同类插件
bowenliang123/dsh-context★ 1791
DSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
Han-1413141/dsh-cost-meter★ 361
会话与当日 API 费用统计、预算图框(已用%)、官方余额、历史看板,支持峰谷计价与官方价格一键同步。
wssfk12138/dsh-damage-pulse★ 237
在 DSH Web 界面追踪 DeepSeek Token 用量、单次与会话费用及账户余额,并显示缓存感知的扣费动画。
zh667/TokenLedger★ 202
侧边栏用量面板:把 Token 归属到实际服务该请求的中转站,站点从已有的 provider 配置中读出,无需额外配置;含今日/本月/累计三窗口、按站点与模型下钻、一年活跃度热力图,以及 New API / Sub2API / DeepSeek 余额。
Ychris12138/dsh-usage-stats★ 167
多供应商用量看板:按供应商/模型统计 Token 与日期下钻,统一展示账户余额,并追踪 OpenCode Go / Z.ai 订阅额度。
PolinniZhong/dsh-personal-center★ 118
DeepSeek Harness 个人中心:跨会话用量统计、按模型成本估算、全局自定义指令、外观全局字号、数据驱动的桌面宠物(位图/矢量皮肤)与会话状态概览,纯本地离线运行。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。