There is some logic to handle this already in mkstack (the core template Shakespeare uses), but I also cloned the Shakespeare project (in Shakespeare) and then instructed the tool to study "../shakespeare" and how it handles credits, wallet, gift cards, etc with the request to implement these features into my application.
More specifically, I did the above with "Ask Quilly" (
https://ask-quilly.shakespeare.wtf, a very similar project) and then had Shakespeare distill its implementation of Shakesepeare AI into "tldr". Everything is using the same
https://ai.shakespeare.diy calls under the hood, so all balances and gift cards are shared - they can even be redeemed within these same applications as well!
In any case, hope that helps!