Skip to content
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

"401 Incorrect API key provided" even if it has the correct OPENAI_KEY (even after a API key update) #82

Open
EdoardoMolinatti opened this issue Jan 23, 2025 · 0 comments

Comments

@EdoardoMolinatti
Copy link

Hi all,
first of all, I'm sure my OpenAI API Key works because I'm using it on a WSL2 machine (Ubuntu 22.04) on the same Windows 11 machine.

On a Windows 11 command prompt window (cmd.exe) I executed micro-agent (after installing it through npm).
The output was the following:

C:\Users\edoardo.molinatti>micro-agent
(node:25320) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)

┌ 🦾 Micro Agent

◇ Welcome newcomer! What is your OpenAI key? (this is kept private)
│ sk-proj-*******************************************************************************************************************************************************qikA

◇ What would you like to do?
│ A function that checks the disk used space telling me a list of the "heaviest" folders on the root filesystem, with a customizable depth level
which should be 3 by default (this is the recursive depth of the folder to visualize, calculated from the root)


✖ 401 Incorrect API key provided: sk-proj-*******************************************************************************************************************************************************qikA. You can find your API key at https://platform.openai.com/account/api-keys.
at APIError.generate (file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/node_modules/openai/error.mjs:44:20)
at OpenAI.makeStatusError (file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/node_modules/openai/core.mjs:286:25)
at OpenAI.makeRequest (file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/node_modules/openai/core.mjs:330:30)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async getFileSuggestion (file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/dist/cli.mjs:967:22)
at async interactiveMode (file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/dist/cli.mjs:735:33)
at async file:///C:/Users/edoardo.molinatti/AppData/Roaming/npm/node_modules/@builder.io/micro-agent/dist/cli.mjs:1776:11

micro-agent v0.1.4

Please open a Bug report with the information above:
https://github.com/BuilderIO/micro-agent/issues/new

As you can see I specified my OpenAI API key as requested, but it didn't work.
If I run micro-agent config I see that the key is correct, but I tried to update it re-pasting it after a double-check (using the command micro-agent config set OPENAI_KEY=<token>).
It still doesn't work (with the same error output).

Can you please tell me what could be wrong and/or what to check?

Thank you very much for any help

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

1 participant