AI Agent Hub
Back to plugins
🧩

dsh-usage-ledger

admin-security Updated 2026.08.18

Run the following command in DeepSeek Harness:

dsh plugin install beijingwahw/dsh-usage-ledger

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install beijingwahw/dsh-usage-ledger in a terminal where DeepSeek Harness is available to install the plugin; the full source repository is at https://github.com/beijingwahw/dsh-usage-ledger .

About this plugin

When a team runs multiple LLM back-ends through DeepSeek Harness, token cost quickly becomes the least transparent part of the stack: which session burned how many tokens, what it actually cost, and how much budget remains are rarely visible in one place. dsh-usage-ledger is a cost-ledger plugin built to turn those scattered per-message usage records into an auditable, interceptable accounting ledger.

Its capabilities revolve around three pillars. First, it aggregates token spend per session, per Beijing-time day, and per lifetime, persisting everything to a local ledger file. Second, it tracks dynamic official pricing: it periodically scrapes the pricing pages of DeepSeek, Zhipu GLM, Moonshot Kimi, Alibaba Qwen, ByteDance Doubao, MiniMax, and Baidu ERNIE, parsing and hot-reloading prices so that official hikes or newly published models take effect without a single line of code change; it also recognises the official DeepSeek peak/off-peak schedule and resolves the correct rate at the exact Beijing time of each call. Third, it enforces daily, lifetime, and per-session budgets with a configurable warning ratio, and can hard-block model calls through the llm/stream gate when a threshold is exceeded. A built-in web dashboard (served at /usage-ledger) and a JSON API round out the experience, making spend data easy to visualise and export.

The plugin is best suited to individual developers or small teams who run DeepSeek Harness with several domestic Chinese LLM back-ends and want real-time cost tracking and budget guard-rails without reaching for an external SaaS.

Use Cases

  • Track token spend and remaining budget across multiple domestic LLM vendors in one unified view
  • Follow official pricing changes and new model releases automatically without code edits
  • Set daily, lifetime, and per-session budgets with hard enforcement to prevent cost overruns

Best For

  • Developers and small teams running DeepSeek Harness with multiple domestic Chinese LLM back-ends
  • Teams that prefer a self-hosted cost-audit solution over an external SaaS
  • Tech leads who care about peak/off-peak pricing and fine-grained multi-vendor cost control