From 739270aac40f23239bd85a07dab30c20a3fab80a Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Mon, 29 Dec 2025 13:18:02 -0500 Subject: [PATCH] fix(quota): remove misleading token expiration check in quota fetcher Backend was returning 'Token expired' error based on stale file state without attempting API call. CLIProxyAPIPlus refreshes tokens at runtime but intentionally doesn't persist to disk, making file-based expiration checks always misleading. Now quota fetcher attempts API call regardless of file expiration state. If token is truly invalid, API returns 401 which is handled properly. --- src/cliproxy/quota-fetcher.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/cliproxy/quota-fetcher.ts b/src/cliproxy/quota-fetcher.ts index 9380fdfb..98d6db49 100644 --- a/src/cliproxy/quota-fetcher.ts +++ b/src/cliproxy/quota-fetcher.ts @@ -377,17 +377,10 @@ export async function fetchAccountQuota( }; } - // Check if token is expired - if (authData.isExpired) { - return { - success: false, - models: [], - lastUpdated: Date.now(), - isExpired: true, - expiresAt: authData.expiresAt || undefined, - error: 'Token expired', - }; - } + // Note: We don't check isExpired here because: + // 1. CLIProxyAPIPlus refreshes tokens at runtime but doesn't persist to disk + // 2. File-based expiration is always stale and misleading + // 3. If token is truly invalid, the API call below will fail with 401 // Get project ID - prefer stored value, fallback to API call let projectId = authData.projectId;