Creating Your First Chat GPT Plugin: A Step-by-Step Guide

A chat GPT plugin is a third-party extension that enhances OpenAI's chat GPT by expanding its functionality, enabling the integration of real-time data and external information. In this guide, we'll walk you through creating your first chat GPT plugin, from understanding the role of chat GPT plugins in the AI ecosystem to deploying one.

Preparations

Signing Up for the Waitlist

If you don't have developer's access already, sign up for the ChatGPT plugin waitlist. You can find the plugins waitlist under OpenAI.com/waitlist/plugins. As part of the application process, you'll be asked to complete a form detailing your intentions for the project. Make sure you have a functional API ready to facilitate the smooth operation of your plugin.

Setting up Git and Vercel

Start a new Git project and sign up for a Vercel account. We'll use Vercel for deployment. You can get a free trial account for your plugin on Vercel.com.

Diving into the Code with a Hello World Example

To make things easier, we've prepared a Hello World example that is available on GitHub: Hello World Example.

We're going to use Python as our language of choice for this guide. Taking a closer look at the project structure, you'll find a set of auxiliary files and the API directory:

Main Python Program

Our Python program is a web server built using Flask. The main.py file in the API subdirectory handles all Flask routes of the plugin. The /hello_world route handles GET requests and is the main part of our example. Currently, it returns JSON data containing the key response with the value hello world.

openai.yaml File

The openai.yaml file houses the API definition, which serves as a crucial blueprint guiding the behavior of your chat GPT plugin. It should include comprehensive descriptions of each API call, clearly delineating what each function achieves, as well as its limitations. This document is written in YAML format.

The ai-plugin.json File

This file serves as a metadata repository for your plugin, containing key details such as the description which will appear in the OpenAI plugin store. Be mindful of the following criteria when crafting this description: Keep it short, with a maximum of 122 characters. Avoid using the terms chat GPT, plugin, or OpenAI. Maintain consistent and correct punctuation throughout the description.

Deploying Your Plugin

Now, it's time to deploy your plugin. Firstly, log into your Vercel account. Follow these detailed steps to successfully deploy your ChatGPT plugin:

  1. Log into your Vercel Account: Access your Vercel account. If you don't have one, create a free account on Vercel.com.

  2. Navigate to Overview Page: Once you're logged in, navigate to the overview page.

  3. Add New Plugin: Click on "Add New" to begin the process of adding your freshly created plugin.

  4. Select Git Repository: You'll be prompted to select the Git repository for the plugin you wish to deploy. If your repository isn't appearing as an option, revisit and adjust the repository's permissions. You can choose to grant Vercel access either to specific Git repositories of your choice or to all your Git repositories.

  5. Name Your Project: Assign a unique and appropriate name to your project.

  6. Deploy: Hit the "Deploy" button. If everything is set up correctly, you'll be taken to a screen that may display a "Not Found" message. Don't worry - this simply means that we haven't defined a route for the domain's home, which is not necessary for the functioning of the plugin.

At this point, your plugin will show up under your projects in the dashboard.

  1. Find URL under Domains: Under "Domains," you will find a URL. Copy this domain.

  2. Update URL in Files: Replace the existing URLs in Openapi.yaml and aiplugin.json with the copied domain.

  3. Commit Changes and Push: After updating the URLs, commit your changes and push them to the Git repository.

Integrating Your Plugin with Chat GPT

Now that your plugin has been deployed, the next step is to integrate it with Chat GPT and start exploring its capabilities. Follow these steps to do so:

  1. Add Your Own Plugin: To add your plugin, select the plugins model and open the plugin store. At the bottom, click on "Develop Your Own Plugin."

  2. Paste Deployment URL: Paste the deployment URL from Vercel here and press "Find Manifest File" once done.

You should now see a message featuring your plugin's description and logo. If you encounter an error message stating "Could not find the plugin's manifest," this could indicate an incorrect route. Verify all routes in your main.py file to confirm that Chat GPT has the necessary access to your plugin's manifest.

Once you see the success message, you have successfully integrated your plugin with Chat GPT and it is ready for testing.

Testing and Submission

Once your plugin is live, test it to ensure everything works as expected. Once you've confirmed everything is working fine, you can go ahead with submitting your plugin for review. This can be done in the 'Develop your own plugins' section of the plugin store. After a successful review, the plugin will be publicly available on the chat GPT plugin store.

Congratulations on creating and deploying your first Chat GPT plugin! If you enjoyed this guide and want to hear more about cool tech stuff, make sure to stick around and follow us. We would love to see you back and maybe also trying out one of our chat GPT plugins.