dsh-api-cost
DSH 实时 API 开销显示插件,根据 provider 报告的 Token 用量与可配置费率,在输入栏上方实时展示当前会话的成本。
AI 分析
核心用途是让用户在对话过程中直观掌控 API 消费情况。适合对 API 资费敏感、需要实时监控单次会话开销的用户。支持在配置文件中自定义各模型费率。
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:CCCq-C/dsh-api-cost说明文档
阅读完整 README ↗Configuration
The plugin ships usable defaults and has no Config schema: override pricing by
setting config on the api-cost row in the profile's cordis.patch.yml
(e.g. $DSH_HOME/profiles/web/cordis.patch.yml):
- id: api-cost
config:
currency: USD
# fallback rates for unknown models (USD per 1M tokens)
rates:
input: 0.27
cacheRead: 0.07
cacheWrite: 0.27
output: 1.1
# per-model overrides (partial objects merge over `rates`)
models:
deepseek-chat:
input: 0.27
cacheRead: 0.07
cacheWrite: 0.27
output: 1.1
deepseek-reasoner:
input: 0.55
cacheRead: 0.14
cacheWrite: 0.55
output: 2.19
deepseek-v4-pro:
input: 0.27
cacheRead: 0.07
cacheWrite: 0.27
output: 1.1
deepseek-v4-flash:
input: 0.14
cacheRead: 0.03
cacheWrite: 0.14
output: 0.55
Billing buckets follow the harness TokenUsage convention (disjoint counts):
DeepSeek's prompt_tokens already includes cache hits, and the official
adapter subtracts cacheReadTokens out of inputTokens, so:
| bucket | meaning | rate |
|---|---|---|
inputTokens | cache-miss input | input |
cacheReadTokens | cache-hit input | cacheRead |
cacheWriteTokens | cache write (not reported by DeepSeek) | cacheWrite |
outputTokens | output | output |
deepseek-v4-pro/deepseek-v4-flashdefaults are placeholders — update them once official pricing is published.