rubberduck-vscode
rubberduck-vscode copied to clipboard
API Key does not apply on Code-Server
Describe the bug
After adding an OpenAI API key with with the Rubberduck: Enter OpenAI API key
command, I get an error stating that I have not yet entered an API key.
Error: Failed after 1 attempt(s) with non-retryable error: '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.'
How to reproduce
Install Code-Server, install Rubber duck extension, enter api key, try to use the chat fuction.
Expected behavior
Rubber Duck extension should be able to communicate with OpenAI API when running in Code-Server.
After a little more digging into this, I found that the variable for OPEN_AI_API_KEY_SECRET_KEY
was not being set or read correctly. Manually exporting this variable with my API key seems to resolve my issue.
Not sure if this is an issue with the plugin, or just a difference in the way that VS Code and Code-Server operate. But it would be very handy if the add API key command would work correctly on Code-Server installs.