ChatGPT-JS is a simple JavaScript application that interacts with the OpenAI GPT-3.5 API for text generation. It allows you to have conversations with the AI model through a Node.js script.
Follow these steps to set up and run the application:
Install the required dependencies using Yarn:
yarn install
Before running the application, you need to set up your OpenAI organization ID and API key as environment variables. This ensures secure handling of your credentials.
export OPENAI_ORG_ID=your_org_id
export OPENAI_API_KEY=your_api_key
You can get your organization id from here: https://platform.openai.com/account/org-settings. And your API key from here - https://platform.openai.com/account/api-keys
Alternatively, though not recommended, you can hardcode your organization ID and API key directly into the code.
Run the Node.js script to start interacting with ChatGPT:
node index.js
Upon running the application, you can engage in conversations with the AI model. Customize the interactions in the index.js
file according to your needs.
- Make sure you have Node.js installed on your machine before running the application. Always prioritize the secure handling of your API credentials.
This project is licensed under the GNU General Public License - see the LICENSE file for details.