Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bing-chat

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bing-chat

Node.js client for the unofficial Bing Chat API.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
decreased by-48.28%
Maintainers
1
Weekly downloads
 
Created
Source

Bing Chat API

Node.js client for the unofficial Bing Chat API.

NPM Build Status MIT License Prettier Code Formatting

(30s conversation demo)

Intro

This package is a Node.js wrapper around Bing Chat by Microsoft. TS batteries included. ✨

Warning This package is a reverse-engineered hack. I do not expect it to continue working long-term, and it is not meant for use in production. I'm building this in public, and you can follow the progress on Twitter @transitive_bs.

Install

npm install bing-chat

Make sure you're using node >= 18 so fetch is available.

Usage

You need access to Bing Chat OR a valid cookie from someone who has access. The cookie you need is the _U cookie (or just all of the cookies concatenated together; both will work).

import { BingChat } from 'bing-chat'

async function example() {
  const api = new BingChat({
    cookie: process.env.BING_COOKIE
  })

  const res = await api.sendMessage('Hello World!')
  console.log(res.text)
}

You can follow-up messages to continue the conversation. See demos/demo-conversation.ts for an example.

Note that Bing Chat conversations expire after about 20 minutes, so they're not meant to be long-term objects.

You can add streaming via the onProgress handler:

const res = await api.sendMessage('Write a 500 word essay on frogs.', {
  // print the partial response as the AI is "typing"
  onProgress: (partialResponse) => console.log(partialResponse.text)
})

// print the full text at the end
console.log(res.text)

See demos/demo-on-progress.ts for a full example of streaming support.

Projects

If you create a cool integration, feel free to open a PR and add it to the list.

Compatibility

  • This package is ESM-only.
  • This package supports node >= 18.
  • This module assumes that fetch is installed globally.
  • If you want to build a website using bing-chat, we recommend using it only from your backend API
  • chatgpt - Node.js client for the unofficial ChatGPT API. Same author as this package, and a very similar API format.

License

MIT © Travis Fischer

If you found this project interesting, please consider sponsoring me or following me on twitter twitter

Keywords

FAQs

Package last updated on 09 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc