"GPT-4 currently has a cap of 25 messages every 3 hours." - you must have seen this message, right?
In this video we talk about API rate limits, what is it and how to implement it in FastAPI.
First, we look at a plugin called fastapi-limiter which is a nice implementation using FastAPI's dependency injection system. We also look at how they've tested it as it.
Then we look at an example how we implemented in our CodeImag.es API which is more based on user consumption.
We hope these examples help you when you need to implement this. It might not be necessary from the start, but when you expect a lot of usage and calls to your API incur a cost, then this becomes pretty important!
Links:
- fastapi-limiter: [ Ссылка ]
- its testing: [ Ссылка ]
- our codeimag.es API: [ Ссылка ]
- and website: [ Ссылка ]
- rate limiting by user consumption: [ Ссылка ]
- testing of it if interested: [ Ссылка ]
- pending fix, HTTP code fix: [ Ссылка ]
---
Learn more about Pybites / what we do: [ Ссылка ]
Get our weekly developer / mindset emails: [ Ссылка ]
Join our Slack community: [ Ссылка ]
And last but not least, we appreciate any feedback to make our YouTube content better 💡
[ Ссылка ] 🙏
Ещё видео!