mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 15:54:15 -05:00
OpenAI API key env variable does not take effect #929
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nopoz on GitHub (May 15, 2024).
Bug Report
Description
If you've manually set the OpenAI API Key before and then erased it in the UI, the config.json looks like this:
If you then set the "OPENAI_API_KEY" environment variable in Docker compose, it will not overwrite the existing config.json api_keys empty value
"".Steps to Reproduce:
Enter an OpenAI API Key in the webui save, then delete it. Enter OPENAI_API_KEY in docker compose environment variables restart the container, launch web ui and check "Settings -> Connections -> OpenAI API". The API key is blank and no OpenAI models have been loaded.
Compose Example:
Verifying "OPENAI_API_KEY" env variable inside container:
The Browser Debug network request when loading the settings page:
request:
https://<my host>/openai/api/keysresponse:
{"OPENAI_API_KEYS":[""]}Workaround:
Manually edit out the OpenAI configuration from config.json and restart the container.
Example config.json:
Expected Behavior:
For the environment variable to be ingested into the config by open-webui and overwrite whatever is currently configured in config.json.
Actual Behavior:
OpenAI API key is blank in the UI.
Environment
Open WebUI Version: v0.1.124
Ollama (if applicable): n/a
Operating System: Docker
Browser (if applicable): Firefox 124.0.1
Reproduction Details
Confirmation:
Logs and Screenshots
Browser Console Logs:
see above
Docker Container Logs:
n/a
Screenshots (if applicable):
n/a
Installation Method
Docker
Additional Information
see above