handles keys which have been banned (but not revoked) by openai
This commit is contained in:
parent
c749e2d57d
commit
d7a4829d13
|
@ -221,6 +221,13 @@ export class OpenAIKeyChecker {
|
|||
"Key is out of quota. Disabling key."
|
||||
);
|
||||
this.updateKey(key.hash, { isDisabled: true });
|
||||
}
|
||||
else if (status === 429 && data.error.type === "access_terminated") {
|
||||
this.log.warn(
|
||||
{ key: key.hash, isTrial: key.isTrial, error: data },
|
||||
"Key has been terminated due to policy violations. Disabling key."
|
||||
);
|
||||
this.updateKey(key.hash, { isDisabled: true });
|
||||
} else {
|
||||
this.log.error(
|
||||
{ key: key.hash, status, error: data },
|
||||
|
|
|
@ -377,6 +377,10 @@ function handleOpenAIRateLimitError(
|
|||
// Billing quota exceeded (key is dead, disable it)
|
||||
keyPool.disable(req.key!);
|
||||
errorPayload.proxy_note = `Assigned key's quota has been exceeded. ${tryAgainMessage}`;
|
||||
} else if (type === "access_terminated") {
|
||||
// Account banned (key is dead, disable it)
|
||||
keyPool.disable(req.key!);
|
||||
errorPayload.proxy_note = `Assigned key has been banned by OpenAI for policy violations. ${tryAgainMessage}`;
|
||||
} else if (type === "billing_not_active") {
|
||||
// Billing is not active (key is dead, disable it)
|
||||
keyPool.disable(req.key!);
|
||||
|
|
Loading…
Reference in New Issue