Yihong89/dsh-usage-plugin--packages-usage-report ↗★ 2
dsh-usage-plugin
DeepSeek Harness 插件:每个会话的令牌使用量和预估成本报告(/usage 命令 + usage_report 工具 + Web Composer 停靠栏中的实时成本),价格来自 DeepSeek 定价表。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Yihong89/dsh-usage-plugin#c6b4cb340422fca2f18be4f0884c98383683bb8d&path:packages/usage-report说明文档
阅读完整 README ↗dsh-usage-plugin
A DeepSeek Harness plugin that reports the current session's token usage and estimated cost. One host-plane plugin row registers:
- the
usageReportsession-projection unit — folds the provider-reported usage of every model request (uncached input, cache-read, cache-write, output) attributed to the model named by the nearestrequest/header, and prices each sample with the configured price table; - the
/usagehuman command — prints the report as a table; - the
usage_reportmodel tool — returns the same report as canonical JSON, so the agent itself can check budget mid-task.
Costs are estimates, not billing records: they multiply the provider's reported token buckets by the price table below. The token buckets are exact provider numbers; the prices are configuration.
Install
Requirements: a DSH profile with the tools, commands, and
sessionProjections services (the web and headless profiles provide all
three via dsh-base).
# 1. make the plugin available to your profile (installs from this GitHub repo)
dsh plugin --profile web add -w 'github:Yihong89/dsh-usage-plugin#main&path:packages/usage-report'
# 2. activate it in the profile's patch layer
# add to ~/.dsh/profiles/web/cordis.patch.yml:
#
# - insert:
# - id: usage-report
# name: 'dsh-usage-plugin'
# 3. restart the profile (e.g. restart the `dsh web` process)
The package commits its built lib/, so the install needs no build-script
permission. A profile patch is a pnpm workspace root, hence the -w flag.
Usage
/usage (human)
Type /usage in a chat. Example output:
Session usage report
model uncached-input cache-read cache-write output requests est. cost
deepseek-v4-flash 1,234 5,678 12 8,901 14 $0.012345
Total 1,234 5,678 12 8,901 14 $0.012345
usage_report (model tool)
The model can call it mid-task ("how much have we spent?") and receives the same numbers as canonical JSON: