bing-chat:Bing新人工智能搜索的 Node.js 客户端


非官方 ChatGPT API 的 Node.js 客户端,这个包是微软 Bing Chat 的 Node.js 包装器。

安装:

npm install bing-chat

确保您使用的node >= 18是fetch可用的。

需要访问 Bing Chat 或具有访问权限的人提供的有效 cookie。
您需要的来自 Bing 的 cookie 就是_Ucookie(或者只是连接在一起的所有 cookie;两者都可以工作)。

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)
}

请参阅demos/demo-conversation.ts示例。

请注意,Bing Chat 对话会在大约 20 分钟后过期