Best guide on how to build a product with OpenAI chatGPT / GPT-3 API

build a product with OpenAI GPT-3 - HarishGarg.com

In this article, I intend to help you get familiar with the process to build a product with OpenAI chatGPT / GPT-3.

Apart from using OpenAI’s no-code Playground tool to generate text with GPT-3, one can also build a product with OpenAI GPT-3 API.

However, before you spend a large amount of time building a product with OpenAI GPT-3 API, you should know a few things so that you can make the right decisions.

Coming up with Ideas to build a product with OpenAI chatGPT / GPT-3

You need to start with an idea. You are going to need the idea while applying for API access as well as when you are deciding what to build.

Few things that you need to keep in mind while coming up with an idea.

  • Are you planning to build a completely new product with OpenAI API, or are you planning to integrate it into an existing product?
  • Are you building it as a fun side project or a monetizable product?
  • If it’s a new product, have you identified the market or the problem space your product is going to provide a solution for?
  • Review your idea against the OpenAI Use Case Guidelines to make sure you don’t waste resources and time on building something that will never be approved by OpenAI for a Public release. Few things that are not allowed currently:
    • Direct posting of generated text on social media, for example, a Twitter bot that will post generated directly to Twitter without Human intervention.
    • Apps that intend to provide Medical Advice, Legal Advice
    • Apps that generate political output.
    • Apps that will replicate the OpenAI API or Open API Playground behavior for users who do not have their own API keys.

There are a few more use cases that are frowned upon and you should consult the Use Case Guidelines before deciding on what to build.

Check out the Ideas chapter for some inspiration for your product.

API access is mandatory to build a product with OpenAI chatGPT / GPT-3

Apply for API access to OpenAI as early as possible, even if your idea is at a very high level. As long as you follow OpenAI Guidelines, there is no compulsion for that idea in the Access application, and the actual implementation has to match 100%. OpenAI doesn’t need any of your market research also. So, get in your name on the waitlist as early as possible.

I cover how to apply for access in the Applying for OpenAI API access article.

GPT-3 API Prompt Engineering to build a product with OpenAI chatGPT / GPT-3

When you get access to OpenAI API, you also get access to their In-browser API Playground. It’s a No Code Browser-based tool that you can use to create and test out the prompts you give to OpenAI GPT-3 and the outputs you receive. For example, a prompt that would generate emails from a sentence would look like this in the Open API Playground.

gpt-3 playground - prompt example
gpt-3 playground – prompt example – harishgarg.com

The Bold part is a prompt that starts with an example and ends with a sentence for the email I wanted GPT-3 to generate. The email text at the end is what is generated by GPT-3.

You should start with designing your prompts in the playground and arriving at a prompt, and parameters combination that works for your idea. Once you start getting the desired output from the API, you can take this and implement it in your code. You can also export your prompt along with the code for python or CURL to use in your product or from the command line.

The usability of your end product is going to depend a lot on how you design your prompts and set the API parameters. Getting this right is one of the most important parts of properly using the OpenAI API in your product.

We will discuss how to do this in a further chapter.

Product Development

Now it’s time to take the prompts you have taken from the above step and build a product around them. A large part of creating an OpenAI API-enabled product will involve doing things similar to what you will do when you are building any other product with a few extra things that are required for building with OpenAI API. An OpenAI gpt-3 API enabled product should have, apart from the main feature that uses OpenAI API, the below features. These are all the same things that a typical SaaS product has and an OpenAI GPT-3 API-enabled application is no different.

  • User Access Management with usage limits
  • Payment Integration
  • Security measures against misuse of the app and the OpenAI API

Although OpenAI provides only the Python library as an official library for using the API in a product, the plain API calls with other languages also work as demonstrated by them with CURL. It is possible to build an OpenAI enabled using

  • Coding Tech Stacks are built around languages like Python, JavaScript, Ruby, and others.
  • Low Code stacks using serverless stacks like Vercel and Supabase
  • No Code Tools like Bubble and Webflow

However, there is one step that will impact your Product development decisions the most and that is explained in the next step.

OpenAI Approval before going Live

Update: OpenAI automatically approves most use cases now. However, there is certain use case still not allowed. And you no longer need to seek OpenAI approval for releasing your app if it follows the guidelines

As per OpenAI’s Terms and Conditions for allowing the use of their API, every product that uses OpenAI API needs to be reviewed by the OpenAI Team before it goes live. This is applicable even for adding a new feature to an already approved app or product. It’s a bit like the Approval process for Apple App Store but the difference here is OpenAI doesn’t host your apps. You are free to host them wherever you want. Also, approval is not required for in-house testing of the app during the development and testing phase. However, you should keep your users limited to 5 during this phase or request approval from OpenAI.

To request approval for your app, you need to visit and fill the online form – https://share.hsforms.com/1u1CnLpx3TGqjJbe5k76UpA4sk30

Apart from your company and product information, these are some of the details you need to submit. These are also the same things that you would have to take care of while designing and building your app.

  • What is the maximum input you are going to allow the users to use your application? For example, if you are building an email generator and are asking users to input a sentence or two describing what that email should be about, you would have to limit the Number of Chars in the input form. This is done because OpenAI is going to charge you for every API call based on the number of tokens in the API call. 4 chars equal 1 token. This is to protect your API Keys from misuse by unscrupulous users.
  • What is the maximum output you are expecting from OpenAI?
  • You would have to authenticate your users before letting them use features that call OpenAI API
  • Making your app paid is better for approval. You can offer Free limited trials.
  • You need to enforce rate-limiting in your app per user to avoid abuse.
  • You need to implement some sort of content filtration while taking user input.
  • You need to provide for users to flag or report unpleasant or low-quality outputs from your app
  • You need to have a way to monitor the usage of the app by your users and identify any spikes by particular users or for particular keywords.
  • Your App should clearly say the output was generated by an AI
  • Your app should avoid sharing output through automated ways by requiring a Human in the loop.

Security Considerations while building a product with OpenAI chatGPT / GPT-3.

You also need to take care of some security considerations while planning to build a product with OpenAI GPT-3 API. One recent example is the GPT-3 prompt injection attack.