Pi Subs banner
wonton1984 wonton1984

Pi Subs

AI community

Description

Subscription usage panel for pi coding agent: OpenCode Go, Kimi, Codex, Command Code, Claude, Copilot, Z.AI, OpenRouter — statusline + widget in pi Web/TUI

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

⌁ pi-subs — 订阅用量面板(pi coding agent)

在 [pi coding agent](https://github.com/earendil-works/pi) 的 **pi Web** 与 TUI 中,聚合显示你的各个订阅的实时用量。

支持的订阅:

订阅 数据源 认证方式
OpenCode Go / Zen opencode.ai/zen/go/v1/usage pi 内 /login 或 API key
Kimi For Coding api.kimi.com/coding/v1/usages pi 内 /login 或 API key
OpenAI Codex chatgpt.com/backend-api/wham/usage pi 内 /login(OAuth 自动刷新)
Command Code api.commandcode.ai/alpha/* pi 内 /login
Claude Pro / Max api.anthropic.com/api/oauth/usage pi 内 /login(OAuth)
GitHub Copilot api.github.com/copilot_internal/user pi 内 /login(OAuth)
Z.AI / GLM Coding Plan {baseUrl}/api/monitor/usage/quota/limit pi 内 /login
OpenRouter openrouter.ai/api/v1/key API key

**未登录的订阅自动隐藏**,只显示你实际在用的。

界面

  • 状态栏(底部一行):显示全部已登录订阅,当前会话所用订阅带 高亮; 配置为 current 时只显示当前订阅,off 时隐藏。
  • widget(可选,默认开):一行一个订阅的详细面板(进度条 / 用量 / 重置倒计时), pi Web 中默认折叠,点击输入框上方的 subs 按钮展开。
  • 未登录的订阅不出现在任何位置;请求失败显示 并回退到最近一次成功数据(带 ⌛ 标记)。

命令:

/subs            强制刷新并显示摘要
/subs status     各订阅详细状态
/subs off / on   开关面板(写入配置)

安装

pi install npm:pi-subs
# 或从 GitHub:
pi install git:github.com/wonton1984/pi-subs
# 本地试用:
pi -e ./pi-subs

需要 Pi ≥ 0.84(用到 `ctx.ui.setWidget` 与 `modelRegistry.getProviderAuth`)。 在 **pi Web** 中已开的旧会话需要 `/reload`(或在 pi Web 输入 `/reload`)才会加载新装的扩展。

配置 `~/.pi/agent/pi-subs.json`(可选)

{
  "refreshMinutes": 10,
  "widget": true,
  "statusline": "all",
  "widgetPlacement": "aboveEditor",
  "providers": {
    "opencode": true, "kimi": true, "codex": true, "commandcode": true,
    "claude": true, "copilot": true, "zai": true, "openrouter": true
  }
}
  • statusline: "all"(全部订阅一行,当前高亮)/ "current"(只显示当前订阅)/ "off"
  • refreshMinutes: 自动刷新间隔(1–1440,默认 10;连续失败时指数退避,上限 1 小时)
  • providers: 按订阅开关

隐私与安全

  • 用量查询直连各服务商官方端点,凭证只发往对应官方域名。
  • 错误信息会先脱敏(Bearer token、API key 模式)再显示。
  • 最近一次成功数据缓存于 `~/.pi/agent/pi-subs-cache.jso