Back to home@qingfeng200410

dsh-plugin-dosage

DeepSeek Harness 用量插件。把多供应商余额监测和 DeepSeek 峰谷计费合进侧栏同一个「用量/余额」浮层:账户额度、Token 统计、消耗概览、月历、调用记录和官方价格一次看完,换项目数据也不丢

Stars
1
Language
JavaScript
Created
Aug 17, 2026
Updated
Aug 17, 2026
GitHub repo

Introduction

dsh-plugin-dosage

English · 简体中文

GitHub · MIT

A DeepSeek Harness plugin: one sidebar entry for multi-provider balances and peak/off-peak cost.

License Node

This plugin combines dsh-usage-stats account monitoring with dsh-usage-plugin per-call billing, then puts both behind a single sidebar popover. There is no extra tab next to Conversation / Trace.

Screenshots

Overview

Overview

Usage

Usage

What you get

Click Usage/Balance at the bottom of the sidebar. The popover has five tabs:

TabWhat it shows
Usage & BalanceCurrent provider balance or Token Plan, today / month / all-time tokens, cache hits, today's cost, last 14 days
OverviewTotal spend, peak vs off-peak split, per-model totals
UsageMonthly heatmap (cost, call count, or tokens); click a day for detail
Call logEach call's model, hit rate, finish reason, and peak/off-peak cost; Today / 7 days / 30 days / All
PricesOfficial DeepSeek unit prices for deepseek-v4-flash and deepseek-v4-pro, stacked vertically; the table is not editable

The call log and the 14-day list read the same session logs. While the popover is open, tokens, today's cost, and the current provider balance refresh every 10 seconds. The only usage entry is the sidebar footer.

Peak hours are 09:00–12:00 and 14:00–18:00 Beijing time. Models without an official price are counted as ¥0.

Install

Needs the DeepSeek Harness web profile, plus dsh and pnpm.

dsh plugin --profile web add -w github:qingfeng200410/dsh-plugin-dosage#v1.13.0

Restart a running dsh web and hard-refresh the browser. Usage/Balance appears in the sidebar footer.

For another profile, replace web. Local tarball:

dsh plugin --profile web add ./dsh-plugin-dosage-1.13.0.tgz

Upgrade

dsh plugin --profile web add -w github:qingfeng200410/dsh-plugin-dosage#v1.13.0

add the latest tag. Do not use dsh plugin update on a Git ref.

Uninstall

dsh plugin --profile web remove dsh-plugin-dosage

Restart after uninstall. Files under ~/.dsh/dsh-usage/ are kept.

Do not install both

This package already includes those two plugins. Installing them together gives you two sidebar buttons or colliding routes:

dsh plugin --profile web remove dsh-usage-stats
dsh plugin --profile web remove @feiyang666/dsh-usage-plugin

Also delete leftover name: dsh-usage-stats or @feiyang666/... rows in ~/.dsh/profiles/web/cordis.patch.yml.

Accounts and credentials

The plugin uses providers already configured in Harness. Credentials are resolved on the host and never sent to the browser. DeepSeek uses the same DEEPSEEK_API_KEY as Settings → Models.

ProviderModeDefault credential
DeepSeekBalanceprovider apiKeyEnv
OpenRouterBalanceOPENROUTER_MANAGEMENT_KEY (not the inference key)
Moonshot / Kimi APIBalanceprovider apiKeyEnv
OpenCode GoSubscriptionOPENCODE_GO_API_KEY or local auth.json
Z.aiSubscriptionZAI_API_KEY
Kimi For CodingSubscriptionKIMI_API_KEY
MiniMax Coding PlanSubscriptionMINIMAX_API_KEY
New API / Sub2API / customSee monitors belowcredential ref

Providers without a public account API still get token stats. The account card says “unsupported” instead of inventing a balance.

Put New API, Sub2API, or declarative monitors on this plugin's Cordis config. Do not also mount dsh-usage-stats:

# ~/.dsh/profiles/web/cordis.patch.yml
- insert:
    - id: plugin-dosage
      name: 'dsh-plugin-dosage'
      config:
        monitors:
          relay-a:          # must be a real Harness provider id
            adapter: new-api

Full adapter and security notes: dsh-usage-stats.

Data

All user-level; nothing is written into the current project:

FilePath
Call records~/.dsh/dsh-usage/usage-records.json (cap 100,000)
Price config~/.dsh/dsh-usage/pricing.json
Default export~/.dsh/dsh-usage/{csv,json,images}/
Token fold cache~/.dsh/storages/usage-stats-cache.json
Boot log~/.dsh/dsh-usage/dsh-usage-boot.log

If DSH_HOME is set, paths are relative to that directory. The panel can export CSV / JSON / PNG and merge-import by timestamp.

FAQ

SymptomFix
Two Usage/Balance buttonsRemove standalone dsh-usage-stats and its patch row
No sidebar entry after installRestart dsh web and hard-refresh; confirm the package is listed for the web profile
Unexpected end of JSON inputMissing Cordis inject. Reinstall with dsh plugin add above; do not hand-edit a truncated row
OpenRouter shows not configuredSet OPENROUTER_MANAGEMENT_KEY in ~/.dsh/.credentials.yaml
dsh plugin cannot find pnpmnpm install -g pnpm or corepack enable

Do not paste .credentials.yaml, API keys, or cookies into issues.

Acknowledgements

This plugin combines and builds on two MIT projects:

ProjectAuthorLicenseUsed for
dsh-usage-statsYchris12138 and contributorsMITMulti-provider accounts, token aggregation, loopback APIs, sidebar Usage/Balance entry
dsh-usage-pluginfeiyang-devMITPeak/off-peak billing, overview / usage / call log / prices, CSV/JSON/PNG export, POST /usage/api
DeepSeek HarnessDeepSeekMITHost and Cordis plugin runtime

On top of those, this repo mainly did the following integration, UI work, and extras:

  • Both feature sets live in one sidebar Usage/Balance popover (five tabs); the extra tab next to Conversation / Trace is gone, and so is the Settings usage section
  • Overview / Usage / Call log / Prices were redesigned: a single total with a peak/off-peak bar, empty calendar days stay unfilled, a shorter call-log table, and stacked price cards
  • The account tab adds cache hits, hit rate, and today's cost; its monthly heatmap was removed (the calendar stays on Usage) and the heatmap gained a by token mode
  • The call log uses the same session logs as the last-14-days list, instead of only stream snippets the plugin captured itself
  • While the popover is open, tokens / today's cost / the current provider balance refresh every 10 seconds; click outside to close; height is locked to the Usage tab
  • Records live at user-level ~/.dsh/dsh-usage/ so switching projects does not split the data; the official price table is fixed (not editable); models without an official price are ¥0; model names are shown as requested

Full terms: LICENSE and NOTICE. DeepSeek is a trademark of DeepSeek. This is a community plugin and is not affiliated with DeepSeek.

Contributing

Issues and pull requests are welcome — UI tweaks, bug fixes, and new features all help.

This is my first public open-source project. The docs, code, and UX will have rough edges; please bear with them. If something is broken, or you believe any part infringes your rights and should be taken down, open an issue. I will look into it and remove or fix the material as soon as I can.

License

MIT