openui icon indicating copy to clipboard operation
openui copied to clipboard

error OPENAI_API_KEY environment variable

Open flowercoder opened this issue 1 year ago • 1 comments

File "E:\oneDrive\GitHub\PycharmProjects\openuiproj.venv\lib\site-packages\openai_client.py", line 316, in init raise OpenAIError( openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

I try this 3 times. First,I try python 3.11 finally, I use python 3.10. windows 11 My command as list:

1 pip install openui 2 git clone https://github.com/wandb/openui 3 cd .\openui
4 cd .\backend
5 pip install . 6 set OPENAI_API_KEY={mykey} 7 python -m openui

(.venv) PS E:\oneDrive\GitHub\PycharmProjects\openuiproj\openui\backend> python -m openui Traceback (most recent call last): File "C:\Users\IPAD\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\IPAD\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "E:\oneDrive\GitHub\PycharmProjects\openuiproj\openui\backend\openui\__main__.py", line 3, in <module> from . import server File "E:\oneDrive\GitHub\PycharmProjects\openuiproj\openui\backend\openui\server.py", line 68, in <module> openai = AsyncOpenAI( File "E:\oneDrive\GitHub\PycharmProjects\openuiproj\.venv\lib\site-packages\openai\_client.py", line 316, in __init__ raise OpenAIError( openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

flowercoder avatar Jun 05 '24 17:06 flowercoder

This might be fixed in the latest release. Not sure what that wasn't working before. There's also a new preferred method of running OpenUI in the readme.

vanpelt avatar Jun 23 '24 22:06 vanpelt