DeepSeek Harness plugin

dsh-token-usage-kefanj

Token usage & cost dashboard for DeepSeek Harness (DSH): today/week/month token totals, real-time cost estimation from DeepSeek's official pricing, thinking/task durations, per-model & per-project

Jump to install

Source facts

Repository
KeFan-J/dsh-token-usage
Latest update
Aug 17, 2026
Category
Development & Runtime
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/KeFan-J/dsh-token-usage
Plugin: dsh-token-usage-kefanj
Author: KeFan-J

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer4 files
README.en.mdSource · read only
README language

dsh-token-usage

Token usage & cost dashboard for DeepSeek Harness (DSH) — a hot-pluggable plugin that adds a full statistics page under Settings → “Token 用量”.

> 中文文档(简体)

---

What it does

Every model call in DSH appends an assistant/message event to the durable session log with exact token accounting (input / output / cache-read / cache-write / reasoning). This plugin listens to that feed live across all sessions and, on startup, replays every persisted session log — so totals include history from before the plugin was installed and survive restarts.

Dashboard contents

SectionShows
Today / This Week / This Monthtoken totals + estimated cost, with input / output / cache-hit breakdown
Weekly task statsthinking time (from reasoning-delta chunks), total task time, task count, step count
Task Top 3this week's heaviest tasks (turn token totals) with title, project, duration, cost
14-day chartstacked bars (input / output / cache-hit) with a cursor-following hover tooltip showing the full per-day detail
Model rankingthis week's token ranking per model with %, progress bar and cost
Project statstoken usage grouped by workspace (session cwd), switchable between this week / all-time
Pricing panelofficial DeepSeek pricing (standard & peak/off-peak), one-click fetch from the official docs site, or manual edit

Cost estimation

  • Uses DeepSeek's official pricing (USD or CNY), either fetched live from api-docs.deepseek.com (a resilient parser walks the Docusaurus chunk chain) or entered manually — prices change, so there is a “fetch latest prices” button.
  • Supports the official peak / off-peak billing switch: peak = off-peak × 2 during peak hours (UTC 01:00–04:00 / 06:00–10:00), applied per request timestamp; the effective rate switches automatically at the announced change date (or is set manually per model).
  • Cache-hit tokens are billed at the low cache-hit rate; cache-write tokens at the input rate.

Requirements

One-click install

bash -c "$(curl -fsSL https://raw.githubusercontent.com/KeFan-J/dsh-token-usage/main/install.sh)"

Or install to a custom directory:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/KeFan-J/dsh-token-usage/main/install.sh)" - ~/tools/dsh-token-usage

The script clones the repo, installs dependencies, and mounts the plugin into the DSH web profile. Then:

1. Restart DSH: npx @deepseek-ai/dsh web 2. Hard-refresh the browser (Cmd+Shift+R) 3. Open Settings (gear icon) → “Token 用量”

> Re-run the same command later to update (auto git pull + remount).

Manual install

git clone https://github.com/KeFan-J/dsh-token-usage.git
cd dsh-token-usage
pnpm install
dsh plugin --profile web add "link:$(pwd)"
# restart DSH + hard-refresh browser

How it works

  • Host half (lib/index.js): listens to the global session/event firehose and replays session logs on startup; folds usage per day / per day×model / per day×project; tracks thinking time (reasoning-delta chunk span per step) and task duration (turn/startturn/end); computes cost from the effective official prices (peak-aware); serves /api/dsh-token-usage/* JSON routes. Deduplicates live vs. replay via sessionId:seq.
  • Browser half (lib/client.js): registers the Settings page in the settings.section slot, styled entirely with --dsw-* theme tokens (light/dark ready).
  • Mounted as a bare plugin row (cordis.patch.yml) via the DSH profile bundle layer — no changes to dsh source.

Data & privacy

  • All data stays local: usage is derived from DSH's own session logs, costs are computed locally, and no telemetry is sent anywhere.
  • The only outbound request is the optional “fetch latest prices” button, which reads the public DeepSeek pricing page.

License

[MIT](LICENSE)