Now that we can create Stripe subscriptions, we need to make sure that users respect the limits and quotas according to their Stripe subscriptions. To do so, we need to establish some thresholds and enforce them, which we will do in this lesson.
Guarding the content generation API with thresholds
There are two instances where we need to guard the content generation API with thresholds:
- Titles - We need to make sure that the user has enough tokens to generate a list of titles before streaming the content
- Content - We need to make sure that the user has enough tokens to generate the content
At the same time, we also need to report the tokens used by the user to the databa ...