dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
Live per-session cost badge for DeepSeek Harness (top-right), with peak/off-peak (time-of-day) pricing.
A DeepSeek Harness plugin that puts a live cost badge in the conversation header (top-right) and prices every request with peak / off-peak (time-of-day) tiers.
┌──────────────────────────────────────────────────────────────┐
│ Session title [¥0.0042] │ ← badge here
├──────────────────────────────────────────────────────────────┤
│ … conversation … │
└──────────────────────────────────────────────────────────────┘
catalog/prices.json and every installed copy picks it up without a plugin release; a failed refresh keeps the last good rates.cacheMiss + cacheMissOffPeak), not just a multiplier.provider/model, provider/*, *-model wildcards, and case/space/punctuation-insensitive model ids.未配置 (unpriced) instead of a made-up fallback rate.dsh plugin --profile web add dsh-plugin-cost-meter
The package declares dsh.bundle, so dsh plugin add activates it as a profile layer automatically — no manual cordis.patch.yml row is required.
dsh plugin --profile web add "link:E:/path/to/dsh-plugin-cost-meter"
link: keeps the checkout live, so edits apply after a dsh web restart without reinstalling.
Restart the server afterwards:
dsh web
The bundled cordis.patch.yml inserts the plugin row with defaults. Override it by adding a cost-meter row with the same id in your profile's cordis.patch.yml (~/.dsh/profiles/web/cordis.patch.yml):
- insert:
- id: cost-meter
name: dsh-plugin-cost-meter
config:
currency: CNY # display currency; empty = catalog currency
fx:
cnyPerUsd: 7.1 # used when the catalog is USD and you display CNY
catalogUrl: "" # "" = this package's own catalog (derived from repository)
refreshMinutes: 360 # silent refresh interval; 0 disables it
pricingTimeoutMs: 4000
pricingUrl: "" # optional legacy { models, default } document
models: # manual overrides (highest priority, display currency)
deepseek-official/deepseek-flash:
inputPerM: 1.06 # off-peak base
cacheReadPerM: 0.021
cacheWritePerM: 1.06
outputPerM: 4.26
default: # optional fallback; omit to report unknown routes as unpriced
inputPerM: 1
outputPerM: 4
peak:
enabled: true
multiplier: 2 # used only when a rate has no explicit off-peak value
timezoneOffsetMinutes: 480 # UTC+8
days: [1, 2, 3, 4, 5] # ISO weekdays; weekends are off-peak
windows: [[9, 12], [14, 18]]
Two rate styles are accepted everywhere:
cacheMiss, cacheHit, cacheWrite, output, and cacheMissOffPeak, cacheHitOffPeak, cacheWriteOffPeak, outputOffPeak.inputPerM, cacheReadPerM, cacheWritePerM, outputPerM (with optional *Peak fields).Prices resolve in this order (highest wins):
config.models / config.defaultconfig.pricingUrl (legacy document)config.catalogUrl — default: this package's own catalog/prices.json on GitHub, derived from package.json.repositorycatalog/prices.json (offline fallback)A timer re-reads the remote catalog and pricingUrl every refreshMinutes (default 6 hours) and swaps the live table in place:
This makes the catalog the single place to maintain rates: edit and push catalog/prices.json, and installed copies update themselves — no new plugin release. Forks get their own update channel automatically because the default URL is derived from package.json.repository.
To point at a private mirror or a local file, set catalogUrl (https://…, a path, or file:///…). Set it to "" to disable remote syncing.
event.time, never "now".days, default Monday–Friday); weekends are off-peak all day.peakSchedule (time zone, days, windows, off-peak ratio) and can be overridden field by field in config.peak.peak.enabled: false bills one flat rate; peak.timezoneOffsetMinutes shifts the wall clock for the window check.The hover tooltip shows the current tier, the multiplier, the route, and the token breakdown.
cost = Σ_routes [ cost_off(route) + cost_peak(route) ]
cost_tier(route) = (uncachedInput × miss
+ cacheRead × hit
+ cacheWrite × write
+ output × out) / 1_000_000
Totals are accumulated per { provider, model } route and per tier, so switching models mid-session keeps each route on its own price. A repeated usage sample for the same (turn, step) replaces the earlier one instead of double-counting.
| Surface | DSH ≤ 0.1.0-rc.6 | DSH ≥ 0.1.5 |
|---|---|---|
| Projection contract | schema + view | stateSchema + wire: { viewSchema, view } |
| Client deps | @deepseek-ai/dsh-client-runtime | @deepseek-ai/dsh-client-ui-renderer, @deepseek-ai/dsh-client-ui-session |
| Compatibility gate | — | engines.dsh / peerDependencies must satisfy the running version |
The badge uses the additive conversation.session.header.utilities slot; …header.corner is a single slot already occupied by a shipped plugin.
npm install
npm test
test/contract.test.mjs covers the projection contract, weekday peak, catalog parsing, explicit dual rates, currency conversion, normalization/wildcards, unpriced routes, and manual overrides. It runs offline (catalogUrl: "").
usage and on the price table.catalog/prices.json when rates change.sessionProjections (e.g. headless) skip registration.