feat: display official subscription quota on Claude provider cards

Read Claude OAuth credentials from macOS Keychain (with file fallback)
and query the Anthropic usage API to show quota utilization inline on
official provider cards. Includes compact countdown timer for reset
windows and hides the rarely-used seven_day_sonnet tier in inline mode.
This commit is contained in:
Jason
2026-04-04 17:18:42 +08:00
parent d9c0e4c452
commit b30f3c27ad
15 changed files with 945 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
export type CredentialStatus =
| "valid"
| "expired"
| "not_found"
| "parse_error";
export interface QuotaTier {
name: string;
utilization: number; // 0-100
resetsAt: string | null;
}
export interface ExtraUsage {
isEnabled: boolean;
monthlyLimit: number | null;
usedCredits: number | null;
utilization: number | null;
currency: string | null;
}
export interface SubscriptionQuota {
tool: string;
credentialStatus: CredentialStatus;
credentialMessage: string | null;
success: boolean;
tiers: QuotaTier[];
extraUsage: ExtraUsage | null;
error: string | null;
queriedAt: number | null;
}