gencay / vscode-chatgpt

An unofficial Visual Studio Code - OpenAI ChatGPT integration
ISC License
3.5k stars 760 forks source link

Using new OpenAI API Key method results in 401 error response #69

Closed madison-lane-dev closed 1 year ago

madison-lane-dev commented 1 year ago

Logging in with the traditional Browser Auto-login works fine, except for the problematic issue of GPT being inaccessible due to high traffic when logging inside the browser.

I've been attempting, trying different setting combinations, to use the new OpenAI API Key method but not having any luck.

Once I click on the [Log in] button, nothing happens (maybe it's connecting in the backend with the API directly), but when I attempt to use the chat, either using the text field or one of the context menu options, I get this:

401 Unauthorized Request failed with status code 401

I'm using VS Code version 1.74.3 and ChatGPT extension version 3.4.3.

Here are my settings (I have replaced sensitive info with generic):

"chatgpt.authenticationType": "OpenAI Authentication" "chatgpt.chromiumPath": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "chatgpt.emailAddress": "my.email@server.com" "chatgpt.gpt3.apiKey": "my-api-key" "chatgpt.gpt3.maxTokens": 1024 "chatgpt.gpt3.model": "code-davinci-002" "chatgpt.gpt3.organization": "My Organization" "chatgpt.gpt3.temperature": 0.9 "chatgpt.gpt3.top_p": 1 "chatgpt.method": "GPT3 OpenAI API Key" "chatgpt.proxyServer": null "chatgpt.response.timeoutMs": 120000

gencay commented 1 year ago

@madison-lane-dev could you retry by resetting your organization setting to default?

madison-lane-dev commented 1 year ago

That did the trick.

I copy and pasted the Organization name, is that not the value it's looking for? Is there some numeric ID associated with the Organization that I'm supposed to use?

madison-lane-dev commented 1 year ago

@gencay

Nevermind, I found the Organization ID in the settings. Thanks for the quick support on this!

gencay commented 1 year ago

Great! The Organization setting is an optional parameter if your openai account belongs to an organization. For most users it's just a personal account, you don't need to provide Organization ID.