dsh-token-gist
IdentifiedTracks cumulative input, output, cache-read and cache-write token totals independently of conversation deletion, with a sidebar card, daily breakdown, /token-usage command, and optional Gist backup.
Token Usage Statistics · token用量统计
A DeepSeek Harness (DSH) plugin that keeps a cumulative token usage total and syncs it to a GitHub gist. The total lives in its own file and is folded from newly committed session events, so it is not derived from session logs — deleting, archiving, or compacting a conversation never reduces the total.
What it does
- Cumulative totals across every conversation (including subagents), counted from provider-reported usage: input, output, cache-read, and cache-write tokens.
- Survives conversation deletion — the running total is independent of the session log. Only new model attempts are added, so a restored session is never double-counted.
- Gist backup — the total (plus a per-day breakdown) is pushed to a private GitHub gist. Auto-sync on an interval and one-click manual sync.
- Sidebar card — shows the running total and the last sync status, with a "sync" button.
- Slash command —
/token-usageprints the totals;/token-usage syncpushes to gist immediately. - Local persistence — state is written atomically to
$DSH_HOME/dsh-token-gist/state.json.
Install
From a local directory (this checkout):
plugin_manager action: install_bundle target: <absolute path to this directory>
Configure
Configure in Settings → Plugins (the plugin's own page), or edit cordis.patch.yml:
| Field | Default | Meaning |
|---|---|---|
gistToken | — | GitHub personal access token with gist write scope. A fine-grained PAT limited to "Gists → read and write" is recommended. |
gistId | — | Existing gist id to update. Empty = create a new gist on the first sync. |
gistFilename | dsh-token-usage.json | Filename inside the gist. |
autoSync | true | Sync to gist automatically on an interval. |
syncIntervalMinutes | 30 | Auto-sync interval (1–1440). |
description | DSH token usage total | Gist description. |
You can also set the token through the environment variable DSH_TOKEN_GIST_TOKEN.
Notes and limits
- Counting starts when the plugin is installed. Token usage from before installation is not back-filled (session history is not replayed into the counter).
- The total uses provider-reported usage. When a provider reports none, that attempt contributes zero (matching DSH's own token-meter).
- The gist stores totals and a per-day breakdown only — it never uploads conversation content.
- The token is stored in your local profile config. Use a narrowly-scoped, revocable token.
License
MIT
Comments
Loading…
Similar plugins
Adds a dedicated Token usage page to DSH with live per-session input, output, cache read, cache write and total counts, cache hit rate, a 14-day history strip, search and sortable columns; usage is re
★ 1
MIT
JavaScript
dsh plugin --profile web add dsh-token-usageby shi-YangYang
一款 DeepSeek Harness Token 用量统计与可视化插件,支持跨会话用量汇总、实时统计、历史趋势分析及模型级 Token 消耗追踪。
★ 0
MIT
TypeScript
Nov 10, 2026
dsh plugin --profile web add @shi-yangyang/dsh-token-dashboardby kx121
到点叫醒 DSH 会话,翻你关注的 GitHub 仓库和主题,挑出值得跟的变化,写日报、记判重表。只读。
★ 2
MIT
JavaScript
Oct 23, 2026
dsh plugin --profile web add dsh-github-digestby l956615272-hub
统计本机全部 DSH 会话的历史 token 总消耗,按 message.id 去重,支持按天/模型/Provider/项目分组。
★ 1
↓ 231/wk
MIT
JavaScript
Oct 26, 2026
dsh plugin --profile web add dsh-token-usageRealtime token badges beside the deep-thinking indicator — merged or split in/out, auto K/M/G/T units, per-step operation counts
★ 1
MIT
JavaScript
dsh plugin --profile web add dsh-where-did-my-tokens-goby iuuuuuuuu
DSH plugin: per-day token usage and time-to-first-token statistics, broken down by workspace and session. Reads local session logs only.
★ 0
MIT
JavaScript
Sep 16, 2026
dsh plugin --profile web add dsh-usage-stats