dsh-usage-chart

usagetested: passnpmMIT

Token, cost, and balance dashboard under the composer: live indicator plus zero-dependency SVG charts for per-turn usage, estimated cost, and DeepSeek account balance.

下载量 / Downloads
2,129
依赖体积 / node_modules
1.37 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add dsh-usage-chart

Sandbox test results

StageResult
1 install✓
2 list✓
3 mount✓
4 boot—

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

dsh-usage-chart

A usage, cost, and account-balance dashboard for DeepSeek Harness Web.

![npm version](https://www.npmjs.com/package/dsh-usage-chart)

![CI](https://github.com/Max-Samson/dsh-usage-chart/actions)

![License](./LICENSE)

[简体中文](./README_ZH.md) · Report an issue · [Changelog (EN)](./CHANGELOG.md) · [更新日志(中文)](./CHANGELOG_ZH.md)

Interface preview: light English on the left and dark Simplified Chinese on the right. Both variants follow the DSH theme and in-app language setting.

<table>

<tr>

<td width="50%"><img src="./docs/images/usage-panel-demo-en-lightv1.0.0.png" alt="Light-theme English usage-panel demo" /><br /><sub>Light theme · English</sub></td>

<td width="50%"><img src="./docs/images/usage-panel-demo-zh-darkv1.0.0.png" alt="Dark-theme Simplified Chinese usage-panel demo" /><br /><sub>Dark theme · 简体中文</sub></td>

</tr>

</table>

Both screenshots use fictional demo data only. They contain no real session content, token counts, costs, balances, or API keys.

The plugin adds a compact indicator below the conversation composer. It shows input/output tokens, cache-hit ratio, estimated cost, active model, a multi-segment context-pressure bar (system/tools/messages breakdown, v1.1.0), and DeepSeek account balance. Click it to open a zero-dependency SVG dashboard with per-turn usage history — including a cost view (every bar shows its own cost value, not just the current round), a duration overlay, anomaly markers, an explainer tooltip (tokens + cost + model + billing tier + duration/TTFT/TPS + user input source attribution: human/agent/continuation, v1.1.0 + end reason), horizontally scrollable per-round bars (all rounds, fixed slim bar width, auto-scroll to latest), a dedicated Context & Compaction Diagnostics section (system/tools/messages token composition, compaction timeline, freed tokens, summarize cost, context occupancy suggestions, v1.1.0), a dismissible ≈ ¥/$0.00xx badge on each assistant message, peak/off-peak tiered billing with a live red/green billing-tier tag in the panel (red = peak, green = off-peak, v1.0.1), and official dual-currency pricing (CNY from the Chinese pricing page, USD from the English pricing page — no FX conversion, v1.0.1).

▸ Input 12.4M · Output 86.2K · Hit 72% · Cost ≈$0.042 / ≈¥0.284 · demo-model · Balance --

Click ▸ to open the dashboard panel:

  • Session usage summary — Input (uncached/cached), output, cache-hit percentage, and context occupancy (derived from official adapter tokenUsage / contextPressure projections).
  • Context breakdown & compaction diagnostics (v1.1.0) — Official contextBreakdown projection breakdown (System prompt / Tools schema / Message history token counts and percentage with a 3-segment color bar, annotated as heuristic approximations); Host folds compaction/* events (which round was compacted, how many tokens were freed, model used, and summarize call cost); provides proactive suggestions (≥75% / ≥90% occupancy) to start a new session or reduce large file injections.
  • Cost estimation — Estimated from official list prices (CNY/USD dual-currency per 1M tokens, peak/off-peak tiers) with verified source date; supports user override via pricing.json; unpriced models are explicitly tagged.
  • Session-cost aggregation (v1.1.7) — Adds the host's per-round costs using each round's model and billing tier. While a new round is in progress, the indicator and panel share the fetched history plus a marked estimate for new tokens, then refresh the history after token updates pause. The model label follows the same current-history/live-node priority in both places.
  • DSH 0.1.2+ and themed docks (v1.1.7) — Reads conversation nodes from the independent chat source on newer DSH versions, with a legacy session-snapshot fallback; keeps the expanded panel anchored when a theme creates a fixed-position containing block.
  • DSH 0.2.x client-SDK compatibility (v1.1.8) — Declares client peer ranges spanning both DSH 0.1.x and 0.2.x (tested against 0.2.1-rc.2) so DSH 0.2.x's plugin admission gate accepts the plugin at startup; the retired @deepseek-ai/dsh-client-runtime peer is gone, and the assistant-node model identity now also reads the 0.2.x providerMetadata field (0.1.x provenance still preferred when present, requestConfig kept as the last fallback).
  • Peak / off-peak tiered billing (v1.0.1) — Peak hours (Beijing time Monday–Friday 09:00–12:00 and 14:00–18:00, UTC 01:00–04:00 and 06:00–10:00) billed at 2× the off-peak rate; all other hours and weekends billed at off-peak rates; rounds bill automatically based on start time (or conservative peak if unknown); live red/green tag in the panel header.
  • Official dual-currency list pricing (v1.0.1) — Builtin official CNY and USD prices directly used according to the active display currency — no FX conversion applied to costs (matching official billing); "Refresh rate" updates only the informational "1 USD ≈ X CNY" reference note.
  • Multi-currency display (v0.3 / v1.0.1) — One-click toggle between USD and CNY (persisted in localStorage); indicator, panel, chart, and badges all follow.
  • Per-round usage & source attribution (v1.1.0) — "Total / Composition / Cost" view modes; cost mode shows each bar's monetary amount; duration line overlay; anomaly marker chips on cost spikes; cache hit miniature ticks; hover explainer card with full round metrics + user input source attribution: human/agent/continuation; horizontal scroll for full session history.
  • Cost badge — Dismissible ≈ ¥/$0.00xx badge rendered at the bottom of each assistant message.
  • Multi-segment context pressure bar (v1.1.0) — Slim bar in th

…(truncated)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::15,最后更新 2026-10-22

Links

GitHub · Homepage · npm

Same category