Practical Guide to Developing a ChatGPT Plugin: A Case Study of Sakenowa
Tags: chatgpt, sakenowa
Published: 2023-05-29 09:30:00

---
title: Practical Guide to Developing a ChatGPT Plugin: A Case Study of Sakenowa
date: '2023-05-29T18:30:00+0900'
tags: [chatgpt, sakenowa]
image: 'og-image.png'
published: true
---
We've just released the Sakenowa ChatGPT plugin. It's a plugin that utilizes data from [Sakenowa](https://sakenowa.com) to provide detailed information about different brands of Japanese sake and offer recommendations.

![Sakenowa on the plugin store](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bpywvp0240bgezyp3u7u.png)

This article shares the challenges, insights, and developer perspectives we encountered during the development of the ChatGPT plugin. We hope this can be of help to those planning to embark on their own development journey.

## Local Development

During development, it's okay to deploy the API server in your local environment.

In a production environment, ChatGPT's server communicates with the API server as follows:

![Production environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fw4dzxdlzraoicjmtb9y.png)

In a local environment, the browser communicates directly:

![Local environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehteri2kc8sad9bqvcyo.png)

Because the browser communicates with the API server from the ChatGPT page (`chat.openai.com`), it is necessary to set up CORS on the API server.

## Authentication

The authentication method for the API server is specified in the manifest file (`ai-plugin.json`). In the Sakenowa ChatGPT plugin, we used `service_http`. A pre-registered key is set as a `Bearer` token in the `Authorization` header, which you can confirm on the API side.

Example of an `Authorization` header:

```
Authorization: Bearer <API-KEY>
```

The key is registered during the plugin application process.

## Manifest File

The manifest file (`ai-plugin.json`) needs to be deployed as `/.well-known/ai-plugin.json` on the public server.

There are people who have compiled various plugin manifest files and API specification files: https://github.com/sisbell/chatgpt-plugin-store

As can be seen here, most plugins are accessible to anyone. However, as long as the plugin can be accessed from the ChatGPT server, it's sufficient, and access can be restricted. The range of IP addresses used by ChatGPT's server is listed in the ChatGPT plugin documentation.

According to ChatGPT's Plugin devtools, the `description_for_model` value in the manifest file is embedded directly into the prompt, so there's little point in hiding it. There's no guarantee that other parts of the manifest file won't be embedded in the future. You should only include information in the manifest file that you are willing to make public.

By the way, the part embedded in the prompt can be answered by asking ChatGPT. The Sakenowa ChatGPT plugin doesn't publicly release its manifest file, but ChatGPT can provide the information.

![description of the plugin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ruzqficu608gn3jww69w.png)

## API Specification File

According to ChatGPT Plugin devtools, the contents of the API specification file are converted to TypeScript and embedded into the prompt. For the Sakenowa ChatGPT plugin, the content is embedded as follows (slightly abbreviated):

```typescript
namespace sakenowa {
// Search brands by query
type search__brands = (_: {
// query string that will match with brand name. Can be Japanese name (Kanji or Hiragana), English name and also part of them.
brand?: string,
// search by area. It should be official Japanese prefecture numbers
area?: number[],
)} => any;
} // namespace sakenowa
```

While the return type is defined in the API specification file and should be an essential piece of information for selecting the optimal endpoint, it is set to `any` here. Even though array length limitations are specified in the API specification file, they don't appear here. However, the `description` values seem to be output as comments, so it may be beneficial to write information here.

This format suggests that information like the API server's URL won't be embedded in the prompt. But, as the future is uncertain, you need to treat it as potentially public. Also, access can be restricted to only ChatGPT's server by specifying an IP address range.

![API spec](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydsaljp5gq3tw6lft302.png)

## Going Public! How to Get Users?

As of May 29, 2023, the review process is stated to be completed within seven days after application. The Sakenowa ChatGPT plugin took exactly seven days.

After going public, we issued a press release. Typically, for a smartphone app, we would provide the store's URL for users to access it directly. However, the ChatGPT plugin store does not have a URL. Additionally, since there is no search function, users will need to locate the plugin from a list that spans approximately 20 pages. We anticipate improvements in this area soon.

## Re-verification

If you change the manifest file after the plugin has been approved and listed in the store, it will be removed from the store and re-verification will be required. From what I've heard, the current situation is as follows:

- Even if the plugin is removed from the store, users who are already using it can continue to do so.
- The time it takes for re-verification varies, sometimes it's three days, but other times it can take up to a week.

This issue is being discussed in OpenAI's forum, so I believe it will be improved eventually. However, for now, you need to understand that changing the manifest file after release is a challenging task.

## Conclusion

The official documentation for ChatGPT plugin development is well-written, so you're unlikely to struggle due to a lack of information. However, there are difficulties that developers may encounter, such as the re-verification process after going public.

In this article, I've shared knowledge and experience gained during the development of the Sakenowa ChatGPT plugin. I hope this can serve as a supplement to the official documentation, and prove useful for those about to develop a ChatGPT plugin.