插件目录 / Developer / dsh-ocg-billing
dsh-ocg-billing
已验证 · 实测可装 hiro-nikaitou
功能简介
DeepSeek Harness插件:OpenCode Go计费层,缓存官方定价、主动更新检查、账单计算与剩余额度
可用 — 实测通过,早期项目
DeepSeek Harness插件:OpenCode Go计费层,缓存官方定价、主动更新检查、账单计算与剩余额度 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-ocg-billing
锟斤拷锟斤拷 | English
OpenCode Go billing layer for DeepSeek Harness (dsh).
This plugin adds a billing layer on top of dsh's existing usage tracking (per-session TokenUsage recorded in session logs). It fetches the official OpenCode Go pricing docs once, caches the price table to disk, and re-checks it proactively 锟斤拷 billing always runs against the cache, never against a live fetch. It also calls the default model to analyze the bill, and shows a resident bill line under the web composer.
This is a community plugin, not affiliated with DeepSeek AI or OpenCode. Prices are estimates computed from the official docs; actual charges come from your OpenCode Go subscription statement.
Features
- Resident bill line (web UI) 锟斤拷 under the composer card (conversation.composer.dock): global 7-day cost, monthly limit progress, current-session cost, top models, price-source freshness. Auto-refreshes every 60s; click to refresh instantly.
- Cached official pricing 锟斤拷 ocg_pricing_check re-fetches opencode.ai/docs/go, diffs against the cache, and updates the cache only when the table changed (force: true forces a refresh). A 24h background check runs automatically. Billing never re-queries the website.
- Bill computation 锟斤拷 ocg_bill: global (all sessions in the last N days) or per-session (scope=session + sessionId), broken down by model and by session. Uses the official per-1M-token rates including Cached Read / Cached Write, and tiered rates (GPT 5.6 Luna 272K, Qwen3.7/3.6 Plus 256K). Unknown models are listed at zero cost.
- Default-model analysis 锟斤拷 ocg_bill_analyze computes the bill and asks the default model (the agent-default-model selection, e.g. opencode-go/deepseek-v4-flash) for a summary, anomalies, top cost drivers, and saving recommendations.
Install
Prerelease note: DeepSeek Harness is in developer preview; peer ranges follow the installed 0.1.0-rc.6 mainline.
# from a profile
dsh plugin --profile web add <path-to-this-repo> # or link:/absolute/path
# or overlay-style in ~/.dsh/config.yaml
# - insert:
# - id: ocg-billing
# name: '@hiro-nikaitou/dsh-ocg-billing'
Restart dsh web. The bill line appears under the composer once the plugin loads (browser half activates after approval).
Tools (model-visible)
| Tool | Purpose |
|---|---|
| ocg_pricing_status | Cached price table, source, fetch time, cache health. Never fetches. |
| ocg_pricing_check | Proactively re-fetch the official docs and diff against the cache; updates only on change (or force). |
| ocg_bill | Bill computation: global or per-session, by model and by session. |
| ocg_bill_analyze | Bill + default-model analysis (summary, anomalies, savings). |
How it works
- Price cache: D:\appdata\dsh\ocg-billing\pricing.json (first run seeds from the built-in snapshot of the official docs; seed flag in status). Model list: 20 docs models + extra seed entries for models configured but not listed in the docs (source tagged models.dev/unknown).
- Usage source: relies on dsh's existing usage records 锟斤拷 request/header + assistant/message events in each session log (the same data live-stats reads). Global scope aggregates sessions created within the window; session scope prices one sessionId.
- Fetch channel: ctx.subprocess + curl.exe (the bash/shell seam is unavailable on Windows); falls back to ctx.shell elsewhere.
- RPC: client polls GET /api/ocg-billing/panel?sessionId=... (registered via ctx.webServer); the host caches the global aggregation for 5 minutes.
Pricing rules
- cacheRead billed at the official cache-read rate (fallback: input rate); cacheWrite at the official rate (fallback: output rate).
- Tiered models pick the tier by per-request input tokens.
- Unknown models are priced at 0 and reported in unknownModels.
- Subscription fee ($10/month) is shown as reference, not added to usage cost.
License
Disclaimer
Prices are parsed from the official docs page and may lag or mis-parse after upstream layout changes 锟斤拷 run ocg_pricing_check to refresh. This plugin is not affiliated with DeepSeek AI or OpenCode.
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-ocg-billing」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:hiro-nikaitou/dsh-ocg-billing Headless(CLI)profile:
dsh plugin --profile headless add github:hiro-nikaitou/dsh-ocg-billing 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
扩展 agent 的编码能力面——给它一个新工具、工作流或集成,让它接手以前做不了的开发任务。
适合谁
想让 dsh 在真实代码库上像队友一样干活的开发者——能改、能跑、能验证,而不只是回答问题。
二次开发建议
工具/命令面就是缝:暴露更多 SDK 能力、加更聪明的上下文接线,或收紧改代码与验证之间的循环。