opencode-usage
其他 活跃维护

opencode-usage

AmaTsumeAkira/opencode-usage

bundle下的轻量插件,可自动同步OpenCode Go订阅剩余额度,生成可视化状态徽章,支持直接嵌入dsh管理页面,无需复杂配置,运行无额外资源占用,实时查看额度状态更便捷。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
70 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:AmaTsumeAkira/opencode-usage
git clone https://github.com/AmaTsumeAkira/opencode-usage.git
git clone git@github.com:AmaTsumeAkira/opencode-usage.git
README.md main

opencode-usage

English | 中文

OpenCode Go quota badge plugin (bundle) — shows rolling / weekly / monthly quota usage and reset times for OpenCode Go right in the dsh Web UI.

Screenshot

OpenCode Go quota badge in the composer dock

OpenCode Go quota badge in the composer dock

Features

  • Renders the three quota windows (rolling / weekly / monthly) as colored percentages (green → amber → red by usage) with reset countdowns in the composer dock
  • Shows the last fetch time ("updated M/D HH:mm"), switching to "updating…" while a refresh is in flight
  • Click the "OpenCode Go" label to refresh the quota manually
  • Auto-refreshes every 5 minutes
  • The API key lives only inside the harness process: resolved per request through the credentials service, passed to curl via an environment variable, never serialized to the browser or logs

Install

This package follows the official dsh bundle format: it ships prebuilt artifacts (lib/ is committed to the repo) and has no install scripts, so a git install needs no pnpm allowBuilds grant.

dsh plugin --profile web add github:AmaTsumeAkira/opencode-usage

Or install from a local directory:

dsh plugin --profile web add ./opencode-usage

Uninstall:

dsh plugin --profile web remove opencode-usage

Credentials

The plugin reads OPENCODE_GO_API_KEY through the official credentials service (either the environment or ~/.dsh/.credentials.yaml):

# ~/.dsh/.credentials.yaml
OPENCODE_GO_API_KEY: your-opencode-go-api-key

Without a configured key the badge shows "获取失败" (fetch failed).

Layout

opencode-usage/
├── package.json       # dsh.bundle + dsh.client(web) manifest
├── cordis.patch.yml   # plugin row insertion layer
├── lib/index.js       # host half: /opencode-usage route (ESM, zero deps)
└── lib/client.js      # browser half: composer-dock badge (__ModuleLoader__ format)

License

MIT