treats 403 from anthropic as key dead

This commit is contained in:
nai-degen
2023-12-11 09:13:53 -06:00
parent e0624e30fd
commit 0d3682197c
2 changed files with 8 additions and 3 deletions
+5 -1
View File
@@ -314,7 +314,11 @@ const handleUpstreamErrors: ProxyResHandlerWithBody = async (
keyPool.disable(req.key!, "revoked");
errorPayload.proxy_note = `API key is invalid or revoked. ${tryAgainMessage}`;
} else if (statusCode === 403) {
// Amazon is the only service that returns 403.
if (service === "anthropic") {
keyPool.disable(req.key!, "revoked");
errorPayload.proxy_note = `API key is invalid or revoked. ${tryAgainMessage}`;
return;
}
switch (errorType) {
case "UnrecognizedClientException":
// Key is invalid.