Skip to content
← Back to activity

Immutable solution version

OpenAI AuthenticationError: Incorrect API key provided

Version 1Sign in to save

Complete solution

If AutoGPT throws 'Incorrect API key provided' even though your key is right, check the .env around the USE_AZURE section. (AutoGPT; via gh:Significant-Gravitas/AutoGPT#1422)

OpenAI AuthenticationError: Incorrect API key provided

What happened

Issue Significant-Gravitas/AutoGPT#1422 (closed, 38 comments): ### Duplicates - [X] I have searched the existing issues ### Steps to reproduce 🕹 When running Auto-GPT using the command python3 -m autogpt --debug, I am getting an AuthenticationError with the message "Incorrect API key provided". I am sure that the API key is correct, as I have double-checked it. Clone the Auto-GPT repository from https://github.com/Torantulino/Auto-GPT Install the required packages using pip3 install -r requirements.txt Run the command python3 -m autogpt --debug in the terminal. ### Current behavior 😯 When running the above command, I get the following error...

What works

If AutoGPT throws 'Incorrect API key provided' even though your key is right, check the .env around the USEAZURE section. In this reporter's case the config had Azure OpenAI lines left uncommented, which confused the key lookup. Fix: make sure OPENAIAPIKEY is set on its own line and comment out the whole USEAZURE section unless you're actually using Azure. A stray Azure config block can make a valid key look invalid.

Caveats

This comes from one real issue thread (gh:Significant-Gravitas/AutoGPT#1422); it is the verified fix or approach from that thread, not a general manual. Check your version of AutoGPT first , maintainers often fix the underlying bug in a later release, and the thread may predate it.

Evidence

Issue gh:Significant-Gravitas/AutoGPT#1422 asked: Issue Significant-Gravitas/AutoGPT#1422 (closed, 38 comments): ### Duplicates - [X] I have searched the existing issues ### Steps to reproduce 🕹 When running Auto-GPT using the command python3 -m autogpt --debug, I am getting an AuthenticationError with the message "Incorrect API key provided". I am sure that the API key is correct, as I have double-checked it. Clone the Auto-GPT repository from https://github.com/Torantulino/Auto-GPT Install the required packages using pip3 install -r requirements.txt Run the command python3 -m autogpt --debug in the terminal. ### Current behavior 😯 When running the above command, I get the following error... The verified answer from the thread: If AutoGPT throws 'Incorrect API key provided' even though your key is right, check the .env around the USEAZURE section. In this reporter's case the config had Azure OpenAI lines left uncommented, which confused the key lookup. Fix: make sure OPENAIAPIKEY is set on its own line and comment out the whole USEAZURE section unless you're actually using Azure. A stray Azure config block can make a valid key look invalid. Source: https://github.com/Significant-Gravitas/AutoGPT/issues/1422

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BA8jhn52k1dsuYwYPUAwTQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OpenAI AuthenticationError: Incorrect API key provided <span>— Vectle</span></a>