Way2LOose4/dsh-agent-pricing
DeepSeek Harness 的实时会话成本预览:实时成本读数、今日使用图表、price_estimate/session_cost 工具,价格与 DeepSeek 官网保持同步(支持高峰/非高峰时段)
项目介绍Project Overview
dsh-agent-pricing 是 DeepSeek Harness 的实时会话费用预览插件。核心能力:在编写器下方显示累计费用、刷新今日用量叠加图,并提供 price_estimate 与 session_cost 工具供智能体引用,价格与官方页面对齐,识别峰/谷时段计费。适用场景:需监控 token 消耗、预估单次调用或会话花费、并向智能体报告费用进度的用户。注意事项:所有数字为基于公开价目表的估算,不反映账户协商价或余额;DeepSeek 行每 30 分钟重新拉取官方页面,其他厂商需编辑仓库内 prices.json 同步。
dsh-agent-pricing is a DeepSeek Harness plugin that delivers real-time session cost previews. Core capability: a live cost readout under the composer refreshing every five seconds, a today-usage overlay with hourly charts, and price_estimate plus session_cost agent tools — all aligned with the official pricing page, including peak/off-peak tier detection. Use it when monitoring token burn, quoting costs mid-task, or letting an agent report its own spend. Caveat: figures are estimates derived from the public price table, not negotiated rates or account balance, and pricing syncs every 30 minutes from the official docs.
请帮我了解并安装插件:【dsh-agent-pricing】【https://github.com/Way2LOose4/dsh-agent-pricing】
把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.
或使用命令行安装(适合开发者)Or use CLI install (for developers)
命令行安装CLI Install
dsh plugin --profile web add github:Way2LOose4/dsh-agent-pricing
把 Way2LOose4/dsh-agent-pricing 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-agent-pricing
Real-time session cost preview for DeepSeek Harness: a live cost readout under the composer, a today-usage overlay chart, and
price_estimate/session_costagent tools — with prices kept in sync with the DeepSeek official pricing page (peak / off-peak aware).
Features
- Live cost readout under the composer — the current session's accumulated cost, refreshed every 5 seconds, CNY ⇄ USD toggle. This is your approximate balance-consumption preview while you work.
- Today overlay — today's input/output/cache tokens, an hourly usage bar chart, and a per-model breakdown. The overlay also shows which price source produced the numbers, when the table was last verified, and — after peak/off-peak billing takes effect — whether the peak or off-peak tier applies right now.
- Agent tools —
price_estimate(per-call estimate) andsession_cost(full-session usage read from the same source as the Web stats strip), so your agent can quote its own burn rate mid-task. - Prices always aligned with the official site — on activation and every 30 minutes, the plugin scrapes the official DeepSeek pricing page: current rates plus announced peak/off-peak tiers with their effective date. Any failure degrades gracefully through the fallback chain; a network outage never breaks estimation.
workspace agent-pricing.json (1) your override — wins over everything
↓ absent
official pricing page scrape (2) DeepSeek rows, incl. announced peak/off-peak tiers
↓ down / HTML changed
this repo's prices.json (3) edit it on GitHub → every install re-aligns,
↓ down no reinstall needed
built-in table (4) offline fallback — ships with announced tiers
DeepSeek peak/off-peak billing (announced effective 16:00 UTC 2026-08-16, peak hours 01:00–04:00 & 06:00–10:00 UTC) is computed per usage event at its own timestamp: calls made before the switch stay at flat rates, peak-hour calls bill at peak rates automatically.
Installation
Requirements: DeepSeek Harness (Web profile), 0.1.0-rc.6 verified.
A. DSH plugin marketplace (recommended)
- Install dsh-plugin-marketplace if you don't have it yet (repo & one-line installer).
- Open Settings → DSH插件市场, search
dsh-agent-pricing, click 安装 / Install. - Restart DSH (relaunch
dsh web) and refresh the page.
B. dsh CLI (pnpm handles the GitHub URL)
dsh plugin --profile web add github:Way2LOose4/dsh-agent-pricing
# then restart the Web profile.
C. Manual
Clone into %DSH_HOME%/profiles/web/node_modules/dsh-agent-pricing and append to %DSH_HOME%/profiles/web/cordis.patch.yml:
- insert:
- id: agent-pricing
name: dsh-agent-pricing
Restart DSH. The Web profile's HMR is disabled — code changes only take effect on restart.
Usage
- Open any conversation — a compact cost line appears under the composer.
- Click CNY/USD to switch currency, click ▸ 图表 to open the today overlay.
- Ask your agent "how much have we spent?" — it can answer itself with
session_cost, and quote before-the-fact numbers withprice_estimate.
Configuration (optional)
Drop an agent-pricing.json into your workspace root to fully override the price table — same shape as prices.json in this repo:
{ "models": [{ "keys": ["my-model"], "label": "My Model", "input": 1.0, "output": 2.0 }] }
Optional per-row fields: cacheRead, cacheWrite, and tiers ({ "effectiveAt", "peakHoursUtc", "peak": {...}, "offPeak": {...} }). The file is re-read on activation and on every periodic refresh. Models that match no row cost 0 and are listed in the result's note.
HTTP endpoints & tools
| Endpoint | Method | Description |
|---|---|---|
/api/pricing/session-cost?sessionId=…¤cy=CNY |
GET | Full-session usage + cost |
/api/pricing/today?currency=CNY |
GET | Today's tokens/cost + hourly series + price source |
/api/pricing/estimate?model=…&input_tokens=…&output_tokens=… |
GET | Single-call estimate |
/api/pricing/debug |
GET | Price-source layers, sync state, tier rows |
/api/pricing/reload |
ANY | Force a price-table refresh |
Model tools registered: price_estimate, session_cost.
Keeping prices current
DeepSeek rows re-align automatically from the official page. For other vendors, update prices.json: every installation refetches it every 30 minutes. A workspace-level agent-pricing.json still wins when present.
Repo layout
├─ package.json bundle manifest (dsh.client + dsh.bundle.patch)
├─ cordis.patch.yml profile mount row
├─ prices.json repo-hosted price table (auto-fetched by installs)
├─ lib/
│ ├─ index.js host: routes, tools, price layers, official-page parser
│ └─ client.js browser: cost readout + today overlay
├─ test.mjs official-page parser + pricing math (peak/off-peak, CNY/USD)
└─ test-refresh.mjs price-layer precedence: file > official > repo > builtin
Run the tests against a saved copy of the official pricing page:
node test.mjs official-pricing.html
node test-refresh.mjs official-pricing.html
Limitations & security notes
- All figures are estimates: they mirror the official public price table, not your account's negotiated rates or remaining balance. DeepSeek exposes a real
/user/balanceendpoint; this plugin deliberately stays read-only on public data and needs no API key. - Cost history is computed from your local session logs; nothing leaves your machine except the price-table requests to the official docs page and this repo's raw
prices.json. - Only install plugins you trust — a plugin package is registered into the Web profile and loads with every DSH start.
Compatibility
| DSH version | Status |
|---|---|
| 0.1.0-rc.6 | ✅ verified |
License
MIT — see LICENSE.
wssfk12138/dsh-damage-pulse
OK-wx/dsh-ocgo-lite
1514100951/dsh-usage-footer
Andrew111888/dsh-plugin-balance
JavenLu233/dsh-cost-monitor
1841220388zzzcccxxx-star/dsh-token-stats
AlexPeng07/dsh-custom-plugin