Giter VIP home page Giter VIP logo

bing-chat's Introduction

Bing Chat API

Node.js client for the unofficial Bing Chat API. It's like ChatGPT on steroids ๐Ÿ”ฅ

NPM Build Status MIT License Prettier Code Formatting

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.

Demo

Example conversation (30s conversation demo)

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 from Bing 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

Credit

Related

  • chatgpt - Node.js client for the unofficial ChatGPT API. Same author as this package.
  • discord - Join our discord server for hackers building on top of ChatGPT / Bing / LLMs.

License

MIT ยฉ Travis Fischer

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

bing-chat's People

Contributors

transitive-bullshit avatar ericlewis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.