From 432023f87581d1c59b89259219a0c3e2b9ac3ee5 Mon Sep 17 00:00:00 2001 From: nai-degen <44111-khanon@users.noreply.gitgud.io> Date: Fri, 5 May 2023 09:50:43 -0500 Subject: [PATCH] cycles out keys which have been disabled --- src/proxy/middleware/response/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/proxy/middleware/response/index.ts b/src/proxy/middleware/response/index.ts index 2dd7e38..87c87c0 100644 --- a/src/proxy/middleware/response/index.ts +++ b/src/proxy/middleware/response/index.ts @@ -268,6 +268,9 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async ( if (errorPayload.error?.type === "insufficient_quota") { keyPool.disable(req.key!); errorPayload.proxy_note = `Assigned key's quota has been exceeded. ${tryAgainMessage}`; + } else if (errorPayload.error?.type === "billing_not_active") { + keyPool.disable(req.key!); + errorPayload.proxy_note = `Assigned key was deactivated by OpenAI. ${tryAgainMessage}`; } else { errorPayload.proxy_note = `This is likely a temporary error with OpenAI. Try again in a few seconds.`; }