ai-shushu/dsh-quota-meter 预览 preview

ai-shushu/dsh-quota-meter

Per-session quota meter for DSH: real-token billing, live progress bar, budget blocking, configurable multi-model pricing.

Project Overview项目介绍

dsh-quota-meter is a quota management plugin built exclusively for DeepSeek Harness (DSH). It tracks token consumption and calculates spend per-session based on configurable model pricing, and displays a live progress bar of remaining quota above the input box. Once the set quota is exhausted, it automatically blocks new LLM calls to prevent unexpected overspending. Users can install the plugin directly via the DSH command line interface, with the option to install a specific locked version for stable production use.

This plugin is designed for DSH users who need to strictly control their LLM API usage costs. It is particularly useful for developers who frequently call DeepSeek or other third-party large models in daily work and are sensitive to incremental API spending. The typical workflow starts with the user setting a total spending limit for the current active session. After each successful LLM call, the plugin automatically calculates the cost based on the model’s predefined pricing, updates the progress bar, and alerts the user when the quota is close to exhaustion.

The plugin only requires a working DSH environment to run, with no additional external dependencies needed. It is released under the open-source MIT license, so anyone can use, modify, or distribute it freely for any purpose. All session quota and spend data is persistently stored locally in the ~/.dsh/storages/quota-meter-shushu/sessions/ directory. The data persists across DSH restarts, and old records are automatically cleaned up when the corresponding session is closed.

这是一款专为DeepSeek Harness(DSH)开发的原生配额监控插件,核心功能是对DSH每个会话窗口的大模型调用进行用量计费和额度管控。它按真实token用量结合可配置价目表计算消耗,在输入框上方显示实时剩余额度进度条,额度耗尽后会自动拦截新的模型调用。可通过DSH CLI用一条命令完成安装,也支持锁定指定版本安装在生产环境。

这款插件面向需要管控大模型API调用成本的DSH用户,适合日常开发中频繁调用DeepSeek及其他厂商大模型、对成本敏感的开发者使用。典型工作流为:用户预先为当前会话设置总消费额度,插件会在每次模型调用结束后根据对应模型的定价自动核算扣费,同步更新进度条显示剩余额度,额度不足时发出提醒。

该插件仅依赖已安装的DSH环境,无需额外外部依赖,采用MIT许可证开源,可免费使用和修改。额度和已消耗金额会随会话持久化存储在本地~/.dsh/storages/quota-meter-shushu/sessions/目录下,重启DSH不会丢失数据,关闭会话后会自动清理记录。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • 16 stars - an early-stage project星标 16,属于早期项目
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:ai-shushu/dsh-quota-meter

把 ai-shushu/dsh-quota-meter 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

Quota Meter · 会话额度监控

Per-session spend & quota meter for DSH — real token billing, live progress bar, budget blocking, configurable multi-provider model pricing.

给 DSH 的每个会话窗口设置金额额度:按真实 token 用量 × 可配置价目表记账,输入框上方显示消耗进度条,额度耗尽时自动拦截新的模型调用。

Screenshots / 效果

设置额度 消耗反馈
Set quota Billing feedback
未配价模型提示 限额弹窗
Unpriced model Quota exhausted

✨ Features / 特性

  • Real-token billing — 按 dsh llm/stream 的真实 usage 记账,缓存命中/未命中/输出分档计费
  • Live progress bar — 输入框上方 2px 细条实时显示剩余额度(右对齐倒退),请求发起时左侧"燃烧"亮点脉动,扣费瞬间弹出 -¥ 金额徽标
  • Budget blocking — 额度耗尽自动拦截新的模型调用(agent/pre-step),并弹出提示
  • Configurable pricing — 价目表 UI 可编辑、按模型持久化;支持峰谷(time-of-day)定价,每个模型可自定义时区与高峰时段
  • Per-provider model pricing (v0.6+) — 价目表以 (provider, model) 二元组为键:多个厂家提供同名同 ID 模型(如两个厂家的 deepseek-v4-pro)可独立配价、独立记账,互不覆盖;「添加模型」的平台字段从目录下拉选择(受控枚举),杜绝手滑拼错厂家产生重复
  • Update check (v0.6+) — 价格弹层内检测远端最新版本(git ls-remote 为主、GitHub API 兜底):发现新版本时提示更新方式(bash install.sh / dsh plugin --profile web update);纯提醒、不自动改代码,30 分钟缓存避免频繁打远端
  • Per-session scope — 记账按会话独立;子代理消耗自动并入父会话额度(沿代理链上溯到根父),额度条显示真实总花费;辅助调用(标题生成/上下文压缩)同样计费
  • Persistent ledger — 额度与已花金额跟随会话持久化(~/.dsh/storages/quota-meter-shushu/sessions/),重启 dsh 不丢;会话关闭时自动清理,与对话记录生命周期一致

📦 Install / 安装

Any machine with dsh CLI — 任意装有 dsh 的机器,一条命令:

dsh plugin --profile web add github:ai-shushu/dsh-quota-meter

Locked version — 锁版本安装(推荐正式环境):

dsh plugin --profile web add github:ai-shushu/dsh-quota-meter#v0.4.0
  • Client(进度条/弹层 UI)→ 刷新浏览器即生效
  • Host(记账/拦截/接口)→ 重启 dsh web 进程生效
  • Uninstall / 卸载:dsh plugin --profile web remove quota-meter-shushu

Local development — 本地开发用 checkout 链接(改动即时反映): dsh plugin --profile web add /path/to/quota-meter-plugin

💰 Pricing / 计价

价目表动态可编辑(UI 入口:额度条行尾「价格」),持久化到 ~/.dsh/storages/quota-meter-shushu/prices.json。 按 2026-08-17 起 DeepSeek 官方价(涨幅后),单位 ¥/每 1M tokens:

deepseek-v4-flash

缓存命中 缓存未命中 输出
空闲时段 ¥0.05 ¥1.5 ¥4.5
高峰时段 ¥0.10 ¥3.0 ¥9.0

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-session-sync 下一个 Next dsh-plugin-manager →