O
dsh-api-cost
orstedoshua/dsh-api-cost
在 DeepSeek Harness 中基于真实用量统计每个会话的 API 令牌成本,支持每百万令牌自定义价格、币种与语言选择,以及实时汇率。
安装
dsh plugin --profile web add github:orstedoshua/dsh-api-costREADME
dsh-api-cost
Track API token spend in DeepSeek Harness — per chat, in your currency, with live rates.
A DeepSeek Harness plugin that tracks real API token cost from usage data — separately for every chat — with configurable prices, currency & language selectors, and live exchange rates.
Features
- Per-chat cost — listens to session events (
assistant/messagewith provider-reportedusage) and accumulates cost separately for every conversation. - Price freeze on use — each token is billed at the prices in effect when the request happened; changing prices never rewrites already-spent amounts.
- Session-header indicator — shows the current chat's cost next to the context indicator; click to open a quick menu (prices, clear this chat, counting switch).
- Daily spend chart — a 20-day bar chart fills in as you spend, so you can see how much was spent each day.
- Chat names — chats are named like in DSH (with an inline rename option), so you don't stare at UUIDs.
- Flexible prices — set a price per 1M tokens for input, output and cache tokens.
- Language — Russian and English UI (selectable in settings).
- Currency — RUB / USD / EUR / CNY, with values converted at live rates.
- Live rates — exchange rates auto-loaded hourly from a free, open source (
open.er-api.com).
Screenshots

Install
The package is a standard DSH bundle. Add it via the DSH plugin manager or the /plugin-manager command, then:
- Enable the
dsh-api-costplugin. - Open Settings → API Cost: pick language and currency, set prices, save.
Development
# syntax check
node --check lib/client.js
node --check lib/index.js
# tests
cd dsh-api-cost && npm test
State is stored in $DSH_HOME/token-cost-state.json (or ~/.dsh/token-cost-state.json).
License
MIT