API usage billing for SaaS application products

Hi, I have one question related to OpenAI api usage and cost related.

For say, I’m making a SaaS application where I have 1000 users using it monthly basis. I have premium features where user can have access of AI chat, voice chat interaction, etc. So in such features as user paying monthly basis, how can I limit their usage that they can use this amount of token daily and whole month this much, how does this calculation and design can be there so user doesn’t take advantage and make huge bills for the dev team while subscription is not much. Any suggestions how to limit tokens usage for premium customers based on usage, how can I do that. Any resources to understand more, I know these usage are pay as you go way.

Hey there and welcome to the community!

What you are asking for sounds like it could be best solved with tokens! Not OpenAI tokens, but your product’s tokens.

This is probably your best bet here without getting too much in the weeds. It’s premise is simple; people pay a certain amount (at once or via subscription) to get a certain amount of tokens from you. let’s say 1000. These tokens can relatively resemble whatever you want; words, OAI tokens, etc. The user then uses those tokens to use your service. When they run out, they have to pay for more.

This keeps you from say, a SaaS platform where somebody might pay $20 a month but end up costing you over $100 in API calls. It lets you set your own usage cap.

2 Likes

Thank you. I see, it’s regulated by business side not OpenAi api. How do usually set or limit those usage cap? I would like to learn more of this.

One approach is that each user has a finite amount of money they can spend, and you simply deduct from their remaining dollar credits every time they make a request. Then allow users to top off their accounts by adding funds themselves at any time, and as much as they want. I like this model best because if you ever encounter a heavy user you let them keep buying more credit rather than saying “sorry you’re out of credit”.

Great thanks for sharing your thoughts. Can I ask one thing, is there any way we can check the token limits that how’s much usage are for specific users. Also, when one use OpenAi api for commercial SaaS appointment, how does the billing policy works? Do they have different categories of purchase for that?

You would need to handle that on your part - receive number of tokens for every request you make and then add those tokens to the user’s spendage.

1 Like

Understand it. So usually developer limit the token usage for each user who’s using the service. Is there any best way, I can learn and understand a efficient way to do such thing when you’ve thousands of clients who’s using this service? Any better approach to follow.

Accurate tracking and transparent billing ensure that customers are only charged for what they use, fostering trust and satisfaction. It’s vital to implement a flexible billing system that can scale with customer needs while providing clear insights into usage patterns. For those involved in fintech or seeking to understand more about merchant services, exploring resources on Dashdevs can offer valuable insights into the industry’s latest trends and best practices.