Closed CaiXunchao closed 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!
@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.
curl: (7) Failed to connect to api.openai.com port 443: Operation timed out Your request to Open AI API failed: