mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
fix: Do not retry litellm.APIError for insufficient credits.
This commit is contained in:
parent
c057dc9466
commit
e0b42d51db
1 changed files with 12 additions and 0 deletions
|
@ -92,4 +92,16 @@ class LiteLLMExceptions:
|
||||||
" limiting your requests."
|
" limiting your requests."
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Check for specific non-retryable APIError cases like insufficient credits
|
||||||
|
if ex.__class__ is litellm.APIError:
|
||||||
|
err_str = str(ex).lower()
|
||||||
|
if "insufficient credits" in err_str and '"code":402' in err_str:
|
||||||
|
return ExInfo(
|
||||||
|
"APIError",
|
||||||
|
False,
|
||||||
|
"Insufficient credits with the API provider. Please add credits.",
|
||||||
|
)
|
||||||
|
# Fall through to default APIError handling if not the specific credits error
|
||||||
|
|
||||||
return self.exceptions.get(ex.__class__, ExInfo(None, None, None))
|
return self.exceptions.get(ex.__class__, ExInfo(None, None, None))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue