gpt-engineer
gpt-engineer copied to clipboard
Issue with the OpenAI API key
export is not working in windows. And I tried set too, it is also not working. Can you please let me know how to deal with this?
try to use set instead of export
try to use
setinstead ofexport
I have used set as well. It is not working...
+1
Same here. Can't set API key. Also tried using $env with no luck.
Can anyone please look into this?
Can you share the specific commands you are running?
Can you share the specific commands you are running?
Tried both
set OPENAI_API_KEY=KEY set: OPENAI_API_KEY=KEY
Should consider re-opening #136 as it would solve these issues for all platforms
Open discussion about this in #135
Please go there and add your opinions to raise visibility and then maybe get it introduced.
Can you share the specific commands you are running?
Tried both
set OPENAI_API_KEY=KEY set: OPENAI_API_KEY=KEY
try $env:OPENAI_API_KEY="<API-KEY>" on Windows
set it via openai.api_key = "blablabla" inside gpt_engineer/main.py. Remember to import openai
try to use
setinstead ofexportI have used set as well. It is not working...
same, Having issues my self, I did notice I could not find the file that imports the OPENAI key I believe its supposed to be main.py? I will have to do some more digging make sure I am not over looking something or doing it wrong. If I figure out something on my end I will try to remember to post it.
Same issue here:
File "C:\xxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 66, in
File "C:\xxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 47, in main ai = AI(
File "C:\xxxxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\ai.py", line 15, in init openai.Model.retrieve(model)
File "C:\xxxxxxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\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:\xxxxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\openai\api_resources\abstract\api_resource.py", line 32, in refresh self.request(
File "C:\xxxxxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\openai\openai_object.py", line 172, in request requestor = api_requestor.APIRequestor(
File "C:\xxxxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\openai\api_requestor.py", line 138, in init self.api_key = key or util.default_api_key()
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\openai\util.py", line 186, in default_api_key raise openai.error.AuthenticationError(
openai.error.AuthenticationError: No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.
Agree with this answer, I guess Powershell was used by default nowadays.
(If you see something like (venv) PS C:\Projects\AI\gpt-engineer> in your terminal, 'PS` stands for powershell)
Q: in windows powershell, how to set env variable?
ChatGPT: To set an environment variable in Windows PowerShell, you can use the $env automatic variable to access and modify the environment variables. Here's how you can set an environment variable:
$env:VariableName = "VariableValue"
Replace VariableName with the name of the environment variable you want to set, and VariableValue with the desired value.
For example, to set an environment variable named OPENAI_API_KEY with the value sk-x...., you would use the following command:
$env:OPENAI_API_KEY= "sk-x...."
Can you share the specific commands you are running?
Tried both set OPENAI_API_KEY=KEY set: OPENAI_API_KEY=KEY
try $env:OPENAI_API_KEY="" on Windows
on windows works with $env:OPENAI_API_KEY='sk-xxx' but now I get openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details using the (free) GPT 3.5 key
using $env:OPENAI_API_KEY="" on Windows
INFO:openai:error_code=model_not_found error_message="The model 'gpt-4' does not exist" error_param=model error_type=invalid_request_error message='OpenAI API error received' stream_error=False Model gpt-4 not available for provided API key. Reverting to gpt-3.5-turbo. Sign up for the GPT-4 wait list here: https://openai.com/waitlist/gpt-4-api Traceback (most recent call last):
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 66, in
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 61, in main messages = step(ai, dbs)
File "C:\xxxxxl\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\steps.py", line 30, in clarify messages = [ai.fsystem(dbs.identity["qa"])]
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\db.py", line 18, in getitem raise KeyError(key)
KeyError: 'qa'
using $env:OPENAI_API_KEY="" on Windows
INFO:openai:error_code=model_not_found error_message="The model 'gpt-4' does not exist" error_param=model error_type=invalid_request_error message='OpenAI API error received' stream_error=False Model gpt-4 not available for provided API key. Reverting to gpt-3.5-turbo. Sign up for the GPT-4 wait list here: https://openai.com/waitlist/gpt-4-api Traceback (most recent call last):
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 66, in app()
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 61, in main messages = step(ai, dbs)
File "C:\xxxxxl\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\steps.py", line 30, in clarify messages = [ai.fsystem(dbs.identity["qa"])]
File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\db.py", line 18, in getitem raise KeyError(key)
KeyError: 'qa'
When I used $env:OPENAI_API_KEY="KEYGOESHERE" on Windows and placing the key in where I put "KEYGOESHERE", it works for me. however, you are getting that error because you do not have GPT-4 API access yet. Sign up for the waiting list. You may want to change the model to 3.5 in the code, and then try too.
using $env:OPENAI_API_KEY="" on Windows INFO:openai:error_code=model_not_found error_message="The model 'gpt-4' does not exist" error_param=model error_type=invalid_request_error message='OpenAI API error received' stream_error=False Model gpt-4 not available for provided API key. Reverting to gpt-3.5-turbo. Sign up for the GPT-4 wait list here: https://openai.com/waitlist/gpt-4-api Traceback (most recent call last): File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 66, in app() File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\main.py", line 61, in main messages = step(ai, dbs) File "C:\xxxxxl\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\steps.py", line 30, in clarify messages = [ai.fsystem(dbs.identity["qa"])] File "C:\xxxxx\Proyectos\GPTe\GPTe\gpt_engineer\myenv\lib\site-packages\gpt_engineer\db.py", line 18, in getitem raise KeyError(key) KeyError: 'qa'
When I used $env:OPENAI_API_KEY="KEYGOESHERE" on Windows and placing the key in where I put "KEYGOESHERE", it works for me. however, you are getting that error because you do not have GPT-4 API access yet. Sign up for the waiting list. You may want to change the model to 3.5 in the code, and then try too.
Hi
I have GPT4 membershitp
if set doesn't work on windows just delete spaces before and after '='
try to use
setinstead ofexportI have used set as well. It is not working...
Does not work
if set doesn't work on windows just delete spaces before and after '='
Does not work either
win search -> Edit the system environment variables -> Environment Variables... -> New...
win search -> Edit the system environment variables -> Environment Variables... -> New...
I tried this a while ago, but even this didn‘t work for me. Did it do the job for you, after you set the api-key as an environment variable?
win search -> Edit the system environment variables -> Environment Variables... -> New...
I tried this a while ago, but even this didn‘t work for me. Did it do the job for you, after you set the api-key as an environment variable?
while it did a job with making it visible for the gpt-engineer I have another problem now.
when I have a prompt file w/o extension command fails with openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
however when I have prompt.txt filled in with my prompt it fails with AssertionError: Please put your prompt in the file 'prompt' in the project directory
Info about this in readme now
$env:OPENAI_API_KEY= "sk-x...."
This is the only solution that worked! Thanks!