Bundle
dsh-opencode-go-usage
OpenCode Go 订阅用量小部件:滚动/周/月用量百分比与重置倒计时,右下偏中悬浮显示(服务端代理 opencode.ai/zen/go/v1/usage + 浏览器小部件,key 不落浏览器)
- Source
- kkishapppy
- stars
- 1 stars
- License
- MIT
- Updated
- Updated yesterday
Readme
# dsh-opencode-go-usage
OpenCode Go 订阅用量悬浮小部件:在 DSH Web GUI 右下角实时显示**滚动/周/月用量百分比与重置倒计时**。
## 功能
- 右下角悬浮胶囊:`ⓖ 滚动 0% · 周 2% (2天13时) · 月 1% (30天18时)`
- 每 60 秒自动刷新 + 窗口切回前台即刷新
- 样式跟随 DSH 主题(`--dsw-alias-*` token,深浅主题/皮肤自动适配)
- API key **只存在服务端**(经 dsh 凭据服务解析),不落浏览器
## 原理
- 服务端代理 `GET https://opencode.ai/zen/go/v1/usage`(Bearer sk-,OpenAI 兼容端点实测 200)→ 暴露为 `/plugins/dsh-opencode-go-usage/usage`(60s 缓存)
- 浏览器 half 挂 `document.body` 顶层(`position: fixed` 不受容器 transform/backdrop-filter 影响)
## 安装
```bash
dsh plugin --profile web add dsh-opencode-go-usage
```
配置(`profiles/<profile>/cordis.patch.yml`):
```yaml
- id: opencode-go-usage
config:
apiKeyEnv: OPENCODE_GO_API_KEY # 凭据名(默认 OPENCODE_GO_API_KEY)
cacheMs: 60000 # 服务端代理缓存毫秒
```
key 通过 dsh 凭据服务解析(`.credentials.yaml` 或 GUI Models 页配置),与 `llm-pi-ai` 同源。
## 开发
```bash
npm i
npx -y tsdown@0.22.2 --config ./tsdown.config.ts
# 服务端改动需重启 DSH;client 改动硬刷新页面即生效
```
## License
MIT
Install
dsh plugin --profile web add github:kkishapppy/dsh-opencode-go-usage
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-opencode-go-usage from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.