/newsimoji

A ChatGPT Plugin example powered by Cloudflare Workers

Primary LanguageTypeScript

Example ChatGPT Plugin for Cloudflare Workers

This is an example plugin showing how to build ChatGPT plugins using Cloudflare Workers. Using this example, you can deploy a plugin to Cloudflare Workers in just a few minutes.

The sample plugin allows ChatGPT users to search for repositories using GitHub's search API. The plugin is implemented in TypeScript and uses the OpenAPI specification to define the plugin's API.

Example conversation in ChatGPT showing the plugin in use

Get started

  1. Sign up for Cloudflare Workers. The free tier is more than enough for most use cases.
  2. Install wrangler, the Cloudflare Workers CLI
  3. Clone this project and install dependencies with npm install
  4. Run wrangler login to login to your Cloudflare account in wrangler
  5. Run wrangler deploy to publish the plugin to Cloudflare Workers

Usage

  1. You can configure the .well-known/ai-plugin.json route in index.ts.
  2. Update the OpenAPI schema in openapi.ts.
  3. You can set up any new routes and the associated OpenAPI schema by defining new routes. See search.ts for an example.

Deploying to OpenAI's API

Follow the instructions in the ChatGPT documentation to deploy your plugin and begin using it in ChatGPT.