Get paid for your Streamlit Generative AI App!!
(With or without the GPT Store!)
Background
As the Streamlit community builds more and more useful GPTs, and as more generative AI powered apps emerge, getting paid for your app will be critical in turning your AI into a business. But simply integrating Stripe for payments may not be enoughâŠfor example, how do you ensure that what your users pay is enough to cover your AI costs with OpenAI, Langchain, etc.? The last thing any Builder wants is to be stuck with bills from AI vendors at the end of the month that they struggle to cover.
Nevermined wants to fix this.
Mission
Weâve made it our mission to help AI Builders get paid as simply as possible so that they can focus on what really matters: building an amazing gen-AI app for their users.
Solution
Try the test version of the Solution now!
Weâre building a Streamlit solution that will enable AI Builders to set up subscription plans to accept payments and manage the usage of their apps, AI agents and GPTs, all from their Streamlit Gen-AI app.
The solution works by creating your own credits backend that integrates with any AI offering, like ChatGPT, Langchain, Llama Index, etc., and lets you manage control of your app usage.
The best part? You, the Builder, is in control of everything! You set the price, the duration for access, the number of accesses, etc. You just create a subscription plan, set the parameters for access, and start selling credits to your users.
Want to sell multiple tiers with varying discounts depending on the tier? You can do it.
Want to sell time-based access AND request-based access to your AI app? You can do that too!
And the icing on the cake? The solution comes ready-built with reporting so you can understand how your users are using your AI app, and then optimize to support their usage! Want to know what your power users are doing and connect with them? You can do that with this solution!
We want to enable Builders to have control over their AI apps in any permutation, but without the complexity of having to build it yourself!
Disclosure
The app is still in Alpha release mode. Currently the solution is only available via our staging application, including Stripe Testing integration. We plan to have the full production release by the end of January.
Weâd love for everyone to try the application and let us know what you think. Your feedback is invaluable as it will help us streamline the application for your use. Please let us know what you think!
See how the Gen-AI Streamlit Subscription works:
First hereâs a short demo of the Gen-AI Streamlit Subscription app and how it works with Stripe payments:
For the full length demo video, please see this.
In this video, you will see how a user is prompted via your Gen-AI Streamlit app to first log into your app. Once logged in and authenticated, users without credits will be prompted to subscribe to your AI. You have the choice to set up different subscription options, such as Free and Paid subscription plans. Once a user has subscribed, they will be able to access your AI under the conditions you set via each planâs subscription prerequisites.
Try the Application Now!
To try the application, please go to our staging app here: Staging Solution.
How to setup a Gen-AI Streamlit Subscription Plan
The following is a step-by-step guide to creating your own Gen-AI Subscription Plan for your Streamlit app. Please note that this product is still a work in progress, and we have not yet made the Stripe payment piece fully available in production. If you would like to use the production Stripe integration to get paid, please contact us on Discord () or at info@nevermined.io.
Step 1 - Set up your Builder Account in Nevermined
- Navigate to Nevermined
- Click âLog inâ
- Select your sign in method
- Once logged in, click the âNewâ button in the top right, then click the âCreate a planâ button.
Step 2 - Set up Stripe
- This will prompt you to continue creating your profile, updating it with your designated payment(s) type (i.e. Stripe).
- If youâd like to use Stripe as your payment gateway, select the Stripe option and click the âCreate Stripe accountâ button
- Now you will set up your Stripe account
a. First enter your email and verify your phone number
b. Next, describe your business for Stripe, including your business and personal details. This will help Stripe onboard you into their system.
c. Once youâve navigated the set up details, click âAgree and submitâ to finalize your account set up.
- Congratulations! Youâve successfully set up your Stripe account. Now letâs create your first subscription plan.
Step 3 - Create a Subscription Plan
- Click the âNewâ button, then the âCreate a planâ button
- Describe the type of subscription plan you wish to create for your users. For example, you may want to create a subscription plan that allows your users to buy a set number of access credits for a certain price that your users will use to redeem access to your gen-AI Streamlit app.
- Next, choose the type of plan you want to enable for your users. Here you have the selection of allowing your users to access your app for a period of time, or by a set number of requests. Weâve also included a set of templates you can use, like Free, time period plans (i.e 1 month, 1 year, etc.), custom plans, etc.
a. Request based plan - you can choose from a number of options, or create your own Custom plan. You are able to edit:
i. The Title - Give your plan a descriptive Subscription title.
ii. Price - Set the price for you credits based plan.
iii. No. of Credits - Set the number of credits your users receive when they buy this plan.
b. Time period based plan - you can choose from a number of options, or create your own Custom plan. You are able to edit:
i. The Title - Give your plan a descriptive Subscription title.
ii. Price - Set the price for you credits based plan.
iii. Duration - Set the duration of time that your users can access your app when they buy this plan. Options include:
* Hours
* Days
* Weeks
* Months
* Years
- Now review the subscription plan set up and confirm by clicking âNextâ
Step 4 - Specify your Gen-AI Service
- Next, you need to link your Gen-AI service, like your OpenAI GPT API, to the plan in order to manage access to your AI service. To do this, click the âCreate Contentâ button.
- You start by describing the AI service you want to control access to. To do this, provide a Title, Description and cover image for the Gen-AI service.
- Next, add your specific AI service information via your AIâs API information. For example, if your AI is a text-to-text AI using OpenAIâs completion capability, you will register the corresponding OpenAI POST: https://api.openai.com/v1/chat/completions. For other third party AI services, you can register a similar API call.
(Please note that we support the OpenAPI standard for API information. This means that you can also set how youâd like to expose your endpoints.)
-
Now add what type of security mechanism youâd like to enforce for User Authentication to your AI app. The options include:
-
No authentication
-
Basic Authentication with a username and password
-
Bearer Token authentication with designated access token.
In the case that you are using a third party service, like OpenAI, use the Bearer Token option to register your OpenAI API Key (OPENAI_API_KEY). This can be found from the third party service provider.
(Please note that Nevermined fully encrypts the Bearer Token information that you submit so that this information is never disclosed to anyone but yourse
- Now select the subscription plan that you created earlier and attach your AI service to this plan. This will enable the controls youâve set for your Gen-AI app using this service. In this step you can also set the number of credits needed for each user to make one request for this AI service.
- Lastly, review your AI-service setup and click âCreateâ.
- Once youâve successfully created the AI service, you can see its widget by clicking the âSee the assetâ button.
Step 5 - Get your Streamlit Embeddable Widget
- To create your embeddable widget into your Streamlit app, you will need your unique subscription plan identifier, or DID. You can get this by copying the URL for the AI API / webservice that you just created. To do this, first navigate to âMy area â My assetsâ.
- Click the 3 vertical dots for your AI webservice, and select âSee Assetâ.
- From the AI webservice page, copy the URL to use in the next step.
Embedding the Widget into your Streamlit Gen-AI App
Follow the instructions in Github for deploying your widget to Streamlit: GitHub - nevermined-io/streamlit: Nevermined Streamlit component
(Please note: to get your AIâs unique identifier, or DID, you can follow the instructions above from xviii to xx.)
Deployed Widget in you Streamlit Gen-AI App
Once your Widget is deployed to your Streamlit app, it should work like the demo video.
Sit back and get paid with your AI App!
Now youâre ready to get paid. Users that use your Gen-AI App can pay you via Stripe for the application youâve built for them.
Happy Building!
Support
This product is a work in progress. Consequently, some things explained above may be unclear, or may change. If you run into any issues, please contact us by jumping into our Discord or emailing us at info@nevermined.io.
Weâd love to hear from you! Connect with us on Discord.
Weâd love to hear from you whether you think this application is helpful or horrible, as well as what we can do to improve what weâre working on. So please join the discussion at our Discord.