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.
This commit is contained in:
kaitranntt
2025-12-29 13:18:02 -05:00
parent 4233415095
commit 739270aac4
+4 -11
View File
@@ -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;