wandb / openui

OpenUI let's you describe UI using your imagination, then see it rendered live.
https://openui.fly.dev
Apache License 2.0
18.84k stars 1.73k forks source link

error OPENAI_API_KEY environment variable #152

Open flowercoder opened 3 months ago

flowercoder commented 3 months ago

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

vanpelt commented 3 months ago

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.