How to Implement a Total Token Limit (No Login) in AI Engine (Free Version)
-
Hello, I’m using the free version of AI Engine and would like to limit each visitor to a total of 50 tokens for testing (and eventually 1000 tokens). I’m not using user login, so I plan to rely on sessions or cookies.
I tried hooking into
mwai_chat_responseand also attempted intercepting the REST request withrest_pre_dispatchandrest_post_dispatchto trackusage.total_tokens. However, the chat still truncates messages instead of blocking them.Could you please advise on:
- Which hooks or filters in AI Engine (free version) reliably give me the
usage.total_tokensso I can track total usage for each visitor? - How can I completely stop the chatbot from responding once the limit is reached, rather than just truncating?
- Is this only possible in the Pro version via the Statistics module, or can it be done in the free version with a custom snippet?
Thank you for any guidance you can provide!
Best Regards,
Rana Waleed - Which hooks or filters in AI Engine (free version) reliably give me the
The topic ‘How to Implement a Total Token Limit (No Login) in AI Engine (Free Version)’ is closed to new replies.