0xacx / chatGPT-shell-cli

Simple shell script to use OpenAI's ChatGPT and DALL-E from the terminal. No Python or JS required.
https://gptshell.cc
MIT License
1.05k stars 150 forks source link

What's wrong? I have opened the VPN in global mode. #49

Closed CaiXunchao closed 1 year ago

CaiXunchao commented 1 year ago

curl: (7) Failed to connect to api.openai.com port 443: Operation timed out Your request to Open AI API failed:

0xacx commented 1 year ago

Seems like something is blocking your curl request. Do you have any firewall running? Or maybe the VPN needs additional config for certain ports? You can test if you can perform a single curl request first.

Try to curl the API from your terminal to see if you get a correct response. Just replace YOUR_TOKEN with your OpenAI token.

curl https://api.openai.com/v1/completions \
                -sS \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer YOUR_TOKEN" \
                -d '{
                        "model": "text-davinci-003",
                        "prompt": "How to make an HTTP request in javascript?",
                        "max_tokens": 1000,
                        "temperature": 0.7
        }'

If that works and you have set your OpenAI key correctly in your shell profile, the script should work. Lmk if that helps!

0xacx commented 1 year ago

@CaiXunchao I am closing this issue as it is a failure that is not caused by the script itself. I hope you figured it out.