bowenliang123/dsh-context
bowenliang123/dsh-contextDSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
在 DSH Web 侧边栏按项目展示 LLM Token 用量与人民币花费,分别统计输入(未命中)、命中与输出,并按模型标准价格自动计价。
A DSH plugin that shows per-project LLM token usage and converts tokens to RMB cost, split into:
cacheReadTokens)Costs are calculated from the model's standard price table (CNY per 1M tokens). Unknown models are listed with their token counts but no cost, so you can add/override prices without touching code.
~/.dsh/sessions or $DSH_HOME/sessions).cwd) and by model.node:zlib Zstandard decoder./dsh-token-cost/*).Install the subdirectory dsh-token-cost, not the parent dsh plugin folder. The parent folder has no package.json, so installing it produces no sidebar button.
Use the absolute path (the path contains a space, so quote it):
dsh plugin --profile web add "file:/Users/dg/Documents/dsh plugin/dsh-token-cost"
Or, from inside this directory:
cd /Users/dg/Documents/dsh plugin/dsh-token-cost
dsh plugin --profile web add "file:$PWD"
If you previously installed the wrong folder, remove it first:
dsh plugin --profile web remove "dsh plugin"
dsh plugin --profile web add "file:/Users/dg/Documents/dsh plugin/dsh-token-cost"
Then restart dsh web and refresh the browser. A 💰 button appears at the bottom of the sidebar.
You can also use the included installer script:
./scripts/install.sh
The host plugin scans every session.jsonl.zstd / session.jsonl under the DSH sessions directory. It replays:
session.cwd → projectrequest/header → current modelassistant/chunk { type: 'usage' } and assistant/message.usage → input / cache-hit / output tokensThe same (turn, step) usage sample is de-duplicated (a later assistant/message replaces the earlier usage chunk), matching DSH's own token-meter accounting.
Built-in DeepSeek official RMB prices (元 / 1M tokens):
| Model | Input (miss) | Cache hit | Output |
|---|---|---|---|
deepseek-chat / deepseek-v4-flash | 2 | 0.5 | 8 |
deepseek-reasoner / deepseek-v4-pro | 4 | 1 | 16 |
You can override prices in the profile's cordis.patch.yml (a patch row replaces the whole config, so include every price you want to keep):
- id: token-cost
config:
prices:
deepseek-chat:
input: 2
hit: 0.5
output: 8
deepseek-reasoner:
input: 4
hit: 1
output: 16
deepseek-v4-flash:
input: 2
hit: 0.5
output: 8
deepseek-v4-pro:
input: 4
hit: 1
output: 16
GET /dsh-token-cost/api/stats — full per-project/per-model JSONGET /dsh-token-cost/api/prices — active price tableGET /dsh-token-cost/healthz — livenessMIT