ChatGPT is everywhere, at least in many tech news articles. In the last we could see Microsoft sticking out chest for its relationship with OpenAI, to the point of calling its virtual assistant, Cortana, “stupid”, along with the rest, such as Siri or Google Assistant. The most innovative creation of the last few years is available in all kinds of applications and extensions that even appear in Visual Studio Code, and there is also chatgpt-cli to access the chat directly from the terminal.
Whether it is worth using chatgpt-cli or not should be up to each individual, but it can come in handy depending on what scenarios. For example, in the mentioned Visual Studio Code it is usual to have below a terminal, or rather an output with different types of information, among which is the terminal. If we use chatgpt-cli, we won't sacrifice anything on the screen that we aren't sacrificing in normal use, and its use here can be interesting. The bad thing is how it has to be launched, and as I write this I realize that I have not censored the key, so I am about to revoke it.
ChatGPT in terminal, made possible by chatgpt-cli
If it is going to be used a lot, I think it is advisable to create a script, or for each one to do it as they see fit, but first of all you have to write:
export API_KEY = here is the apikey that has been given on the official website chat gpt
We have to get the key out of platform.openai.com/account/api-keys, and you have to be registered to get it. Once the above has been written, logically substituting the value behind the equal, we can now write “chatgpt” in the terminal without the quotes and we will see a prompt that at first attracts a little attention. At the time of writing this article, Chinese letters appear, although in the project GitHub page has already been delivered change needed to display something in English.
Its use is the same as what we would do on the web page, but from the terminal. In the example I have asked him to write a text to greet our readers, and he has done that. The only limitation that I have found in the time that I have been playing with it has been the design, that being a command line tool there is no margin, but this is usually the case in many CLI-type tools.
To install it, on their GitHub page they say to write:
go get -u -x github.com/kkdai/chatgpt
On Arch Linux based systems it can be downloaded from the AUR. If you were looking for a more Linux-like way of talking with ChatGPT, here it is.