Skip to content

feat: add Sub2API multi-site, multi-key usage tracking - #188

Merged
ItsJazii merged 3 commits into
ItsJazii:mainfrom
JaminYe:codex/sub2api
Sep 9, 2026
Merged

ItsJazii merged 3 commits into
ItsJazii:mainfrom
JaminYe:codex/sub2api

Conversation

@JaminYe

@JaminYe JaminYe commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pane users with Sub2API keys currently need to open each site's dashboard to inspect their usage. This adds a dedicated Sub2API provider with multiple sites and keys, with one stable card per key.

  • Query only the configured site's GET /v1/usage with that key's Bearer credential. Display total and rolling key quotas, daily/weekly/monthly subscription allowances, wallet balances (including debt), expiry, and collapsible request/token/actual-cost summaries.
  • Reuse the site/key settings workflow, preserve card identity across edits, clear old usage on credential or origin changes, and discard late results from obsolete contexts. Failed refreshes retain explicitly stale history.
  • Project the tightest valid allowance into the tray, reuse quota alerts, and expose sanitized per-key local HTTP usage. Shared wallets/subscriptions are not summed into Total Spend.
  • Store credentials in owner-only local files, disable redirects, bound requests and response sizes, and exclude Sub2API from telemetry. Document the manual-key exception precisely in the contribution rules.

Validation

  • cargo test --manifest-path src-tauri/Cargo.toml sub2api --lib: 28 passed. Windows credential ACL tests passed when rerun outside the sandbox.
  • node scripts/sub2api-display.test.mjs: 8 passed.
  • npx tsc --noEmit: passed.
  • git diff --cached --check: passed before commit.

Tests use local mock endpoints and temporary credentials; no live paid services were queried. Desktop layout, tray appearance, and settings interactions still need manual visual validation; screenshots are not included.


Devin Review

需求:集中展示 Sub2API 限额、订阅和钱包用量,每个 Key 独立管理。

实现:增加独立凭据存储及协议适配,接入卡片、托盘、告警和本地 HTTP,保护缓存生命周期与隐私边界,并同步手动 Key 贡献规则。

验证:后端 Sub2API 定向测试 28 项、前端定向测试 8 项通过,TypeScript 与 diff 检查通过。
devin-ai-integration[bot]

This comment was marked as resolved.

实现思路:保留缺失指标偏好并按当前数据投影,补齐滚动额度周期,统一共享存储错误提示。补充布局恢复及预测告警回归测试。
devin-ai-integration[bot]

This comment was marked as resolved.

修复思路:自动选择跳过空指标卡片,无候选时保留错误提示兜底;补充选择、禁用及过期缓存回归测试。
@ItsJazii
ItsJazii merged commit 8ca3a86 into ItsJazii:main Sep 9, 2026
1 check passed
@ItsJazii ItsJazii mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants