A npm package of reverse-engineered Bing Image Creator API. Courtesy of Bing Image Search API and EdgeGPT by acheong08.
npm install bimg
Create a .env
file in the root directory of your project and add the cookie of your Bing Image Search session. You need access to Bing Image Creator or a valid cookie from someone who has access.
The cookie you need from Bing is the _U cookie, this could be aquired using a chrome-extension or by using the Network tab in Chrome DevTools.
BING_IMAGE_COOKIE: <your Bing Image Search cookie>
import { generateImageFiles, generateImagesLinks } from "bimg";
const imageLinks = await generateImagesLinks(prompt); // returns an array of 4 image links
const imageFiles = await generateImageFiles(prompt); // returns an array of 4 image files
The image file is a object of
{
name: string,
data: string // base64 encoded image data from Buffer
}
See my simple expressjs server here.