An open API service indexing awesome lists of open source software.

https://github.com/rootstrap/chat-gpt-nodejs

NodeJS REST-API to interact with OpenAI
https://github.com/rootstrap/chat-gpt-nodejs

Last synced: 11 months ago
JSON representation

NodeJS REST-API to interact with OpenAI

Awesome Lists containing this project

README

          

# ChatGPT NodeJS .TS Api

This project includes the boilerplate to interact with ChatGPT from a basic rest-api made in Node.js with Express + Typescript.

## Basic Requirements

1. Install Node.js [https://nodejs.org/en/download/](https://nodejs.org/en/download/)
2. Install `TypeScript`

```sh
npm install -g typescript
```

3. Install required dependencies

```sh
npm install
```

4. Get an OpenAI API key: [https://beta.openai.com/signup/](https://beta.openai.com/signup/)
5. Update your `.env` file with your API_KEY

## Build and Run

To build js from typescript source.

```sh
npm run build
```

To start the server from the compiled folder (/dist).

```sh
npm run start
```

## Demo

![Demo](run.gif)