You would want to create a couple of fields for the user, 1) last request time and 2) request count. Set up your workflows so that if it’s less than a minute since the last request, increment the request count and if it’s more than a minute, reset request count to 0. Then you can refuse the request if request count >60.
Thanks Flowtron - how would one set up the ‘last request time’ (in terms of the necessary syntax) if the request is coming from the API connector (i’ve got OpenAI hooked into the app via the connector)?
You have incoming requests from the API Connector? huh? I think I’m missing something.
If you have a button that triggers a request via API Connector, you would just need to set lastRequestTime (as Current Date) and requestCount in that workflow before or after the request itself.
If you have a Backend Workflow that answers requests, you could basically do the same, you would just want to find the user requesting it first.
How can I limit the number of tokens my user can generate? My API is up and running, but unsure how to limit it by the user (similar to how other AI writing tools do)
To limit the number of tokens your user can generate per API call, you can set the max number of tokens in the API connector that you use to set up the link to OpenAI. In terms of the total number of API calls the user can generate, you can assign a counter with a total number of API calls to the user (say when they sign up or log in) and then deduct against the counter each time they make a call to the API (i.e. when they press a button or whatever). Once their number has run out, you can then make the button unclickable and display an alert. Then reset their counter at some point when their subscription renews for the month.