Chatgpt in terminal using ai.py

discovered while surfing. maybe it is useful for someone

4 Likes

Thanks a lot @swh
I am interested in AI and ChatGPT.
Are you using it?
How does it differ from the online AI chatbots?
Can I just use it as an end user? I will highly appreciate if you can guide me.
P.S: I am just a user not a techie. I visited the link. It seems to be for developers or techies (which is not me in any way)!

1 Like

hey @limotux sorry no, i discovered it while surfing. i don’t use it myself.but i think you need to put your specs here ~/.ai_py_config.json¸.

Same here :wink:

1 Like

Let us hope someone experienced can give us a hint how to use it.
Thanks for your reply.

1 Like

Hey @limotux maybe this article is useful. Written in english.

1 Like

Great. For me the other page was not in English for me!
I according to the link you sent I just did

sudo curl https://raw.githubusercontent.com/reorx/ai.py/master/ai.py -o /usr/local/bin/ai && chmod +x /usr/local/bin/ai

It needs sudo or it won’t do it.
I will keep you posted.

1 Like

glad it works for you now

I tried creating an account to get API key, but they didn’t like my country and said

OpenAI’s services are not available in your country. :rage:

Sorry, I missed something I got while doing curl

[limo@asus ~]$ sudo curl https://raw.githubusercontent.com/reorx/ai.py/master/ai.py -o /usr/local/bin/ai && chmod +x /usr/local/bin/ai
[sudo] password for limo: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12303  100 12303    0     0  27554      0 --:--:-- --:--:-- --:--:-- 27585
chmod: changing permissions of '/usr/local/bin/ai': Operation not permitted

chmod: changing permissions of ‘/usr/local/bin/ai’: Operation not permitted

1 Like

Did you use sudo with chmod?

1 Like

I did the command as on the web site:

sudo curl https://raw.githubusercontent.com/reorx/ai.py/master/ai.py -o /usr/local/bin/ai && chmod +x /usr/local/bin/ai

The first sudo isn’t enough?

Break it up run the curl command first.

sudo curl https://raw.githubusercontent.com/reorx/ai.py/master/ai.py -o /usr/local/bin/ai

Then the chmod command.

sudo chmod +x /usr/local/bin/ai

Thank you for your reply.
Please allow me to do it later. I am a bit busy now. And I do not really know what to do even after I execute the command!

nice, seems to work pretty good.

1 Like

Great news @svepp ! I believe ChatGPT is really interesting and important.
Sorry for not being that techie, I will appreciate if you send a step by step commands to install, configure and use it.

As @s4ndm4n said I did:

[limo@asus ~]$ sudo curl https://raw.githubusercontent.com/reorx/ai.py/master/ai.py -o /usr/local/bin/ai
[sudo] password for limo: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 17915  100 17915    0     0  39936      0 --:--:-- --:--:-- --:--:-- 39988
[limo@asus ~]$ 

Then

[limo@asus ~]$ sudo chmod +x /usr/local/bin/ai
[limo@asus ~]$ 

But I got

[limo@asus ~]$ ai
ERROR: missing API key
Please set the environment variable AI_PY_API_KEY or set api_key in /home/limo/.config/ai-py/config.json
[limo@asus ~]$ 

At https://platform.openai.com/account/api-keys
I get

OpenAI's services are not available in your country.

What should I do next?

1 Like

hi limotux, if you are logged in go to this: https://platform.openai.com/docs/api-reference/making-requests

In the top right you should see a menu under ‘Personal’
go to view API keys
then generate an API key
then put your API key in the config.json file which you make in the folder /home/.config/ai-py/config.json
The contents of the json file is just as follows
{“api_key”:“YOUR_API_KEY”}

1 Like

Sorry I was a bit slow editing my previous post!
I tried a few proxies but it seems it is really smart to detect it!

1 Like

This is the home page: https://platform.openai.com/

1 Like

oh sorry, I didn’t see,
" OpenAI's services are not available in your country."

I guess you need to use a vpn to get an API key. I don’t see a way around that I’m afraid.

1 Like

I will try again!
Thank you @svepp