This is a nodeJS terminal project that implements OpenAI's new GPT-4 turbo model, their most powerful GPT model, and allows users to interface with it in a terminal.
This project uses the openai package version 3.2.1 to connect to your OpenAI account and use their gpt-4-1106-preview model to generate responses to user inputs. The application runs in the terminal, allowing for an easy-to-use interface for users to chat with the AI.
I've implemented proper streaming, so you don't have to wait for the API response before seeing a reply. This is crucial, especially in larger responses.
To get started with this project, follow these steps:
-
Clone this repository
$ git clone https://github.com/JDLegaspi/ChatGPT-Terminal.git -
Install dependencies recursively
$ pnpm i -r -
Set up OpenAI API key in relevant packages
Create an account with OpenAI and obtain your API key. Then, create.envfiles in the following directories of your project and add the following line with your API key:OPEN_AI_API_KEY=[open_ai_api_key]:terminal-chat/
-
Run the application
To start the terminal service:pnpm start:terminal -
Send a message To send a message to GPT, end your message with
;;.
openai: Used for connecting to OpenAI API and sending requests.readline: Used for terminal prompt input.