[Feature Request]: Honor Retry-After header from APIs #1695
jdmansour
started this conversation in
Feature requests
Replies: 1 comment
-
|
wonderful suggestion @jdmansour. We'll look into this!! Thanks for sharing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What needs to be done?
When your quota is exhausted, some APIs use the Retry-After header to signal when it is safe to send another request. Currently, crawl4ai applies basic exponential backoff for requests, but doesn't take this header into account.
What problem does this solve?
This lets Crawl4AI better deal with rate limiting
Target users/beneficiaries
No response
Current alternatives/workarounds
No response
Proposed approach
I've made a very small patch to implement this. If you'd like I can make a pull request.
This works fine for me (using an OpenAI compatible API) but needs testing and could be made more robust (e.g. catching errors if the header is invalid).
In
utils.py,perform_completion_with_backoffaround line 1794, change it to:Beta Was this translation helpful? Give feedback.
All reactions