ziangl59/dsh-opencode-go-meter ↗★ 0
dsh-opencode-go-meter
DeepSeek Harness plugin: OpenCode Go plan quota (5h rolling / weekly / monthly) and per-API-key token usage in the settings sidebar
AI 분석
核心用途是监控和展示 OpenCode Go 服务的 API 额度消耗和 Token 使用统计。适合使用 OpenCode 渠道并需要防止额度超支的用户。
설치
검증된 bundle이 없거나 호환성 검사에 실패했습니다. 먼저 저장소 설명을 읽어 주세요. 전체 README 읽기 ↗
配置项
在 cordis.patch.yml 的插件条目下通过 config 字段配置,完整参数如下:
- insert:
- id: opencode-go-meter
name: 'dsh-opencode-go-meter'
config:
baseUrl: https://opencode.ai/zen/go/v1/usage
timeoutMs: 8000
quotaCacheMs: 60000
recordsSyncMs: 60000
autoSyncMs: 300000 # 后台自动同步间隔(毫秒),设为 0 关闭
fullSyncMaxPages: 1000 # 全量回填最大页数(每页 50 条)
fullSyncMaxMs: 900000 # 单次全量回填总时长上限(毫秒),超时中止、下次续跑,0 为不限制
syncAwaitMs: 8000 # overview/refresh 接口等待同步完成的最长时间,超时则先返回已有数据
snapshotMaxAgeMs: 300000 # 本地快照有效期(毫秒);有效期内打开页面直接读快照,不发网络请求,0 表示始终使用快照
apiKey: '' # 也可通过凭据 OPENCODE_GO_API_KEY 或 opencode auth.json 读取
authCookie: '' # 也可通过凭据 OPENCODE_GO_AUTH_COOKIE 或页面内粘贴录入
workspaceId: '' # 留空则自动解析第一个工作区
providerFilter: opencode # 本地归因仅统计 provider 路由包含该字符串的调用
alertThreshold: 80 # 告警阈值(百分比)
retentionDays: 90 # 本地数据留存天数
keyLabels: {} # 可选:keyID 到显示名的映射,优先级最高,例如 { key_xxx: "我的主力 Key" };也会自动读取 opencode-go-multi-auth 的账号配置
planLimits: {} # 可选:按套餐自定义额度展示,例如 { lite: { rolling: "$12", weekly: "$30", monthly: "$60" } }
凭据解析优先级
表格
| 凭据类型 | 解析顺序 |
|---|---|
| API Key(配额查询用) | config.apiKey → 凭据项 OPENCODE_GO_API_KEY → ~/.local/share/opencode/auth.json |
| auth cookie(明细查询用) | config.authCookie → 凭据项 OPENCODE_GO_AUTH_COOKIE → 页面内保存的 $DSH_HOME/plugins/opencode-go-meter/cookie.txt |