# easygpt

> NPM module to communicate with the ChatGPT API

Latest version **1.6.2** (published 2023-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install easygpt
pnpm add easygpt
yarn add easygpt
bun add easygpt
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.6.2 |
| Published | 2023-03-26 |
| First published | 2023-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | Francesco Gruosso & Adam Govier |
| Maintainers | adamgovier, francesco_dev |
| Keywords | openai, chat, gpt, gpt3, gpt-3, gpt-3.5, gpt-3.5-turbo, gpt-4, chatbot, machine learning, conversational ai, chatgpt, ChatGPT wrapper, gpt-wrapper, gpt 3.5 turbo, chatgpt-wrapper, easygpt |

## Links

- npm: https://www.npmjs.com/package/easygpt
- Repository: https://github.com/FrancescoCoding/easyGPT
- Homepage: https://easygpt.dev
- Issues: https://github.com/FrancescoCoding/easyGPT/issues
- npm.io page: https://npm.io/package/easygpt

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.3.4
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.3

## Recent versions

- 1.6.2 (latest) — 2023-03-26
- 1.6.0 — 2023-03-16
- 1.5.0 — 2023-03-06
- 1.4.3 — 2023-03-06
- 1.4.2 — 2023-03-06
- 1.4.1 — 2023-03-05
- 1.4.0 — 2023-03-05
- 1.3.13 — 2023-03-05
- 1.3.12 — 2023-03-05
- 1.3.11 — 2023-03-05
- 1.3.1 — 2023-03-05
- 1.3.0 — 2023-03-05
- 1.2.9 — 2023-03-05
- 1.2.8 — 2023-03-05
- 1.2.7 — 2023-03-04
- … 22 more at https://npm.io/package/easygpt/versions

## README

# easyGPT: ChatGPT API wrapper 🤖

Generate human-like text effortlessly with easyGPT - the powerful ChatGPT API wrapper.

```javascript
import EasyGPT from "easygpt";
const gpt = new EasyGPT();

gpt
    .setApiKey("<YOUR API KEY HERE>")
    .addMessage("Hello ChatGPT!");
    .then(response => console.log(response))    
```

## Installation
Before installing make sure your Node.js version is at least v14.

[Your project must be running ES Modules](https://easygpt.dev/guide/getting-started.html#setup).

```
$ npm i easygpt
```

## Docs
* **In-Depth documentation can be found on [easygpt.dev](https://easygpt.dev/).**
* **[easyGPT Repository on GitHub](https://github.com/FrancescoCoding/easyGPT).**

## Quick Start

Import the package.

```javascript
import EasyGpt from "easygpt";
```

Create a new instance of EasyGpt.

```javascript
const gpt = new EasyGpt();
```

Set your API key.

```javascript
gpt.setApiKey("your API key goes here.");
```

Create one for free @ [https://platform.openai.com/account/api-keys](https://platform.openai.com/account/api-keys)

### Basic Example

```javascript
// Add a prompt you would like to say to ChatGPT.
gpt
  .addMessage("Hello ChatGPT!")
  // Give some instructions to the AI
  .addRule("Use emoticons in every answer and use a friendly tone.");

// Get the response from ChatGPT.
const response = await gpt.ask();

console.log(response.content);
```
#### Response
> Hello! How can I assist you today? 😊

### Multiple Messages Example

```javascript
gpt.addMessage("Hello ChatGPT! My name is Adam!");

let response = await gpt.ask();

console.log(response.content);

// Add an additional  message to the stack.
gpt.addMessage("What was my name again?");

response = await gpt.ask();

console.log(response.content);
```

#### Responses
> Hello Adam! It's nice to meet you. How can I assist you today?

> Your name is Adam.


## Further Examples

There is a long list of tested examples on our documentation site.


[easygpt.dev/guide/examples](http://easygpt.dev/guide/examples.html)

## Created By

Francesco Gruosso - [Github](https://github.com/FrancescoCoding) / [LinkedIn](https://www.linkedin.com/in/fran-dev/) / [Website](https://fran-dev.com/portfolio)

Adam Govier - [Github](https://github.com/AdamGovier) / [LinkedIn](https://www.linkedin.com/in/adam-govier/) / [Website](https://adamgovier.co.uk/)

---
_Source: https://npm.io/package/easygpt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
