EdgeGPT is a free and open-source software that you can use to access Bing AI Chat from the command line. This open-source project is basically based on the private API of Bing Chat so that you can access the AI chat from the command line and interact with the Bing bot. Not only that but this EdgeGPT can also help to generate images using Dall-E AI that Bing uses internally.
Bing launched the AI chat bot few months ago after Microsoft became the major shareholder in the OpenAI. They have now integrated ChatGPT into Bing to refine search results and also offering an AI image generator. The thing is that you now have to keep the Bing website or sidebar open in order to ask something and generate images. But if you use command line stuff a lot then you can now simply use EdgeGPT.
EdgeGPT only needs to be authorized via your credentials in the form of cookies that I will talk about later. Once you do the authentication part then it would be really easy to get the AI generated answers from Bing right on the terminal or the command line. EdgeGPT is made in Python and thus, you can use it on Mac. Windows, and Linux.
How to use Bing AI Chat from Command Line with Image Creator?
Here is the step by guide to use install and set up EdgeGPT.
- Open command prompt or terminal after making sure that Python is installed.
- Run this command to install EdgeGPT:
pip install EdgeGPT --upgrade
- After successful installation, you need cookies from the Bing AI Chat.
- So, log into Bing Chat and then install this Cookie-Editor Chrome extension.
- On Bing Chat website, you need to activate the extension and then export the cookies. It will save those cookies on the clipboard, but you need to save them in a file, sat “cookies.json”.
If you followed the above steps correctly, then you must have the correct EdgeGPT installation. If you are on Windows, then you can run the following command to test it. If the CLI guide shows up, then it means it installed correctly.
Now, make sure the file “cookies.json” that you saved is in the current directory where the terminal and command prompt is. Use the following command to send a text prompt to the AI chat and retrieve the answer. See the syntax and the example commands. You can modify the prompt as you like.
edge-gpt.exe --cookie-file Cookie_File --prompt Text_Prompt
edge-gpt.exe --cookie-file cookies.json --prompt "what happens in the space if we remove the helmet"
In the same way, you can use EdgeGPT to generate AI images. The syntax is similar, but it uses the different tool. So, see the syntax and example for generating AI images below. It will generate 4 images and will save then in the folder name that you specify in the command.
edge-gpt-image.exe --cookie-file Cookie_File --prompt Text_Prompt --output-dir Output_Folder --quiet --asyncio
edge-gpt-image.exe --cookie-file cookies.json --prompt "a pink colored horse with a mystical wizard" --output-dir "./new" --quiet --asyncio
You can now keep using EdgeGPT in this way to play with Bing AI chat right from your command line. Here I have used Windows for the reference, but you can follow the same steps on macOS and Linux.
If you were wondering whether you could use the Bing AI Chat in a faster way, then you can now have one via EdgeGPT. Just follow the tutorial above to set it up and then talk to Bang’s ChatGPT from your command line. You just have to take care of the cookies because they expire after some time. So, if you start getting the errors then you can just again export the cookies from the Bing Chat website and update the cookies file.