Create a ChatGPT Plugin from Scratch | Step-by-Step Tutorial

ChatGPT plug-ins are here! One of the newest features available with GPT-4, plugins effectively allow you to get out to the internet to retrieve real-time information from the provider. Plugins are currently available for a handful of companies like Expedia, Kayak or Wolfram, but even more exciting is that you can create your own! And that’s the focus of this video.

In this hands-on tutorial, I’ll walk you step-by-step through how to create a ChatGPT plugin from scratch (but with code provided if you’d like it). Using Replit, we’ll create a Flask API that retrieves stock information from an external API (Alpha Vantage). Then we’ll test it locally before deploying it to a public endpoint (also hosted in Replit). Finally, we’ll install the plugin from the ChatGPT interface and see it in action.

Links referenced in this video:
? Code in GitHub: https://github.com/tinytechnicaltutorials/chatgptplugins.git
? Alpha Vantage API for stock information: https://www.alphavantage.co/documentation
? Replit for an IDE and hosting: www.replit.com
? OpenAI documentation for plugins: https://platform.openai.com/docs/plugins
? Waitlist for ChatGPT plugin developer access: https://openai.com/waitlist/plugins

00:00 – Previewing the ChatGPT plugins we’ll build together from scratch
01:11 – Getting on the OpenAI waitlist for ChatGPT plugin development
02:20 – What exactly is a ChatGPT plugin? The three components.
03:03 – Overviewing the Python/Flask app we’ll build to retrieve stock information
03:48 – Getting a free API key for Alpha Vantage
04:23 – Setting up an IDE and web host (I’m using Replit)
05:28 – Getting started with replit.com and a Repl project for our plugin
06:00 – Importing or cloning a GitHub repo into a Replit Repl
06:35 – Reviewing the Flask API code in main.py
10:10 – Reviewing the ai-plugin.json code
11:00 – Reviewing the openapi.yaml file
12:10 – Testing our Flask API locally in Replit
14:22 – Starting the deployment of our API to a public endpoint through Replit
14:45 – Pricing for hosting in Replit
15:26 – Updating the domain name in the manifest (ai-plugin.json) and OpenAPI spec (openapi.yaml)
17:00 – Doing the actual deployment with Replit and testing it
17:57 – Installing our custom plugin from the ChatGPT interface
18:27 – Using “develop your own plugin” link and what to do if you don’t see it
19:57 – The moment of truth! Testing our custom ChatGPT plugin
20:43 – Reviewing next steps and the full documentation from OpenAI
21:17 – IMPORTANT! Shutting down the deployment/hosting subscription in Replit

 

Create a ChatGPT Plugin from Scratch – Step-by-Step Tutorial

Creating a plugin for ChatGPT allows your own API or service to be called directly from within the ChatGPT interface. Whether you’re building a productivity tool, a data lookup API, or a custom business utility, ChatGPT plugins unlock powerful interaction possibilities.

🔧 Prerequisites

Before you begin, make sure you have the following:

  • A publicly accessible HTTPS server (can use Ngrok during development).

  • An OpenAPI (Swagger) spec for your API.

  • A manifest.json file describing your plugin.

  • A verified domain (required for production).

  • A valid SSL certificate (Let’s Encrypt or any commercial CA).


🛠️ Step 1: Develop or Host an API

You need a working API that the plugin will call. Here’s an example using FastAPI (Python):

python
from fastapi import FastAPI

app = FastAPI()

@app.get("/weather")
def get_weather(city: str):
return {
"city": city,
"temperature": "20°C",
"forecast": "Cloudy with a chance of rain"
}

Run it locally and expose it using Ngrok for testing:

bash
ngrok http 8000

📜 Step 2: Create the OpenAPI Spec (openapi.yaml)

This file defines how ChatGPT understands your API:

yaml
openapi: 3.0.1
info:
title: Weather API
description: Get the current weather forecast by city.
version: '1.0.0'
servers:
- url: https://your-ngrok-url.ngrok.io
paths:
/weather:
get:
operationId: getWeather
summary: Get weather information
parameters:
- name: city
in: query
required: true
schema:
type: string
responses:
'200':
description: A weather response
content:
application/json:
schema:
type: object
properties:
city:
type: string
temperature:
type: string
forecast:
type: string

Save this as openapi.yaml and host it at a public HTTPS URL (e.g., https://yourdomain.com/.well-known/openapi.yaml).


📝 Step 3: Create the Plugin Manifest (ai-plugin.json)

This manifest describes your plugin to ChatGPT:

json
{
"schema_version": "v1",
"name_for_human": "Weather Info",
"name_for_model": "weather",
"description_for_human": "Get real-time weather info by city name.",
"description_for_model": "Use this plugin to get current weather for a specified city.",
"auth": {
"type": "none"
},
"api": {
"type": "openapi",
"url": "https://yourdomain.com/.well-known/openapi.yaml"
},
"logo_url": "https://yourdomain.com/logo.png",
"contact_email": "support@yourdomain.com",
"legal_info_url": "https://yourdomain.com/legal"
}

Host this at:

arduino
https://yourdomain.com/.well-known/ai-plugin.json

🎨 Step 4: Add Branding Assets

Upload a small square logo (ideally 512×512 pixels) and place it at:

arduino
https://yourdomain.com/logo.png

Also include a privacy policy or legal info URL as referenced in the manifest.


🔍 Step 5: Test Locally via Plugin Developer Mode

  1. Visit ChatGPT Plugin Developer Mode.

  2. Go to Settings > Plugins > Plugin Store > Develop your own plugin.

  3. Enter the base domain of your plugin (e.g., https://yourdomain.com).

  4. ChatGPT will read your ai-plugin.json and OpenAPI spec.

  5. Start chatting with your plugin using natural language!


🔐 Optional: Add Authentication

For more complex use cases, modify the auth section in the ai-plugin.json:

json
"auth": {
"type": "oauth",
"client_url": "https://yourdomain.com/oauth",
"scope": "read:data",
"authorization_url": "https://yourdomain.com/oauth/authorize",
"token_url": "https://yourdomain.com/oauth/token"
}

Implement proper OAuth endpoints on your backend if you enable this.


🚀 Step 6: Go Live

Once tested, deploy your API and plugin files on your production server over HTTPS with a valid domain name. All URLs in your manifest and OpenAPI spec must match your production domain.

You may then submit your plugin to OpenAI’s plugin store if desired.


✅ Final Checklist

  • API is live and publicly accessible over HTTPS.

  • OpenAPI spec is correctly hosted.

  • ai-plugin.json is valid and references your OpenAPI URL.

  • All endpoints support CORS if required.

  • Branding files (logo, legal URLs) are accessible.

  • Successfully installed and tested in ChatGPT.


🧠 Pro Tip: Use Postman or Swagger Editor

Before integrating with ChatGPT, validate your OpenAPI spec with tools like:


Discover more from WIREDGORILLA

Subscribe to get the latest posts sent to your email.

Similar Posts