From 77c2309b52a247129a1c1640f9f80fbe98def42a Mon Sep 17 00:00:00 2001 From: nai-degen Date: Thu, 20 Jul 2023 23:06:37 -0500 Subject: [PATCH] correctly flags trial keys during startup even if over quota --- src/key-management/openai/checker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/key-management/openai/checker.ts b/src/key-management/openai/checker.ts index 10922eb..aa3630c 100644 --- a/src/key-management/openai/checker.ts +++ b/src/key-management/openai/checker.ts @@ -202,6 +202,12 @@ export class OpenAIKeyChecker { GET_SUBSCRIPTION_URL, { headers: { Authorization: `Bearer ${key.key}` } } ); + // See note above about updating the key's `lastChecked` timestamp. + const keyFromPool = this.keys.find((k) => k.hash === key.hash)!; + this.updateKey(key.hash, { + isTrial: !data.has_payment_method, + lastChecked: keyFromPool.lastChecked, + }); return data; }