Open
Description
When creating GPT responses in demo-ai
, we optimistically generate the response before decrementing user credits. This is:
- Great for the user - when the open AI call fails, users don't lose credits.
- Potentially dangerous for us - a malicious user can spam our API and spend more credits than they have.
Malicious users can only cause limited damage, so we went with the optimistic approach and left a comment in the code that explains the tradeoff.
It's possible to implement the logic in a way that doesn't force you to choose, but it's significantly more complicated (extra table, cleanup queue, etc.) Details available here: #391 (comment).
Should we do it? Is it an overkill for the Open Saas template?