# 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 USE_AZURE section. In this reporter's case the config had Azure OpenAI lines left uncommented, which confused the key lookup. Fix: make sure OPENAI_API_KEY is set on its own line and comment out the whole USE_AZURE 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.