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
@@ -48,13 +48,14 @@ export class AnthropicKeyChecker extends KeyCheckerBase<AnthropicKey> {
protected handleAxiosError(key: AnthropicKey, error: AxiosError) {
if (error.response && AnthropicKeyChecker.errorIsAnthropicAPIError(error)) {
const { status, data } = error.response;
if (status === 401) {
if (status === 401 || status === 403) {
this.log.warn(
{ key: key.hash, error: data },
"Key is invalid or revoked. Disabling key."
);
this.updateKey(key.hash, { isDisabled: true, isRevoked: true });
} else if (status === 429) {
}
else if (status === 429) {
switch (data.error.type) {
case "rate_limit_error":
this.log.warn(