Skip to content

Ychris12138/dsh-usage-stats

373Last commit Aug 15, 2026

dsh-usage-stats DSH plugin

dsh-usage-stats provides a unified account card showing balances or subscription quotas, along with token usage analytics including daily, monthly, and cumulative stats, cache hit rates, and a calendar heatmap. It runs a background refresh every five minutes and supports multiple provider adapters such as New API, Sub2API, and custom declarative queries.

How to install the dsh-usage-stats DSH plugin

dsh plugin --profile web add "github:Ychris12138/dsh-usage-stats

Copying does not run this command. Review the repository and version before installing the dsh-usage-stats DSH plugin.

dsh-usage-stats DSH plugin data source

dsh-usage-stats DSH plugin snapshot date: Aug 16, 2026

discovered

What the dsh-usage-stats DSH plugin can do

  • Unified account card displaying provider balance or token plan quota with normal/warning/critical status.
  • Token usage analytics with daily, monthly, cumulative stats, cache hit rate, and calendar heatmap drill-down by date, provider, and model.
  • Background monitoring that refreshes all configured accounts and local token aggregations every five minutes, independent of panel open state.
  • Extensible adapter system supporting New API, Sub2API, general balance, and declarative JSON Pointer custom queries.
  • Local-only security: five endpoints accept only loopback GET requests; credentials are never sent to the browser.

Where the dsh-usage-stats DSH plugin fits

  • Monitor API provider balances (e.g., DeepSeek, OpenRouter, Moonshot) directly from the DSH web sidebar.
  • Track token consumption per provider and model over time, with monthly and daily breakdowns.
  • Set up alerts for low balances or quota thresholds using warning and critical levels.
  • Integrate custom provider account queries via declarative adapters without writing code.
  • Validate token usage data with live session comparison and offline tests.

Who the dsh-usage-stats DSH plugin is for

  • Developers who run DeepSeek Harness and need to manage multiple API provider accounts.
  • Operations teams that require automated token usage tracking and balance monitoring for cost control.

dsh-usage-stats DSH plugin limitations

  • Requires DeepSeek Harness `web` profile with `@deepseek-ai/dsh >= 0.1.0-rc.6`.
  • Credentials (API keys, tokens) must be pre-configured in `~/.dsh/.credentials.yaml`; installation does not create or modify that file.
  • Providers without a public account interface cannot show balance; the card will display 'unsupported'.
  • All plugin endpoints are restricted to loopback only; exposing them via reverse proxy is not recommended without additional authentication.

dsh-usage-stats DSH plugin: from the repository README

Quoted from the Ychris12138/dsh-usage-stats README, the upstream source of the dsh-usage-stats DSH plugin. Copyright remains with the original authors.

为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 网页端提供多供应商账户监测与 Token 用量分析。 Provider balances, subscription quotas, and token-usage analytics for the DeepSeek Harness Web GUI (`dsh web`). ![dsh-usage-stats v0.2.0 interface preview](docs/images/usage-panel.svg) > 展示图使用脱敏演示数据;插件不会把 API Key、Cookie、管理 PAT 或上游原始响应发送到浏览器。 ## 一眼看懂 / At a glance | | 能力 | 说明 | | --- | --- | --- | | 💳 | 统一账户卡片 | API 供应商显示余额,Token Plan 显示分窗口额度;面板一次只呈现当前供应商 | | 📊 | Token 用量分析 | 今日、本月、累计、缓存命中率、月历热图,以及按日期/供应商/模型下钻 | | 🔄 | 后台监测 | 服务端启动即刷新,之后每五分钟更新全部已配置账户与本地 Token 聚合 | | 🧩 | 可扩展适配器 | 支持 New API、Sub2API、通用余额模板,以及声明式 JSON Pointer 自定义查询 | | 🔒 | 本机安全边界 | 五个端点仅接受回环 GET;凭据只在服务端解析并发往校验后的供应商地址 | 界面支持中文和英文。浏览器只请求当前选择的 provider;后台刷新与面板是否打开无关。手动刷新会更新用量、供应商列表,并强制刷新当前账户,不会批量强制请求其他供应商。 ## 快速安装 / Quick start 需要 DeepSeek Harness `web` profile(`@deepseek-ai/dsh >= 0.1.0-rc.6`)。 ```bash dsh plugin --profile web add "github:Ychris12138/dsh-usage-stats" ``` 然后重启已经运行的 `dsh web`,并在浏览器中硬刷新。侧边栏底部会出现“用量/余额”(Usage/Balance)入口。 升级或卸载: ```bash dsh plugin --profile web update dsh-usage-stats dsh plugin --profile web remove dsh-usage-stats ``` <details> <summary><strong>兼容安装器:无法使用 dsh plugin 时展开</strong></

Read the full READMERepository license: MIT

dsh-usage-stats DSH plugin questions

How do I install dsh-usage-stats?

Run `dsh plugin --profile web add "github:Ychris12138/dsh-usage-stats"` in your terminal. Ensure you have DeepSeek Harness web profile with version >= 0.1.0-rc.6. Then restart `dsh web` and hard refresh the browser. The plugin will appear in the sidebar as "Usage/Balance".

How do I configure API keys for different providers?

Add the required credentials to `~/.dsh/.credentials.yaml`. For example, `DEEPSEEK_API_KEY: sk-your-key` for DeepSeek, `OPENROUTER_MANAGEMENT_KEY: sk-or-v1-...` for OpenRouter, `ZAI_API_KEY: your-key` for Z.ai, etc. The plugin reads these automatically. Do not place real keys in git or share them publicly.

Why can't I see the balance for some providers?

Providers without a public account interface will display "unsupported" for the balance card. Token usage statistics will still work. If you believe a provider should be supported, you can add a custom monitor using the `declarative` adapter with a JSON Pointer extraction.

Is my API key safe? Does the plugin send keys to the browser?

No. API keys, cookies, and management tokens are parsed only on the server side and are never included in browser responses, plugin cache, or logs. The plugin endpoints are restricted to loopback GET requests. Credentials are only sent to verified provider addresses after domain validation.

How often does the plugin refresh account data?

The background monitor refreshes all configured accounts and local token aggregations every five minutes. The refresh is independent of whether the panel is open. You can also manually refresh by clicking the refresh button in the panel, which will update tokens, provider list, and force-refresh the current account.