Hi, I am currently working on an app using Langchain and OpenAI API. I am planning to deploy it publicly later.
In the app, I let the user have the choice between:
- using my API key
- using their own API key
I did this so that people (friends, family, non-tech people) can try my app without having to enter an API key.
This is working well. However, I want to avoid users using all my credits, so I would like to set a limit per user. For example, a widget could be triggered at most x times per minute, y times per hour, z times per day, for a given user.
Do you have any idea how I could set this up?
I was first thinking of putting these limits per session (storing the user history in the session state), but I believe people could just reload the app to reset the session.
Thank you!