Saikel-Orado-Liu/dsh-cost-meter ↗★ 2
@gamegeek-saikel/dsh-cost-meter
实时估算并展示对话开销与账户余额 适合需要精确监控API调用成本、查看单次回复花费的用户。
安裝
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Saikel-Orado-Liu/dsh-cost-meter說明文件
閱讀完整 README ↗Usage
Once installed, the plugin contributes five browser surfaces (all text shown in Simplified Chinese by default):
| Surface | Slot | Description |
|---|---|---|
| Composer dock readout | conversation.composer.dock | Anchored session spend + account balance, refreshed every minute; hover for the category breakdown and snapshot info |
| Cost view tab | conversation.view | Whole-conversation totals (main + every subagent nesting level), category totals, the per-subagent list with its depth, and the per-reply anchored ledger |
| Per-reply cost chip | conversation.chat.assistant-actions | The anchored cost of one finalized reply as the row's own stat capsule — the same trigger + anchored dialog the shipped 用量 and 用时 capsules use (28px pill, hover fill, aria-expanded dialog above the trigger). It closes the row's stat run: after 用量 and 用时, before the timestamp, spaced by the row's own gap, and coloured by the band that priced it (green off-peak, red peak). The dialog lists the three billed categories, the band with its multiplier, the model, and the snapshot version; the slot hands over the message id, which the sessionCostIndex projection resolves to ledger coordinates (dash — when unpriced) |
| Header pill | conversation.session.header.utilities | Anchored total, or a live ≈ ¥x.xx (estimate) while streaming; click for the detail panel |
| Plugin configuration page | plugins.row.config | The cost-meter row's page under 设置 → 插件 (DSH 0.2.0 hosts a plugin's own configuration there, keyed ` |
#): per-model overrides, OpenRouter aliases, cache-read discount, FX mode, toggles, and manual refresh. The editable fields are the schema's volatile()` ones — the deployment fields (endpoint, credential reference, refresh cadence, trusted hosts, history cap) stay hand-edited in the profile patch, which is exactly the split DSH's configuration projection can write |
The /cost-meter host route serves the balance snapshot, the pricebook view, and the subagent totals over GET, and applies manual refresh over POST ({"action":"refresh"}). Like the /api fence, the route only answers requests whose Host header names a loopback address or a declared trusted host — the DNS-rebinding-safe check.