firecrawl icon indicating copy to clipboard operation
firecrawl copied to clipboard

[Feat] Provide more details for 429 Rate limit reached

Open tractorjuice opened this issue 10 months ago • 7 comments

Other APIs provide details within the 429 response that enables a calculation or even the details of when to retry. For example:

Groq:

Error: Error code: 429 - {'error': {'message': 'Rate limit reached for model llama3-70b-8192 in organization org_xxxxxxx on tokens per minute (TPM): Limit 7000, Used 0, Requested ~12903. Please try again in 50.597142857s. Visit https://console.groq.com/docs/rate-limits for more information.', 'type': 'tokens', 'code': 'rate_limit_exceeded'}}

tractorjuice avatar Apr 27 '24 10:04 tractorjuice

Great idea.

nickscamara avatar Apr 27 '24 18:04 nickscamara

Would love to take this - I see from openapi spec a 429 can be returned from:

  1. /scrape
  2. /crawl
  3. /search
  4. /crawl/status

What are the rate limits for each of these endpoints? I see in rate-limiter.ts there is a crawlStatusRateLimiter - should there be something similar for the other endpoints or should the 429 be passed-through from the underlying services like supabase auth or serp?

simonha9 avatar May 01 '24 18:05 simonha9

@simonha9 Yey! Go for it! Yep, so we should be pushing this week/next week a more strict enforcement on the rate limit based on the subscription. Right now crawlStatus is the only one that differs outside of the preview ones/ global ones.

nickscamara avatar May 01 '24 23:05 nickscamara

Sounds good! Please link a wiki or update this thread when you have an idea what the rate limits should be per subscription + if you have any specific verbiage in mind for the rate limit error messages and I can go ahead an implement this.

simonha9 avatar May 05 '24 16:05 simonha9

@simonha9 sounds good, will do! Thank you so much.

ccing firecrawl team: #127 should be done first before #81

nickscamara avatar May 06 '24 18:05 nickscamara

@simonha9 we've already implemented the rate limits as detailed in issue #151 . You can proceed with implementing the additional details for the 429 rate limit responses as discussed. Looking forward to seeing your contributions!

rafaelsideguide avatar May 22 '24 17:05 rafaelsideguide

Thanks for implementing the rate limits, I will start on this today 😄

simonha9 avatar May 23 '24 13:05 simonha9