A beginner's guide to creating a ChatGPT plugin

Updated 2 years ago on June 30, 2023

Creating a plugin for ChatGPT allows you to connect it to third-party applications, extending its capabilities and making it an even more powerful tool. In the next tutorial, we will go through the steps to create a plugin that will allow ChatGPT to intelligently access the API.

While the process of creating a ChatGPT plugin that provides intelligent API interaction may seem daunting, you will see that it is a very rewarding journey. With this guide, you will be able to create a plugin that will enhance ChatGPT's capabilities, enable it to capture real-time data, extract knowledge-based information, and help users with a variety of tasks.

How to create a ChatGPT plugin

The beauty of OpenAI plugins is that they act as a bridge that connects ChatGPT to a variety of developer-defined applications. These plug-ins allow ChatGPT to perform a number of actions:

  • Get real-time data such as sports scores, stock quotes or the latest news.
  • Extract knowledge-based information, including company documents and personal notes.
  • Help users with tasks such as booking airline tickets or ordering food.

Although plugin development is in the beta testing phase and developer access may not be open to everyone, joining the waiting list may be your pass to this exciting world. Throughout the beta period, there will be an ongoing iterative process involving users and developers to improve the plugin system.

A good starting point for understanding plugins is the quickstart repository, which you can navigate as you study the documentation.

Plugin developers must provide one or more API endpoints, as well as a standardized manifest file and an OpenAPI specification. These elements define the functionality of the plugin and provide ChatGPT with the means to consume files and call the API.

With an API specification and a natural language description of when to use the API, an artificial intelligence model can proactively call the API to perform actions. This is like having an intelligent program call an API. For example, if a user wants to know where is the best place to stay in Paris, the model can call the hotel booking plugin API, receive the API response, and formulate a user-friendly answer using the API data and its natural language.

Over time, the system will evolve to meet more complex requirements.

Plugin Flow

When creating a plugin, understanding the end-to-end process is very important. The following is a simplified guide to this process:

1. Creating a manifest file

You need to create a manifest file and place it at yourdomain.com/.well-known/ai-plugin.json. This file contains metadata about your plugin, including the name, logo, required authentication information, and the OpenAPI specification for the endpoints you want to display.

The model will use OpenAPI description fields, providing natural language descriptions of the various fields. It is recommended to initially only expose 1-2 endpoints with a minimum number of parameters so that the text length is acceptable. This is because the plugin description, API requests and API responses are inserted into the ChatGPT conversation and are taken into account when determining the context limit of the model.

2. Registering your plug-in

Once the manifest file is ready, you can register your plugin in the ChatGPT user interface. To do this, select the plugin model from the top drop-down list, then go to "Plugins", "Plugin Store" and finally "Develop your plugin". If your plugin requires authentication, you need to specify OAuth 2 client_id and client_secret or an API key.

3. Activating your plug-in

Users must manually activate your plugin in the ChatGPT user interface; it will not be used by default. You can share your plugin with up to 100 other users (unverified plugins can only be installed by other developers). If OAuth is required, users will be redirected through OAuth to log in to your plugin.

4. Starting a conversation

When your plugin is activated, OpenAI will put a compact description of your plugin in a ChatGPT message that will be invisible to end users. This description will contain information about the plugin, endpoints, and examples.

When a user asks a relevant question, the model can choose to call the API from your plugin if it deems it appropriate. POST requests require a user confirmation flow to avoid destructive actions.

The model then includes the results of the API calls in its response to the user. The response may also include links resulting from the API calls. These links will be displayed as rich previews, pulling in the site_name, title, description, image and URL fields via the OpenGraph protocol.

In addition, the model can format the data from your API as markdown, and the ChatGPT UI will display the markdown automatically.

Notably, the user's country and state will be passed in the plugin interaction header, e.g. {"openai-subdivision-1-iso-code": "US-CA"} for a user from California. This is especially useful for plugins related to shopping, restaurants, weather, etc.

Remember that the system is evolving, and over time we anticipate it will support even more complex use cases. So don't delay. Start this exciting plugin development journey today and contribute to the growing ChatGPT plugin ecosystem. For more information on how to get started building your first ChatGPT API, head over to the official OpenAI documentation.

Let's get in touch!

Please feel free to send us a message through the contact form.

Drop us a line at mailrequest@nosota.com / Give us a call over skypenosota.skype