36
49 Comments

How to add AI to your existing SaaS product (and give your customers superpowers)

Unless you've been living under a rock or doing a dopamine detox for the past twelve months, you will likely have witnessed the explosion of AI products and the wave of indie hackers chasing the gold rush and trying to strike it lucky with an AI product.

While AI has been around for years, it's previously been restricted to the realms of machine learning experts and not easily accessible to indie hackers. OpenAI and Stable Diffusion changed the game in 2022 by making text and image generation accessible to everyone.

The opportunity

The most famous example of an indie hacker crushing it with an AI product is Pieter Levels, who is building photoai.com to create synthetic digital photoshoots.

Products like this are fun and sexy, but achieving this kind of success with a product that's a UI for AI is rare. I tried it with aigraphics.io and failed.

The opportunity for indie hackers is to use AI to augment existing products and solutions rather than find these cutting-edge ideas.

Simon Høiberg added AI generative text to his social media scheduling product, Feedhive, to help users generate content ideas for social media.

Randall Kanna, another indie hacker, is building CodeTutor that uses AI to teach people how to code with the power of AI. Randall is one of my customers and CodeTutor is built using my SaaS starter kit. Here's a visual of CodeTutor to show integrating AI into a product can look.

CodeTutor AI

AI might seem technically daunting, but I'll tell you a secret – adding generative AI to your SaaS product is easy. I will show you exactly how I added it to my product in less than 30 minutes, and how you can, too.

Why Add Generative AI To Your Product?

The main reason you should add AI to your SaaS product is to give your customers superpowers. We've already covered two examples, and here are some more superpowers you give your customers using AI:

  1. Increase efficiency by automating repetitive and mundane tasks
  2. Provide personalized experiences and recommendations
  3. Improve the accuracy of data analysis and deliver more profound insights
  4. Predict future trends, patterns, and behaviours
  5. Increase speed of decision making

The possibilities are endless!

How to Add Generative Text With ChatGPT

If you’re unfamiliar with ChatGPT, it's a product from OpenAI for generating text responses with AI. We give it a prompt - this can be a question or instruction – and it returns some text.

The following tutorial is written in Javascript, but the same principles apply to other languages. OpenAI has SDKs for various programming languages, and the API calls will be the same.

  1. Create Your OpenAI account
  2. Grab your OpenAI key
  3. Store your API key somewhere safe; I always put keys into a .env file
  4. Install the OpenAI SDK
npm i openai
  1. Make a request to the ChatGPT API with your prompt using the following code:
const { Configuration, OpenAIApi } = require('openai');
const config = new Configuration({ apiKey: process.env.OPENAI_API_KEY });
const openai = new OpenAIApi(config);

async function askChatGPT({ prompt }){

 const res = await openai.createChatCompletion({

   model: 'gpt-3.5-turbo',
   messages: [{ role: 'user', content: prompt }]

 });

 return res.data?.choices?.[0].message?.content;

}

askChatGPT({ prompt: 'Give me a list of the 10 best cafes in Bangkok, Thailand' });

This chunk of code asks OpenAI to generate a new chat request; we specify the ChatGPT model (gpt-3.5-turbo), which is the most popular and widely used OpenAI model.

Next, we set the role to user and pass in our prompt.

It'll take a few seconds to complete and then ChatGPT will respond, and the output text will be available in res.data.choices[0].messages.content

ChatGPT Output

How to Add Generative Image With Dall-E

Dall-E is another product from OpenAI for generating images based on a prompt. We can use it to create any image we can possibly imagine.

We can use OpenAI and the same API key to do this; we only need to change the code slightly:

async function askDallE({ prompt, size, number }){

 const res = await openai.createImage({

   prompt: prompt,
   size: size,
   n: number

 });

 return res.data?.data;

}

askDallE({ prompt: 'A photo of a kitten drinking coffee', size: '512x512', number: 1 })

Similar to ChatGPT, we pass in a prompt, but this time we need a few more parameters: size and n.

Size is the dimensions for our image; in this example I'm asking Dall-E for an image that is 512x512px

n is the number of images we want to generate, in this case, just one image.

Dall-E Output

That's it! Easy right? You can use these two chunks of code to perform many AI tasks. Writing good prompts is the secret to getting the best results. I've shared some resources below on prompt engineering for further reading.

