8000 feat(plan): let Google accounts pick Plus or Pro when no plan is reported by InfinityPacer · Pull Request #70 · InfinityPacer/meterleaf · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
- 删除账户只移除账户展示,不会删除历史请求、累计统计,也不影响 Sub2API 或本机采集器。
- 重命名的名称只在 Meterleaf 中显示,最长 40 个字,不会改动上游。清空名称或选择恢复原名后,重新显示上游提供的名称。
- 套餐徽标按使用倍数分三档显示,同一档外观相同。Claude Pro、Claude Team Standard、ChatGPT Plus 与 Google AI Pro 为一档,Claude Max、Claude Team Premium、ChatGPT Pro 5x 与 Google AI Ultra 5x 为二档,Claude Ultra、ChatGPT Pro 20x 与 Google AI Ultra 20x 为三档。Claude 的 Max 与 Ultra 即原来的 Max 5x 与 Max 20x。只知道订阅类型、不知道倍数时,例如只显示 Max 或 Team,不分档。无法识别的套餐只显示名称。
- 采集器读不到套餐时,例如账户已不在这台电脑上登录,可以在「设置套餐」里选择 Pro、Max、Ultra、Team Standard 或 Team Premium,选「自动识别」恢复采集器上报的套餐。Antigravity 只报出 Google AI Ultra、不区分倍数,它的账户在「设置套餐」里选 Ultra 5x 或 Ultra 20x,徽标和档位随之显示。设置只保存在 Meterleaf 中,不会被同步覆盖,也不会让本周期的额度预估重新起算。
- 采集器读不到套餐时,例如账户已不在这台电脑上登录,可以在「设置套餐」里选择 Pro、Max、Ultra、Team Standard 或 Team Premium,选「自动识别」恢复采集器上报的套餐。Antigravity 只报出 Google AI Ultra、不区分倍数,它的账户在「设置套餐」里选 Ultra 5x 或 Ultra 20x,徽标和档位随之显示。只在 omp 里登录、读不到套餐的 Google 账号,也可以选 Plus 或 Pro。Google AI Plus 的额度低于其他各家的一档,只显示名称、不分档。设置只保存在 Meterleaf 中,不会被同步覆盖,也不会让本周期的额度预估重新起算。
- 本地归档、删除状态和账户名称不会被同步覆盖。上游删除账户后,本地历史请求仍保留。

![账户合并示例](images/account-merge.png)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meterleaf",
"version": "0.16.1",
"version": "0.16.2",
"private": true,
"type": "module",
"license": "Apache-2.0",
Expand Down
5 changes: 3 additions & 2 deletions src/shared/account-plan.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* 用户可手动指定的套餐,按平台列出。新版 Claude Code 只在登录凭据里保存套餐,未登录的账户或
* 凭据不可读时由用户补上档位;Antigravity 只报出 Google AI Ultra,不报 5x 或 20x,倍数由用户指定。
* 凭据不可读时由用户补上档位;Antigravity 只报出 Google AI Ultra,不报 5x 或 20x,倍数由用户指定,
* 只在 omp 里登录、状态栏从未读到套餐的 Google 账号也可以补上 Plus 或 Pro。
* 取值与采集器上报的标识一致。
*/
export const manualAccountPlansByPlatform = {
anthropic: ["pro", "max-5x", "max-20x", "team-standard", "team-premium"],
google: ["ultra-5x", "ultra-20x"],
google: ["plus", "pro", "ultra-5x", "ultra-20x"],
} as const;

export type ManualPlanPlatform = keyof typeof manualAccountPlansByPlatform;
Expand Down
2 changes: 1 addition & 1 deletion src/web/components/AccountPlanDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function AccountPlanDialog({
/>
<Dialog.Description className="account-rename-hint">
{target?.platform === "google"
? "Antigravity 只报出 Google AI Ultra,不区分 5x 和 20x,在这里指定订阅的倍数。"
? "Antigravity 只报出 Google AI Ultra,不区分 5x 和 20x,在这里指定订阅的倍数。账号只在 omp 里登录、读不到套餐时,也可以在这里选 Plus 或 Pro。"
: "自动识别使用采集器从 Claude Code 读到的套餐。账户不再登录这台电脑、读不到套餐时,可以在这里指定。"}
设置后本周期的额度预估照常使用已有数据。
</Dialog.Description>
Expand Down
6 changes: 5 additions & 1 deletion src/web/lib/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ export interface PlanBadge {
* 只知道订阅类型时上报 max、team 或 enterprise。2026-10-30 起 Anthropic 把 Max 5x 改名 Max、
* Max 20x 改名 Ultra,标识沿用原值,只改显示名。Sub2API 从 ChatGPT 凭据读取 plan_type,其中
* prolite 是 Pro 5x、pro 是 Pro 20x。Antigravity 采集器原样上报 Google AI Ultra 这类套餐名,
* 不带倍数,倍数由用户在套餐设置里指定为 ultra-5x 或 ultra-20x。
* 不带倍数,倍数由用户在套餐设置里指定为 ultra-5x 或 ultra-20x;读不到套餐时用户也可以指定
* plus 或 pro。Google AI Plus 的额度低于其他各家的 1 档,不给档位。
*/
const knownPlans: Record<string, Record<string, PlanBadge>> = {
anthropic: {
Expand All @@ -40,7 +41,10 @@ const knownPlans: Record<string, Record<string, PlanBadge>> = {
pro: { label: "Pro 20x", tier: 3 },
},
google: {
"google ai plus": { label: "Plus", tier: null },
"google ai pro": { label: "Pro", tier: 1 },
plus: { label: "Plus", tier: null },
pro: { label: "Pro", tier: 1 },
"google ai ultra": { label: "Ultra", tier: null },
"ultra-5x": { label: "Ultra 5x", tier: 2 },
"ultra-20x": { label: "Ultra 20x", tier: 3 },
Expand Down
11 changes: 11 additions & 0 deletions tests/plan-badge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ test("plan tiers align by usage multiple across upstreams", () => {
label: "Ultra 20x",
tier: 3,
});
// 手动指定与采集器上报的 Google 套餐显示一致;Plus 低于各家 1 档,不给档位。
expect(subscription("google", "pro")).toEqual({ label: "Pro", tier: 1 });
expect(subscription("google", "Google AI Pro")).toEqual({
label: "Pro",
tier: 1,
});
expect(subscription("google", "plus")).toEqual({ label: "Plus", tier: null });
expect(subscription("google", "Google AI Plus")).toEqual({
label: "Plus",
tier: null,
});
// ChatGPT 的 pro 是 20x 档,与 Claude 的 Pro 同名但不同档。
expect(subscription("openai", "pro")).toEqual({ label: "Pro 20x", tier: 3 });
});
Expand Down
Loading
0