dsh-opencode-usage
Manifest validAdds an OpenCode Go usage page to dsh Settings with per-model 5-hour, weekly, and monthly spend and remaining allowance.
OpenCode Go 用量(设置页 + 数据接口)
按模型统计 OpenCode Go 套餐的用量与剩余额度。一个 bundle 同时提供两半:
- 客户端:设置 → 「OpenCode 用量」页面(
settings.section槽位),60 秒自动刷新,右上角「立即刷新」。 - Host:
GET /opencode-usage.json(设置页的数据源;?refresh=1会先强制拉一次官方额度快照)。
网页版已按需求移除,只保留数据接口。
数据来源
OpenCode 官方 /inference/go/v1/usage 只返回一组四舍五入的 rolling/weekly/monthly 百分比,
不区分模型;而套餐实际是按模型各自计额度(5 小时 = 月额度 20%、周 = 50%、月 = 100%)。
所以按模型的数据由本插件自己算:
- 启动时回扫
$DSH_HOME/sessions下近 40 天的会话日志,取每条assistant/message的usage与message.source(时间用事件自带的time)。 - 之后实时监听
session/event,同一套 reducer 折进内存记录。 - 金额按内置价格表(离峰/标准价)估算,DeepSeek 模型峰时(UTC 周一至周五 01–04、06–10)乘 2; 免费模型价格为 0。
- 窗口起点优先用官方
resetsAt反推,monthly 用 UTC 月初。
套餐适配
cordis.patch.yml 的 plan 决定各模型的月额度表:go(默认)/ go-plus / go-teams。
升级后只有额度差 ≥1.5× 的明确变化(如 go → go-plus)会被官方百分比自动识别;
Go $100 与 Go Teams $105 只差 5%,在估算噪声内,以配置为准。
局限
- 只统计这个 harness 发出的调用;OpenCode 官方客户端等其它工具不计入。
- 金额是估算;官方百分比只有一行,无法按模型拆分,页面把它原样展示作为交叉核对。
- 数据接口只监听回环地址;插件路由本身不做鉴权。
Comments
Loading…
From the same category
DeepSeek Harness plugin for Reactive Resume: bridges your resumes and job applications into a Harness session over MCP.
★ 41.7k
↓ 215/wk
MIT
Aug 24, 2026
dsh plugin --profile web add dsh-plugin-reactive-resumeby dsh-market
The plugin market inside DeepSeek Harness — browse, search, one-click install · DSH 可视化插件市场
★ 10.1k
↓ 361.7k/wk
MIT
TypeScript
Nov 1, 2026
dsh plugin --profile web add dshmarketby Tencent
Let AI agents use your real, logged-in browser without interrupting your work. CLI + extension for browser automation across any shell-capable AI agent.
★ 9.9k
↓ 12.3k/wk
MIT
TypeScript
Nov 1, 2026
dsh plugin --profile terminal add @wxg-prc-cpg/browser-skill-dsh-pluginby yjh051108
dsh-routing-suite — injector + router-standard kit: install the runtime injector first, then the task-aware reasoning-mode router preset (measured P1-P23).
★ 7k
MIT
JavaScript
Sep 18, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby superdesigndev
OpenRouter for agent tools. Join community here: https://discord.gg/6mQYYfFMAn
★ 7k
NOASSERTION
Python
Nov 1, 2026
dsh plugin --profile web add treg-dshby Q00
Agent OS: the agent gets smarter on its own. We just hold the line: Interview-gated, staged evaluation, budgeted evolution loop. MCP server, 14 runtimes: Claude Code, Codex CLI, Gemini CLI, OpenCode,
★ 6.3k
MIT
Python
Nov 1, 2026