Introduction to Node-ChatGPT-API Project
The Node-ChatGPT-API project is a versatile and powerful client implementation for interacting with ChatGPT and Bing's AI. Available as a Node.js module, a REST API server, and a CLI application, this project offers a broad range of functionalities for developers looking to integrate conversational AI capabilities into their applications.
Features
-
API Server: The project includes an API server, which also has Docker support, allowing it to be used in non-Node.js environments. This server facilitates communication with ChatGPT, making it accessible beyond typical Node.js applications.
-
Command Line Interface (CLI): Users can engage in chat sessions with ChatGPT directly from the command line. This feature provides a convenient way to interact with the AI without requiring a graphical interface, which is particularly useful for developers and automation scripts.
-
Node.js Clients: These clients can be easily integrated into any Node.js application, enabling developers to add conversational AI features seamlessly.
-
ChatGPTClient: This supports the official ChatGPT model,
gpt-3.5-turbo
, via OpenAI's API. It replicates chat threads from the official ChatGPT website and supports persistent conversations, storing chats in memory by default. Developers can customize system prompts and user names, allowing the creation of chatbots with tailored personalities. -
BingAIClient: Offers support for Bing's version of ChatGPT, powered by GPT-4. It includes a jailbreak mode, allowing unlimited messages and enabling an enhanced chat experience.
-
ChatGPTBrowserClient: Supports communication with the official ChatGPT website, utilizing a reverse proxy server to bypass Cloudflare restrictions. However, it comes with risks, such as potential account bans for continued automation.
Getting Started
To begin using the Node-ChatGPT-API, you need the following prerequisites:
- Node.js: Version 16.0.0 or higher is required to run the package.
- npm: For managing and installing dependencies.
- Docker: Optional, if you prefer to use the API server with Docker support.
- OpenAI API Key: Necessary for utilizing the ChatGPTClient.
Usage
To use the project as a module, you can install it via npm:
npm i @waylaidwanderer/chatgpt-api
The package includes several client implementations, such as ChatGPTClient
, BingAIClient
, and ChatGPTBrowserClient
, each serving different functionalities and use cases.
Setting Up the API Server
You can install the package globally and run the API server:
npm i -g @waylaidwanderer/chatgpt-api
chatgpt-api
The server's settings can be customized in a settings.js
file. This file allows you to configure cache options, client-specific settings, and API server options, among others.
For developers looking to implement chatting features in their applications, this project provides a robust and flexible solution, catering to various needs with its diverse set of clients and features. Whether you're building a simple chatbot or a complex AI-driven application, the Node-ChatGPT-API project offers the tools necessary to bring your vision to life.