hallatore/stable-diffusion-webui-chatgpt-utilities

Please add an option to read API key from environment variables

anton-pahomov opened this issue · 0 comments

Currently the only option to set the key is to store it as a plain text in config.json
Would be super useful to add something like this:

openai.api_key = shared.opts.data.get("chatgpt_utilities_api_key", "")
if openai.api_key == "":
openai.api_key = os.getenv("ENVNAME" default="")
if openai.api_key == "":
raise Exception("OpenAI API Key is not set. Please set it in the settings menu.")