Skip to content

feat(accounts): estimate Claude weekly quota using GPT cost formula - #7935

Open
reallyfeishi wants to merge 1 commit into
Wei-Shaw:mainfrom
reallyfeishi:feat/claude-weekly-estimate
Open

reallyfeishi wants to merge 1 commit into
Wei-Shaw:mainfrom
reallyfeishi:feat/claude-weekly-estimate

Conversation

@reallyfeishi

Copy link
Copy Markdown
Contributor

Summary

  • Add local account-cost statistics to the general Claude 7-day usage window for OAuth and passively sampled setup-token accounts.
  • Reuse OpenAI’s existing estimate and display: window cost × 100 ÷ utilization, with the same missing/zero/non-finite handling and no additional low-utilization threshold.
  • Keep 5-hour and model-specific windows separate; use OpenAI’s reset-based/rolling-week start rule and a dedicated weekly statistics cache.
  • Add parity, window/cache, and service-wiring tests, and include the frontend regression tests in the existing critical CI suite.

Validation

All existing GitHub CI jobs passed on b9fc53b52fc3c7ad39cc74dd10042908442c9a91:

  • Frontend ESLint, full typecheck, and 426 tests across 26 files.
  • Go unit and integration tests, including the new service-wiring tests.
  • golangci-lint, shell checks, and release-helper checks.

CI results

Scope

Based on upstream main 5fc0e486. The displayed amount is the same local-cost estimate used for OpenAI; billing, credentials, database schema, and scheduling are unchanged.

@reallyfeishi
reallyfeishi marked this pull request as ready for review October 8, 2026 08:46
riofutab added a commit to riofutab/sub2api that referenced this pull request Oct 9, 2026
- Claude OAuth 与 Setup Token 账号的通用 7d 窗口新增本地账号成本统计,按 OpenAI 同一公式(窗口成本 × 100 ÷ 利用率)估算周额度总量
- 7d 统计使用独立的 1 分钟缓存,窗口起点沿用 OpenAI 的重置时间倒推或滚动 7 天规则;5h 与 Sonnet/Fable 窗口保持独立
- 前端抽出 estimateWindowTotalCost 公共函数,OpenAI 与 Claude 的 7d 进度条共用
- Makefile 关键 vitest 列表合并本仓 AccountUsageCell.refresh 与上游新增的三个 spec
测试:service 定向单测与相关 vitest 通过;全量单测与 lint 待主会话合入时统一执行。
riofutab added a commit to riofutab/sub2api that referenced this pull request Oct 9, 2026
- 合入上游已合并的 Wei-Shaw#7618:平台改为数据驱动,接入 Command Code 与 Cline,Go 升级到 1.27.2,golangci-lint 升级到 v2.14.0。
- 合入开放 PR Wei-Shaw#7920 Wei-Shaw#7924 Wei-Shaw#7928 Wei-Shaw#7930 Wei-Shaw#7931 Wei-Shaw#7933 Wei-Shaw#7935 Wei-Shaw#7936 Wei-Shaw#7939 Wei-Shaw#7941 Wei-Shaw#7947 Wei-Shaw#7951 Wei-Shaw#7954 Wei-Shaw#7956 Wei-Shaw#7960。
- 新增 Decisions 决策接口(Wei-Shaw#7922)及其与 TypeSafe System One 的双向互转(Wei-Shaw#7948),上游 404 时切换账号。
- Haiku 5.5 的 top_p 违规请求在网关直接拒绝,OAuth 伪装不再在 top_p 旁补 temperature,工具集 beta 过滤覆盖 Haiku 5.5。
- 修正新增代码的静态检查告警。

全量 unit 测试、golangci-lint、前端全量 vitest 均已通过;集成测试本机无 Docker,待 CI 验证。
riofutab added a commit to riofutab/sub2api that referenced this pull request Nov 21, 2026
- 带入上游安全修复:同名字段重复且取值不一致的请求体在白名单之后统一拒绝,覆盖全部网关分组链
- 同步上游 v0.2.24 新合并的 PR:联网搜索 Exa 与来源回填、alpha/search 403 不罚账号、DeepSeek thinking 续接、System One 模型映射等;Wei-Shaw#8858 取代 fork 带的 Wei-Shaw#8860
- Wei-Shaw#8868、Wei-Shaw#8870、Wei-Shaw#8979 冲突处保留 fork 的等价实现并带入上游测试;Wei-Shaw#8900 与 fork 带的 Wei-Shaw#7935 重叠,未合入
- 合入开放 PR Wei-Shaw#8994 Wei-Shaw#8987 Wei-Shaw#8990 Wei-Shaw#8997,其中 Wei-Shaw#8997 截断 Gemini 泄漏的下一轮用户消息

测试:后端全量 unit 与 golangci-lint、前端 lint/typecheck/vitest 通过,CI 含 integration 全绿
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.

1 participant