8000 connect ETIMEDOUT when using API key integration · Issue #176 · gencay/vscode-chatgpt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

connect ETIMEDOUT when using API key integration #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yibuxulong opened this issue Mar 3, 2023 · 6 comments
Closed

connect ETIMEDOUT when using API key integration #176

yibuxulong opened this issue Mar 3, 2023 · 6 comments

Comments

@yibuxulong
Copy link

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:
image

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?

@gencay
Copy link
Owner
gencay commented Mar 3, 2023

@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
  }'

@yibuxulong
Copy link
Author

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.

@laterdayi
Copy link

@gencay @yibuxulong How to solve it

@yibuxulong
Copy link
Author

@laterdayi Switching system proxy with VPN worked for me.

@MC-dusk
Copy link
MC-dusk commented Mar 6, 2023

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...

@luoshilu
Copy link
luoshilu commented Apr 7, 2023

if you have a proxy serve, you can set genieai.openai.apiBaseUrl: http://xxx in setting.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
0