Foreword

In the DSH environment, multi-vendor and multi-model calls generate fragmented token usage, latency, cost, and quota information. DSH’s plugin-based approach allows such monitoring to be integrated into the web profile. dsh-spend is a Token usage & cost monitor for DeepSeek Harness: it provides a floating window, multi-dimensional statistics, time-series charts, automatically identified Code/Token billing plans, and estimated costs in the web UI. The repository is maintained by nonewind and licensed under MIT. The directory page URL is not confirmed in the provided materials and should not be treated as an official app store entry point.

What is This

dsh-spend is a DSH web plugin whose core purpose is to replay session logs under $DSH_HOME/sessions into usage and cost views. It primarily answers three types of questions: recent token usage; costs by provider, model, directory, and session; and the status of Code plan quotas or Token plan balances. Billing plans are automatically identified, and explicit plans/pricing configurations can override the automatic identification.

Core Features

  • Three-level interaction: persistent floating capsule, hover summary preview, click-to-expand four-tab detail panel.
  • Multi-dimensional statistics: by provider, model, hour, day, session, working directory, and recent calls, including TTFT and generation speed.
  • Time-series charts: hourly breakdown for today, 24h/72h/7d trend lines, and 52-week activity heatmaps.
  • Automatic billing plan identification: built-in prices for 17 providers and 131 models, automatically distinguishing Code and Token.
  • Real-time quota/balance direct reading: adapters for 9 subscription services, with safe fallback on failure.
  • DeepSeek peak-valley pricing: automatic billing based on call time using peak/off-peak rates.
  • $ / ¥ currency switching: real-time exchange rates, fallback to usdCnyRate default 7.2 on failure.
  • Workspace filtering: scope statistics by project, supporting drill-down into subdirectories.
  • Data export: CSV / JSON / call detail CSV.
  • Auto-refresh: default 30 seconds, with manual refresh available in the panel.

Installation and Activation

Install to the web profile. The following command is from verified materials:

dsh plugin --profile web add github:nonewind/dsh-spend

After installation, verify that usage-stats appears in the combined configuration:

dsh --profile web --dump-config | grep usage-stats

The plugin requires restarting dsh web to load; HMR does not work for plugins:

dsh web

Typical Usage

First, observe the floating capsule. It displays summary information persistently in the web UI; hover to view the preview; click to enter the four-tab detail panel. Within the panel, use workspace filtering to limit statistics to a specific project or subdirectory; also switch between $ / ¥ display.

If you need direct reading of balances/quotas for DeepSeek or Moonshot, configure credential slots or environment variables, for example:

DEEPSEEK_API_KEY
MOONSHOT_API_KEY

Credentials reuse the local login state and credential slots in a read-only manner; the interface fails safely without crashing. OpenAI Codex, Claude Code, and GitHub Copilot require local login state or tokens; they fall back to local quotas when not logged in.

To override default configurations, add an insert line with the same ID (usage-stats) in ~/.dsh/profiles/web/cordis.patch.yml. The full configuration items in the materials are not confirmed; refer to the repository README for specific configurations.

Applicable Scenarios and Notes

Suitable for developers running multiple models and projects in the DSH web environment who need to review token usage, costs, quotas, and latency metrics. The plugin reads persistent logs of all sessions under $DSH_HOME/sessions; real-time quota/balance adapters involve non-public/reverse-engineered interfaces (chatgpt.com, api.anthropic.com, api.github.com, etc.), which may change at any time, but failure does not cause crashes.

The plugin runs with the current dsh process permissions. Before installation, review the source code, dependencies, and license; the confirmed license in this material is MIT.

Conclusion

dsh-spend consolidates token usage, multi-dimensional statistics, time-series analysis, estimated costs, and subscription quotas into the DSH web UI. GitHub repository: https://github.com/nonewind/dsh-spend. The directory page URL was not confirmed in the verified materials provided.