feat(usage): add Claude Fable quota tracker support
- Recognize Fable weekly windows and normalize to weekly fable (7d) - Fall back to 100% available weekly Fable window when Anthropic payload omits it - Forward remaining percentages and enforce canonical Claude quota order in Quota Tracker Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -510,6 +510,8 @@ export function parseQuotaData(provider, data) {
|
||||
name,
|
||||
used: quota.used || 0,
|
||||
total: quota.total || 0,
|
||||
remaining: quota.remaining !== undefined ? quota.remaining : Math.max(0, (quota.total || 100) - (quota.used || 0)),
|
||||
remainingPercentage: quota.remainingPercentage !== undefined ? quota.remainingPercentage : calculatePercentage(quota.used, quota.total),
|
||||
resetAt: quota.resetAt || null,
|
||||
});
|
||||
});
|
||||
@@ -664,6 +666,18 @@ export function parseQuotaData(provider, data) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (provider?.toLowerCase() === "claude") {
|
||||
const CLAUDE_QUOTA_ORDER = {
|
||||
"session (5h)": 0,
|
||||
"weekly (7d)": 1,
|
||||
"weekly fable (7d)": 2,
|
||||
"weekly opus (7d)": 3,
|
||||
"weekly sonnet (7d)": 4,
|
||||
};
|
||||
normalizedQuotas.sort((a, b) => (CLAUDE_QUOTA_ORDER[a.name] ?? 99) - (CLAUDE_QUOTA_ORDER[b.name] ?? 99));
|
||||
return normalizedQuotas;
|
||||
}
|
||||
|
||||
// Sort quotas according to PROVIDER_MODELS order
|
||||
const modelOrder = getModelsByProviderId(provider);
|
||||
if (modelOrder.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user