connect ETIMEDOUT when using API key integration
yibuxulong opened this issue · 6 comments
I enjoyed vscode-chatgpt for a week, but since March. 1st, I met a connection problem once I ask questions, there return:
request to https://api.openai.com/v1/chat/completions failed, reason: connect ETIMEDOUT 199.59.149.205:443
and in the https://api.openai.com/v1/chat/completions, I found:
{ "error": { "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.", "type": "invalid_request_error", "param": null, "code": null } }
but I had provided an API key:
I have tried to uninstall vscode-chatgpt and re-install it many times, and applied new API codes, reopen the vscode, but none of them helped.
Could anybody give me some advice?
@yibuxulong thank you for using the extension. Could you try resetting your session ChatGPT: Reset session
?
2nd troubleshooting:
Please place the same api token in the following CURL command (replace $OPENAI_API_KEY
) and see if you get a proper response:
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "text-davinci-003",
"prompt": "Can I make a request?\n\n",
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0
}'
thanks for your replying! @gencay
I found out that may be because the chatgpt is also locked to the Chinese port in the API as that in the website, which was not the case a week ago. I have restored normal use by switching the port. I hope it can help other users.
Thank you again for your work and time.
@gencay @yibuxulong How to solve it
@laterdayi Switching system proxy with VPN worked for me.
hello, i get a ECONNRESET
if not vpn, but using vpn will return Client network socket disconnected before secure TLS connection was established
, what could i do?
ok, i deal with it... if someone has the same problem, then go on:
as we know, if you are in china mainland or somewhere, the openai api could be visited some days before, and i used this extension well. but recently the api is blocked by GFW, if use it directly will return somthing like request to https://api.openai.com/v1/chat/completions failed, reason: connect ETIMEDOUT 157.240.12.35:443
at first i just switched on my clash, but that didn't work, then i uninstall this extension and reinstall, delete the api-key, turn off and on my vpn, close and open vscode, and fill the api-key in a session, and it can output somehow...
i have to admit i don't know why it can't or can work before and after...
if you have a proxy serve, you can set genieai.openai.apiBaseUrl: http://xxx in setting.json.