savbell / whisper-writer

💬📝 A small dictation app using OpenAI's Whisper speech recognition model.
GNU General Public License v3.0
244 stars 40 forks source link

Seeming to pull erroneous OpenAI API key - different from what I set and verify in .env #23

Closed JeremiLorenti closed 6 months ago

JeremiLorenti commented 6 months ago

I have downloaded a fresh copy from this repo, performed the install with no errors, configured my .env with my OpenAI API key, however, I get the below output stating incorrect API key, and shows a portion of an API key I have verified is not mine and not present in my OpenAI account.

Not sure why its using this key or where its getting it from. Never used this repo before on this machine.

Starting WhisperWriter... Script activated. Whisper is set to run using OpenAI's API. To change this, modify the "use_api" value in the src\config.json file. Press Ctrl+Shift+Space to start recording and transcribing. Press Ctrl+C on the terminal window to quit. Recording... Recording finished. Size: 73440 Transcribing audio file... Traceback (most recent call last): File "C:\Users\jerem\OneDrive\Documents\Main Documents\General\GitHub\whisper-writer\src\transcription.py", line 94, in record_and_transcribe response = openai.Audio.transcribe(model=api_options['model'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jerem\OneDrive\Documents\Main Documents\General\GitHub\whisper-writer\venv\Lib\site-packages\openai\api_resources\audio.py", line 65, in transcribe response, _, api_key = requestor.request("post", url, files=files, params=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jerem\OneDrive\Documents\Main Documents\General\GitHub\whisper-writer\venv\Lib\site-packages\openai\api_requestor.py", line 230, in request resp, got_stream = self._interpret_response(result, stream) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jerem\OneDrive\Documents\Main Documents\General\GitHub\whisper-writer\venv\Lib\site-packages\openai\api_requestor.py", line 624, in _interpret_response self._interpret_response_line( File "C:\Users\jerem\OneDrive\Documents\Main Documents\General\GitHub\whisper-writer\venv\Lib\site-packages\openai\api_requestor.py", line 687, in _interpret_response_line raise self.handle_error_response( openai.error.AuthenticationError: Incorrect API key provided: sk-NWgh1***************************************jtd2. You can find your API key at https://platform.openai.com/account/api-keys.

JeremiLorenti commented 6 months ago

I would like to provide an update. I discovered what the issue is. My operating system was inadvertently pulling from my session OS environment variable instead of the local env file set within the application. I was able to change this by using the set command and updating my API key and now it's working.

This doesn't appear to have been a problem with the program, but rather a pre-configuration issue with my operating system.