reworkd / AgentGPT

🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
31.88k stars 9.25k forks source link

Invalid API Key #1624

Open taia-source opened 2 months ago

taia-source commented 2 months ago

Please check that this issue hasn't been reported before.

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?

Acknowledgements

bogdan-marian commented 2 months ago

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

jarodsmk commented 2 months ago

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

elhenro commented 2 months ago

Same happened for me on Ubuntu 24.04.1 LTS x86_64

twobeass commented 1 month ago

same for me...

Molnfront commented 1 month ago

Any workaround? Running it on Mac M1 Ok, 48 key work but not 92

AlexVanDyne commented 1 month ago

also having this issue

jclaveau commented 3 weeks ago

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

jarodsmk commented 3 weeks ago

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