dsh-token-attention
Manifest valid★ 3Token Check · Token Management: The token attention management panel for DeepSeek Harness (DSH) — records token consumption and cost by task/day/week/month (hit/miss/output/inference), supports DeepSeek peak and off-peak pricing, and provides execution timing recommendations for switching conversations and writing hand-offs.
dsh-token-attention — Token Check for DeepSeek Harness
English | 中文说明
Token Check is a token-attention management panel for DeepSeek Harness (DSH). It records every conversation's token usage and estimated cost by task / day / week / month, recognizes task types, and — combined with DeepSeek's peak/off-peak pricing and DSH's context mechanics — tells you when to run a task, whether to switch sessions, and whether to write a hand-off file.
It is not a money-saving tool: it never throttles or cancels requests. It presents facts and advice; you decide.
Features
- Five views in DSH Settings — Overview / Sessions / Tasks / Cost / Settings
- Per-task ledger — token consumption (input hit / miss / output / reasoning) and estimated cost, rolled up by day / week / month
- Task-type recognition & advice engine — best execution window, switch-session, hand-off, context, cost and model suggestions
- Attention KPI — attention score, hit rate, context occupancy, compaction count per session
- Peak/off-peak pricing — DeepSeek off-peak half-price windows (peak 9:00–12:00 / 14:00–18:00), estimated cost breakdown by bucket
- Multi-model breakdown — cost and hit rate per model (e.g. deepseek-v4-flash / pro / grok)
- Ledger export — Markdown / CSV download, one-click hand-off template
- Editable settings — pricing table, peak hours, advice thresholds; new records are priced immediately
- Zero runtime dependencies — local SQLite via
node:sqlite; no network calls
Screenshots
Overview — today's usage, cost, hit rate, attention score, model mix, advice card, and trend
Session card — per-session model breakdown and attention metrics
Tasks — task ledger with Markdown / CSV export
Cost — peak split, cost leverage breakdown, and model comparison
Settings — pricing table, peak hours, and advice thresholds
Install
Once published to npm:
dsh plugin --profile web add dsh-token-attention
Restart DSH, then open Settings → 词元管理 (Token Check). Data is stored at DSH_HOME/token-attention/token_records.db.
Development install (link)
npm install && npm run build
Then register the plugin in the web profile (%APPDATA%\dsh-desktop\harness\profiles\web\package.json):
{
"dependencies": { "dsh-token-attention": "link:/path/to/dsh-token-attention" },
"dsh": { "profile": { "bundles": ["...", "dsh-token-attention"] } }
}
Run pnpm install inside profiles\web, restart DSH, and verify:
curl http://127.0.0.1:<port>/token-attention/api/health # → {"ok":true,...}
How it works
- Collection: the node half subscribes to DSH's
session/eventstream (usage, goal, subagent, compaction, turn) and writes normalized records to SQLite; a startup backfill replays existing sessions with an idempotentlast_seqcursor. - Aggregation: hourly incremental rollups into
daily_agg, with a daily full rebuild for correction. - Official projection adapter (optional): when the base layer mounts
session-projection+token-meter+session-stats, the session card reads context occupancy fromcontextPressure.projectedTokens(compaction-reactive, official capacity) and turn/step/LLM/tool/decode stats fromsessionStats(same source as DSH's built-in stats bar); it falls back to its own computation when those units are absent — no extra dependencies. - Advice:
src/shared/advice.tsevaluates context occupancy, turns, hit rate, cost and model mix against your thresholds and suggests concrete actions.
Configuration
Settings are editable in the panel and saved to SQLite:
| Setting | Default |
|---|---|
| Model pricing (¥ / million tokens, off-peak) | flash: hit 0.05 / miss 1.5 / output 4.5 |
| Peak hours (24h, start-inclusive) | 9–12, 14–18 |
| Context-occupancy advice threshold | 70% |
| Turn-count advice threshold | 40 |
| Hit-rate advice threshold | 40% |
Development
npm run typecheck # tsc --noEmit
npm run check # node --check src/client/index.js
npm run build # tsc → dist/
npm run selftest # collection-layer self-test (idempotency / peak pricing / aggregation assertions)
npm pack # build the publish tarball
Uninstall
Uninstall in DSH Settings → Plugins, or remove the dependency and the bundles entry from the profile's package.json. The data directory DSH_HOME\token-attention\ can be deleted manually; dispose cleans up timers and the SQLite connection.
License
MIT © 2026 Young4ever33
Comments
Loading…
Similar plugins
by hugoyee75-cmyk
把经过 DeepSeek Harness 的每一次模型调用记下来,在侧边栏给你一个 Token 用量统计页。按模型/供应商/项目/来源/账号/日期拆分,带缓存命中率、趋势图表与自更新。A Token usage statistics plugin for DeepSeek Harness.
★ 15
↓ 425/wk
MIT
JavaScript
Oct 28, 2026
dsh plugin --profile web add dsh-token-metricsby olimc2016
DSH(DeepSeek Harness)Token 用量与花费面板插件:今日消费、预算进度、成本构成、缓存命中省下的钱。社区插件,非官方。
★ 1
MIT
JavaScript
Oct 19, 2026
dsh plugin --profile web add dsh-token-meter-panelby feibi-mochi
DeepSeek Harness control center for balance, usage, peak/off-peak pricing, encrypted multi-account switching, health checks, reminders, recharge, and session controls. / 余额、用量、峰谷计费、加密多账户、健康检查、提醒、充值与会话
★ 76
MIT
JavaScript
Sep 9, 2026
dsh plugin --profile web add deepseek-harness-walletby GIN0076
📊 Token usage dashboard for DeepSeek Harness Settings — daily/weekly/monthly per-model token stats with line & bar charts. Local-first, zero deps, pure SVG. DSH 设置面板词元用量统计插件
★ 0
MIT
JavaScript
Oct 1, 2026
dsh plugin --profile web add @local/token-usageby nonewind
Token usage & cost monitor for DeepSeek Harness — floating widget with multi-dimensional stats, time-series charts, auto-detected billing plans (Code/Token) and estimated spend.
★ 8
↓ 231/wk
MIT
JavaScript
Sep 7, 2026
dsh plugin --profile web add dsh-spendby jLeon-account
DeepSeek Harness(DSH)网页客户端插件:实时展示会话级 API token 用量与估算费用,支持缓存命中/未命中分桶、上下文占用,自动适配 DeepSeek 峰谷计价与调价|DSH web plugin: real-time token usage & cost estimate
★ 4
JavaScript
Aug 14, 2026
dsh plugin --profile web add dsh-client-usage