# prefai

> A client library for interacting with the Pref.ai API.

Latest version **0.0.5** (published 2023-06-29) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-06-29 |
| First published | 2023-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Bobby Jaros |
| Maintainers | bobby-prefai |
| Keywords | fastapi, client |

## Links

- npm: https://www.npmjs.com/package/prefai
- npm.io page: https://npm.io/package/prefai

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.24.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2023-06-29
- 0.0.4 — 2023-06-10
- 0.0.3 — 2023-06-07
- 0.0.2 — 2023-06-05
- 0.0.1 — 2023-06-01

## README

# PrefAI Node.js Library

The PrefAI Node.js Library enables applications coded in node.js to interface with the PrefAI API.

It is not recommended to use this on a web client, as it would leak your API key.

## Installation

Install with:

```bash
npm install prefai
```

## Usage

The library needs an API key, which you get on your [pref.ai developer account](https://pref.ai/dev/account/keys).

```bash
export PREFAI_API_KEY=<YOUR_SECRET_KEY>
```

We can now add a user record like this:

```js
const PrefAI = require('prefai');

const apiKey = process.env.PREFAI_API_KEY;
const prefaiClient = new PrefAI(apiKey);

// Add record
prefaiClient.addRecord({
  user_email: "test@pref.ai",
  user_action: "What's a spicy appetizer you'd recommend for a BBQ with 6 people?",
});
```

For more information and next steps, read the [quickstart](https://pref.ai/dev/docs/quickstart).

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