CCCq-C/dsh-api-cost0

dsh-api-cost

DeepSeek Harness 插件:实时显示本会话 API 用量开销,按 provider token 用量 × 可配置费率计价,输入栏上方成本条。Real-time per-session API cost meter for DeepSeek Harness: prices provider-reported token usage with configurable rates and shows a live cost chip above the composer.

AI 分析

核心用途是让用户在对话过程中直观掌控 API 消费情况。适合对 API 资费敏感、需要实时监控单次会话开销的用户。支持在配置文件中自定义各模型费率。

パッケージ
dsh-api-cost
バージョン
0.1.0
ライセンス
MIT
最終更新
2026/08/15

インストール

$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:

bucketmeaningrate
inputTokenscache-miss inputinput
cacheReadTokenscache-hit inputcacheRead
cacheWriteTokenscache write (not reported by DeepSeek)cacheWrite
outputTokensoutputoutput

deepseek-v4-pro / deepseek-v4-flash defaults are placeholders — update them once official pricing is published.