diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index 6e3887a4502..016a403281b 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -601,9 +601,7 @@ def _map_anthropic_exception( # Anthropic returns usage/spend-limit exhaustion typed as invalid_request_error (400), # but per the exception-mapping docs it should surface as a RateLimitError (429). Check # before the generic 400 branches below, which would otherwise map it to BadRequestError. - if ExceptionCheckers.is_error_str_rate_limit( - error_str, getattr(original_exception, "status_code", None) - ): + if ExceptionCheckers.is_error_str_rate_limit(error_str, getattr(original_exception, "status_code", None)): raise RateLimitError( message=f"AnthropicError - {error_str}", model=model,