Further Reading

  1. 2

    Very useful informations, great.

  2. 2

    Really excited for GPT-4 to publicly release their API!

  3. 2

    This is a very helpful post. I am now very much studying AI and implementing it in the business of clients. How I Successfully Implemented AI at Berkeley University: https://ingestai.io/use-cases/empowering-uc-berkeley-online-course-support

  4. 2

    @kylegawley can you share some use cases for Dall-E? I like the idea of using AI-generated images but I'm not sure what I'd do with them! 😅

    1. 1

      You could generate images for social media posts, online ads for eg

  5. 2

    Yesss. I've been trying to figure out how to get on the AI bandwagon with my product. I think I'll do GPT. Here we go!

  6. 2

    I've been wondering about how I should go about integrating generative AI into my platform! Thanks so much for sharing this tactical post, it gives me a great place to get started.

    Bookmarked! :)

  7. 1

    Wow this is so sick! I'm working on our product ConveyThis. Will def give this a shot.

  8. 1

    I am learning to existing SaaS product and your post is an excellent guide. Loved it. Thanks for writing this.

  9. 1

    AI is here to stay. Practically every day I use ChatGPT. It became habit.

  10. 1

    Identify customer pain points: The first step is to identify customer pain points that can be addressed with AI. Look for areas where AI can help automate or improve existing processes, such as data analysis, customer service, or content recommendation.

    Choose the right AI technology: Once you've identified areas where AI can help, choose the right AI technology for your product. Consider factors such as the complexity of the problem you're trying to solve, the amount of data you have, and the level of accuracy required.

    Collect and label data: To train your AI model, you'll need to collect and label data. This can be a time-consuming process, but it's essential for building an accurate and effective model.

  11. 1

    This may be a bit off topic, but the why section got me thinking. And I've been thinking a lot recently about recent AI developments in terms of "how can I make this product more agentive?".

    Agent does not equal AI necessarily, but the recent batch of AI tools have certainly made it more popular & feasible to think about agentive tech.

    Agentive could mean a lot of things, but I'm specifically thinking about it in terms of "how can this tool do more of what it currently does without user interaction?". If the best UI is no UI, then the best UX is that the tool does what.

    Basic travel booking agent example (3 levels of agentive-ness(?))

    1. Agent finds flights, and notifies you about them. You go and book yourself.
    2. Agent finds flights, and notifies you about them. All you have to do is confirm whether it's allowed to purchase the flight on your behalf
    3. Agent finds flights, and notifies you that it purchased the flight on your behalf (maybe you allow it to do so if the deal is "really good")

    And you can adjust the dial for how agentive the tech is based on the type of tool you have, or even let users do this on an individual basis (e.g. John trusts the tool to transact up to $400 without any input, but Jill is okay with $1000)

  12. 1

    Wow, Thanks for sharing this article.

    It show how things can be done with ease.

  13. 1

    This is a fantastic and informative article, Kyle! Your explanation of how indie hackers can add generative AI to their SaaS products is clear and concise, making it easy for readers to follow along and implement the steps themselves. I appreciate how you emphasized the value of giving customers superpowers through the use of AI, and the endless possibilities it provides. Your inclusion of real-life examples and code snippets using ChatGPT and Dall-E make the article even more practical and accessible. Thank you for sharing your knowledge and insights with us!

  14. 1

    Thanks for the comprehensive guide. I'm curious if you have experience in passing large amounts of data to AI as a prompt. It's fairly easy to work with AI on small datasets, but when it comes to large massive, there should be a different approach. E.g. when you want to train ChatGPT on the data from a large spreadsheet so it could advise some values or find inconsistencies. Just wondering, if you tried anything like that.

  15. 1

    thanks for this well concise and helpful read

  16. 1

    To add a generative image with DALL-E, you can follow these steps:

    Access OpenAI's DALL-E 2 API, which allows you to generate images based on textual inputs.

    Choose a textual prompt that describes the image you want to generate. The prompt can be a sentence or a phrase that includes specific details such as colors, shapes, and objects.

    Submit the prompt to DALL-E 2 API, which will generate an image based on the textual input. The API uses a neural network to generate the image, which can take a few seconds or minutes, depending on the complexity of the prompt.

    Once the image is generated, you can download it from the API and use it in your project or application.

    It's important to note that DALL-E 2 API is currently in beta, and access is limited. You can apply for access on OpenAI's website and wait for an invitation to use the API. Additionally, the API has certain usage restrictions and guidelines, so make sure to read them carefully before using it.

  17. 1

    I am generally against this idea of absolutely wanting to integrate AI in all our projects. Today, we hear too much about AI and the world is somehow.. saturated. Everyone wants to use it either for good or bad or bad reasons. Of course, if the project itself justifies the use of AI, no problem. But trying to put AI where it is not needed seems (to me) to be a bad idea that will only harm the project in the long run.

    Unfortunately, it is also something understandable since a project based on AI has today more chance to work than one without AI. I've experienced this myself with two different projects and the results are clear.

  18. 1

    SaaS product can bring significant benefits to your customers by improving the overall user experience and providing more intelligent and personalized solutions. Here are some steps to consider when adding AI to your SaaS product:

    Define your use cases: Start by identifying areas where AI can be most effective in improving your product. You may want to consider customer support, predictive analytics, natural language processing, or other relevant areas.

    Choose the right AI technology: Determine which AI technology is best suited to your use cases. You can choose from a range of AI tools such as machine learning, deep learning, natural language processing, and computer vision.

    Gather data: To train your AI models, you'll need to gather data from your existing product, user behavior, and other relevant sources. Ensure that your data is clean, labeled, and sufficient to train your AI models effectively.

    Build your models: Use the data you've gathered to develop your AI models. This step involves data preprocessing, feature engineering, model selection, training, and validation.

    Integrate AI into your SaaS product: Once your AI models are built, you'll need to integrate them into your SaaS product. This may involve developing APIs, integrating with existing features, or building new ones.

    Test and evaluate: Before releasing your AI-enhanced SaaS product to your customers, be sure to test and evaluate the system to ensure that it's performing as expected. Gather feedback from early adopters and use this feedback to refine your product.

    Provide ongoing maintenance and support: AI models need ongoing maintenance and support to ensure that they remain accurate and effective. Be prepared to update your models as needed and provide ongoing support to your customers.

  19. 1

    Thanks for exploring this, Kyle! One thing that helped me with my SaaS and integration with ChatGPT was to find something that GPT or any large language models don't do well or better than other state of the art technology; then integrate that into your app or SaaS to layer on top of your product.

    For example, I build a powerful SEO and content analysis tool using state of the art embedding and vector search and then integrated it with ChatGPT to build a powerful SEO content and research tool.

    I've just opened it up to early users to start testing! I'd love to get anyone's feedback that's looking to boost their SEO and content!

    Here is a screenshot of the tool and you can sign up at my site:

    https://ousia.ai

    H8VrIMg.jpg

  20. 1

    Great post @kylegawley and thanks for including the code too - too many 'how tos' are omitting that bit. Nicely done.

    FWIW, I've added GPT to a boring business app - crisisdojo - to help give users industry-specific prompts for the kinds of risks and crises they might face. So this is a research and efficiency use-case rather than a creative one but immensely helpful. Not all the results are spot on (but neither are the results from an analyst). I'd estimate that this is a 50x speed increase with very little loss in quality. I'm excited to hook up GPT 4 and web-search apps next.

    And I think that the fear that this will wipe out entry level jobs is very real - I've basically replaced the need for an analyst with a dozen lines of code. (To be fair, I am the analyst right now...)

    Excellent discussion!

  21. 1

    Thanks for the tip. Been evaluating adding generative AI to Supademo (a platform for creating interactive product demos in < 5mins) but it's felt a little gimmicky.

    These examples are good inspirations to revisit it though!

  22. 1

    To add a generative image using Dall-E, you can follow these steps:

    Go to the Dall-E website and click on "Generate Images".
    Enter a text prompt in the text box. This prompt should describe the image you want Dall-E to generate. For example, you could enter "a red apple sitting on a table".
    Click on "Generate" to generate the image.
    Wait for the image to load. This can take a few seconds to a few minutes depending on the complexity of the image.
    Once the image is generated, you can download it by clicking on the "Download" button.

  23. 1

    I'm curious why your aigraphics attempt failed? There is a range of opportunity here, from ChatGPT integration to actual in-house AI training. Likely, most everyone here will start with ChatGPT AI integration, which boils down (at this point) to prompt engineering. Did your effort fail because the prompt engineering did not differentiate itself enough from similar attempts? I went to the site and I don't see a reason to it over against the actual engines (Dall-E, stable difussion, midjourney, etc). I think that's the point: how do we leverage AI in an arresting way? Maybe you can still massage your idea to be different enough to become valuable?

    1. 1

      For this reason – it's just a wrapper on Stable Diffusion. Also generative image is still very hard to get good results, ppl don't wanna spend hours prompt hacking

  24. 1

    That's very useful!

  25. 1

    Thanks for such great tips!!!

    1. 1

      The tips were really of great help!

  26. 1

    Perfect with necessary details....I recommend this blog for online business owners

  27. 1

    This is a great article. We added AI to Userdoc at the start of the year and our customers are loving the time-saving benefits. Requirements management isn't the sexiest thing, but with some AI fun it's getting up there!
    https://userdoc.fyi

  28. 1

    You can also use appgenius.ai to embed ChatGPT into your existing app without writing any code!

  29. 1

    Detailed and helpful post. AI definitely going to be part of all the major saas tools available in the market and it will make the whole thing better.

  30. 1

    Make sure to specify the token limit!

  31. 1

    Another easy way to add AI to your SAAS without the need for any installing code onto a server is to use one of the latest AI Chatbot plugins for WordPress. You can literally select your existing blog posts to train your own model, then configure the plugin's chatbox interface to answer visitor questions from your model.

    Here's a few cool ones' I'm currently looking at (just paste these plugin names into the "Search Plugins" box in your WP Dashboard under the Plugins menu):
    AI Engine
    AI ChatBot

    Some of them try to do too much - both AI blog post generation + visitor chat - which seems cool, but for now, I think just implementing visitor chat experience would be a game changer compared to my current chatbot.

  32. 1

    Great post! We recently added AI Insights to Zigpoll: https://www.zigpoll.com and I think it's going to be a game changer. Being able to distill down loads of data into a (most of the time) meaningful and actionable insight is an insane new development and, with a touch of creativity, can and should be integrated into a lot of existing products. It's rare that something so hyped actually delivers imo...

  33. 1

    Good post! particularly liked this 'give your customers superpowers'.. I think it's always been our main job.. to make them superheros, and now is kind of more doable than ever.

    I'm experiencing this myself with one AI-based product I'm making and already testing the generated output with some early adopters, based on their surprise when seeing the results.. they really seem like if they may be gaining kind 'of superpowers..'. I also think the ultimate differentiators will be offering a truly great product experience, and being creative with how you concatenate several AI tools that are available for anyone, in a way that's unique and solve your customers problems with just a couple of clicks (and you are fast to put it out there, bc most probably it'll be pretty easy for your competitors to also build/offer them - and most probably they're thinking about it at the same time that you are).

    Btw, https://aigraphics.io/ looks cool! we just kicked off the building a product kind of similar to it w our agency. It will be interesting to see how the 'photo-stock' platforms and the likes' industry evolves in this new era..

    1. 1

      maybe even better if there are no couple of clicks in the middle..

  34. 1

    Everyone overestimates the difficulty of implementing AI in their enterprises. It needs just a little time but a lot of data.. thanks for this post.

  35. 1

    Our just use : https://www.chabotix.com. A no code chatbot that you can add it to your website directly. It answers questions from your users by using your document and ChatGPT!

    1. 1

      now 21 sign up in 5 days.

  36. 1

    Thanks, I had no idea on how to begin with this, you gave me a starting point.

  37. 1

    I have been how to use AI to do something interesting to help their own websites, blogs, landing pages, custom chatbots to help l answer any questions from visitors. GPTBASE_ai The feedback so far is ok, but there are many shortcomings to keep improving.

  38. 0

    Wow, that's amazing that you were able to rank #1 on Google within two weeks with a new domain and without any backlinks! Your process for finding easy-to-rank keywords seems really effective and straightforward. It's great that you focused on addressing weaknesses in the top search results and creating content that meets the searcher's needs. Thanks for sharing your step-by-step guide on finding easy-to-rank keywords - I'm definitely going to give it a try for my own website!

  39. 1

    This comment was deleted a year ago.

Trending on Indie Hackers
Passed $7k 💵 in a month with my boring directory of job boards 35 comments Reaching $100k MRR Organically in 12 months 29 comments 87.7% of entrepreneurs struggle with at least one mental health issue 14 comments How to Secure #1 on Product Hunt: DO’s and DON'Ts / Experience from PitchBob – AI Pitch Deck Generator & Founders Co-Pilot 11 comments Competing with a substitute? 📌 Here are 4 ad examples you can use [from TOP to BOTTOM of funnel] 10 comments Are you wondering how to gain subscribers to a founder's X account from scratch? 9 comments