From 46cff2200d37c96625d87e36780e319ecaf715b0 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 11 Mar 2026 08:42:44 -0300 Subject: [PATCH] =?UTF-8?q?fix(usage):=20correct=20Claude=20quota=20displa?= =?UTF-8?q?y=20=E2=80=94=20utilization=20=3D=20%=20used,=20not=20%=20remai?= =?UTF-8?q?ning=20(#299)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Claude Code OAuth API returns 'utilization' as percent USED, not percent remaining. The createQuotaObject function had them swapped: it set remainingPercentage = utilization, which inverted the quota bar. Confirmed by reporter: Claude.ai shows 87% used → OmniRoute was showing 87% remaining (green bar), should show 13% remaining (yellow/red bar). Fix: used = utilization; remaining = 100 - utilization. --- open-sse/services/usage.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/open-sse/services/usage.ts b/open-sse/services/usage.ts index e0d3a8bd..2f945beb 100644 --- a/open-sse/services/usage.ts +++ b/open-sse/services/usage.ts @@ -488,13 +488,14 @@ async function getClaudeUsage(accessToken) { const data = await oauthResponse.json(); const quotas: Record = {}; - // utilization = percentage REMAINING (e.g., 90 means 90% remaining, 10% used) + // utilization = percentage USED (e.g., 90 means 90% used, 10% remaining) + // Confirmed via user report #299: Claude.ai shows 87% used = OmniRoute must show 13% remaining. const hasUtilization = (window: JsonRecord) => window && typeof window === "object" && safePercentage(window.utilization) !== undefined; const createQuotaObject = (window: JsonRecord) => { - const remaining = safePercentage(window.utilization) as number; - const used = 100 - remaining; + const used = safePercentage(window.utilization) as number; // utilization = % used + const remaining = Math.max(0, 100 - used); return { used, total: 100,