# bingai-js

> BingAI API using javascript

Latest version **1.7.5** (published 2024-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install bingai-js
pnpm add bingai-js
yarn add bingai-js
bun add bingai-js
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.5 |
| Published | 2024-03-09 |
| First published | 2023-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.x |
| Dependencies | 6 |
| Unpacked size | 51.8 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Kuumoneko |
| Maintainers | kuumoneko |
| Keywords | Bing, ai |

## Links

- npm: https://www.npmjs.com/package/bingai-js
- Repository: https://github.com/kuumoneko/edgegpt-js
- Issues: https://github.com/kuumoneko/edgegpt-js/issues
- npm.io page: https://npm.io/package/bingai-js

## Dependencies (6)

- [ws](https://npm.io/package/ws.md) ^8.14.2
- [events](https://npm.io/package/events.md) ^3.3.0
- [undici](https://npm.io/package/undici.md) ^5.25.4
- [bingai-js](https://npm.io/package/bingai-js.md) ^1.7.5-rc1
- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2
- [@types/es6-promise](https://npm.io/package/@types/es6-promise.md) ^3.3.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.7.5 (latest) — 2024-03-09
- 1.7.5-rc6 — 2024-03-01
- 1.7.5-rc5 — 2024-02-29
- 1.7.5-rc4 — 2024-02-29
- 1.7.5-rc3 — 2024-02-29
- 1.7.5-rc2 — 2024-02-29
- 1.7.5-rc1 — 2024-02-27
- 1.7.4 — 2024-01-17
- 1.7.3 — 2024-01-17
- 1.7.2 — 2024-01-17
- 1.7.1 — 2024-01-13
- 1.7.0 — 2023-10-26
- 1.6.0 — 2023-10-22
- 1.5.0 — 2023-10-07
- 1.0.4 — 2023-09-20
- … 4 more at https://npm.io/package/bingai-js/versions

## README

# Bing AI API using node js

## Update v1.7.5-rc6:

> Support Typescript

# Install

```
npm i bingai-js@1.7.5.-rc6
or
npm i bingai-js
```

# Getting cookie

1. Go to https://bing.com/chat
2. Copy cookies value named `_U` by using cookie editor extensions

# Usage

```js
// if using ESM
import { ChatBot, conversation_style } from "bingai-js";
import promptSync from "prompt-sync";

// if using commonJS
const { ChatBot, conversation_style } = require("bingai-js/index.cjs");
const promptSync = require("prompt-sync");



const pr = promptSync();

const cookie = "Your-Cookie-U-here";

const a = new ChatBot(cookie);

async function test() {
  await a.init();
  var i = 0;
  await a.chatHub.init().then(async () => {
    while (true) {
      const prompt = pr("You: ");
      /**
       *   balanced : conversation_style.balanced
       *   creative : conversation_style.creative
       *   precise  : conversation_style.precise
       */
      const res = await a.ask(prompt, conversation_style.balanced, i);
      i++;
      console.log(`Bot: ${res}`);
    }
  });
}

test();
```

```shell
node index.js
```

# Contributors

<a href="https://github.com/kuumoneko/edgegpt-js/graphs/contributors">
  <img src="https://contrib.rocks/image?repo=kuumoneko/edgegpt-js" />
</a>

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