API Gateway can be helpful for ChatGPT plugin developers to expose, secure, manage, and monitor their API endpoints. This repo demonstrates how to use Apache APISIX API Gateway as a front door for communication between ChatGPT custom plugins and backend APIs.
As an example, in the ChatGPT user interface, if a user wants to obtain details about a speaker's sessions and topics using either the speaker's unique ID or name, the plugin is capable of establishing a connection with the plugin service. It then forwards the user's request to the API Gateway, which retrieves the necessary information from various API endpoints and consolidates the response into a unified context. See sample output below:
Assume that now you want to secure the Conference API, without API Gateway in place you can still secure the data exchange between ChatGPT UI and plugin by using Plugin Authentication methods from OpenAI. However, the communication between the plugin and your backend service still remains unsecured until you implement some cross-cutting concerns in Python code, instead of spending time on this: - We can implement security measures like authentication, authorization, and rate limiting with the API Gateway to protect the Conference API from unauthorized access and potential attacks. ChatGPT can talk to API Gateway freely but the communication between API Gateway and backend service can be absolutely secure.
- Before you start, it is good to have a basic understanding of APISIX. Familiarity with API gateway, and its key concepts such as routes, upstream, Admin API, plugins, and HTTP protocol will also be beneficial.
- Docker is used to install the containerized etcd and APISIX.
- Download Visual Studio Code compatible with your operating system, or use any other code editor like IntelliJ IDEA, PyCharm, etc.
- To develop custom ChatGPT Plugins you need to have a ChatGPT Plus account and join the plugins waitlist.
To start the project run simply the following command from the project root directory:
docker compose up
🙋 Join the Apache APISIX Community
Follow me on Twitter: @BoburUmurzokov
Visit my blog: www.iambobur.com