AgentGPT
AgentGPT copied to clipboard
Invalid API Key
Please check that this issue hasn't been reported before.
- [X] I searched previous Bug Reports didn't find any similar reports.
Expected Behavior
Should accept OpenAI API Key.
Current behaviour
git clone https://github.com/reworkd/AgentGPT.git cd AgentGPT ./setup.bat
I did this, cmd couldn't understand .setup.bat so I had to run setup.bat only. Asks me to choose between Docker and Manual. I choose Docker. Asks me for OpenAPI Key. I input API Key with no success.
Steps to reproduce
No idea.
Possible solution
I'm doing something wrong clearly as no one have reported this bug. I followed the instructions to get started but this is where i am at.
Which Operating Systems are you using?
- [ ] Android
- [ ] iPhone/iPad
- [ ] Linux
- [ ] macOS
- [X] Windows
Acknowledgements
- [X] My issue title is concise, descriptive, and in title casing.
- [X] I have searched the existing issues to make sure this bug has not been reported yet.
- [X] I am using the latest version of AgentGPT.
- [X] I have provided enough information for the maintainers to reproduce and diagnose the issue.
No you are not doing anythig wrong. I just landed here super exited about how strateforeword all this looks anb bam~ Invalid api key. Please try again.
I'm on linux Ubuntu 24.04.1 LTS x86_64
Yea, something's weird. Also happening to me.
The issue stems from this line: https://github.com/reworkd/AgentGPT/blame/main/cli/src/questions/newEnvQuestions.js#L15
The regex is incorrect and should be changed from /^sk-[a-zA-Z0-9]{48}$/ to /^sk-[a-zA-Z0-9\-\_]{92}$/ as OpenAI API secrets have 92 characters after the 'sk-' prefix, and also have underscores & dashes. Unless I'm missing something
Edit: The above only accounts for User API Secret Keys and not 'Project' API Secret Keys which seem to have a different length
Edit 2: Testing the change now, will probably create a PR tomorrow if all is ok
Same happened for me on Ubuntu 24.04.1 LTS x86_64
same for me...
Any workaround? Running it on Mac M1 Ok, 48 key work but not 92
also having this issue
I personally use a project api key. Mine begins with sk-proj- and is 164 chars long.
Once the regexp modified like /^sk(-proj)?-[a-zA-Z0-9\-\_]+$/, AgentGPT works like a charm with it
I personally use a project api key. Mine begins with
sk-proj-and is 164 chars long.Once the regexp modified like
/^sk(-proj)?-[a-zA-Z0-9\-\_]+$/, AgentGPT works like a charm with it
The PR I put up accounts for all 3 OpenAI SK variants - though I see there's another PR that's been up for months without a review... 😞
Looks like this project is dead? Still no resolution available which I could find.