gpt-engineer icon indicating copy to clipboard operation
gpt-engineer copied to clipboard

Can someone help me with this error ?

Open yashksaini-coder opened this issue 2 years ago • 4 comments

File "", line 198, in _run_module_as_main

File "", line 88, in _run_code

File "C:\Users\USER\Desktop\yash\python\gpt-engineer\gpt_engineer\main.py", line 66, in app()

File "C:\Users\USER\Desktop\yash\python\gpt-engineer\gpt_engineer\main.py", line 29, in main model = fallback_model(model) ^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\USER\Desktop\yash\python\gpt-engineer\gpt_engineer\ai.py", line 60, in fallback_model openai.Model.retrieve(model)

File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\openai\api_resources\abstract\api_resource.py", line 20, in retrieve instance.refresh(request_id=request_id, request_timeout=request_timeout)

File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\openai\api_resources\abstract\api_resource.py", line 32, in refresh self.request(

File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\openai\openai_object.py", line 172, in request requestor = api_requestor.APIRequestor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\openai\api_requestor.py", line 138, in init self.api_key = key or util.default_api_key() ^^^^^^^^^^^^^^^^^^^^^^

File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\openai\util.py", line 186, in default_api_key raise openai.error.AuthenticationError(

yashksaini-coder avatar Jul 03 '23 15:07 yashksaini-coder

@lonelycoder007 I guess that your authentication key is invalid

danielshtel avatar Jul 03 '23 16:07 danielshtel

@lonelycoder007 I guess that your authentication key is invalid

Authentication Keys**** from that...

all those lines that you inserted your API key into @lonelycoder007 needs to be reviewed that it was properly set with the right value, string, and proper numerical data for the API key.

if so then verify the API has permissions to access the specific endpoints required to be ran by GPT.

But ima just say that you probably inserted the API Keys incorrectly which is leading to this error.

vVv-Keys avatar Jul 04 '23 11:07 vVv-Keys

Is there a way to permanently assign the API key cause it asks for every time i run it

yashksaini-coder avatar Jul 06 '23 09:07 yashksaini-coder

Hey @lonelycoder007,

Sure, let's try to make the steps easier to follow with arrows:

Windows + X -> Click on System Advanced system settings Environment Variables in the new window New under System variables Enter OPENAI_KEY in Variable name, and your API key in Variable value Click OK on every window to save your changes This way, the API key becomes part of your system's environment variables and the gpt-engineer script should be able to access it automatically. You won't need to input it each time you run the script.

yanisywd avatar Jul 14 '23 15:07 yanisywd