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

Invalid API Key #1624

Open
6 of 10 tasks
taia-source opened this issue Sep 12, 2024 · 8 comments · May be fixed by #1650
Open
6 of 10 tasks

Invalid API Key #1624

taia-source opened this issue Sep 12, 2024 · 8 comments · May be fixed by #1650
Labels
bug Something isn't working

Comments

@taia-source
Copy link

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

  • 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
  • Windows

Acknowledgements

  • My issue title is concise, descriptive, and in title casing.
  • I have searched the existing issues to make sure this bug has not been reported yet.
  • I am using the latest version of AgentGPT.
  • I have provided enough information for the maintainers to reproduce and diagnose the issue.
@taia-source taia-source added the bug Something isn't working label Sep 12, 2024
@bogdan-marian
Copy link

bogdan-marian commented Sep 13, 2024

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
Copy link

jarodsmk commented Sep 17, 2024

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
Copy link

elhenro commented Sep 23, 2024

Same happened for me on Ubuntu 24.04.1 LTS x86_64

@twobeass
Copy link

same for me...

@Molnfront
Copy link

Molnfront commented Oct 15, 2024

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

@AlexVanDyne
Copy link

also having this issue

@jclaveau
Copy link

jclaveau commented Nov 1, 2024

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
Copy link

jarodsmk commented Nov 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
8 participants