I am wondering if it only happens to me or not, but my OpenAI API Key is always lost when updating a new version of the app via docker update using the following command (as suggested in the documentation): docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webui
Is there a quick fix for this?
Originally created by @taidbui on GitHub (Mar 11, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/1135
I am wondering if it only happens to me or not, but my OpenAI API Key is always lost when updating a new version of the app via docker update using the following command (as suggested in the documentation): `docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webui`
Is there a quick fix for this?
Modify the docker run accordingly to how you originally ran it, the important part is adding the -e OPENAI_API_KEY=your_openai_api_key_goes_here part to it.
<!-- gh-comment-id:1988627728 -->
@justinh-rahb commented on GitHub (Mar 11, 2024):
> docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webui
Try this:
```bash
docker rm -f open-webui
docker run -d -p 3000:8080 -e OPENAI_API_KEY=your_openai_api_key_goes_here --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
```
Modify the `docker run` accordingly to how you originally ran it, the important part is adding the `-e OPENAI_API_KEY=your_openai_api_key_goes_here` part to it.
@Mortezanavidi commented on GitHub (Mar 11, 2024):
the problem is that OPENAI_API_KEY works but OPENAI_BASE_URL doessn't work, unfortunately if we edit openai base url, it won't save it and gives error
<!-- gh-comment-id:1989245991 -->
@Mortezanavidi commented on GitHub (Mar 11, 2024):
the problem is that OPENAI_API_KEY works but OPENAI_BASE_URL doessn't work, unfortunately if we edit openai base url, it won't save it and gives error
@Mortezanavidi commented on GitHub (Mar 11, 2024):
@tjbck thank you for mentioning that, it worked but it didn't fixed the problem, the error i'mg getting is: "GET /openai/api/models HTTP/1.1" 500 Internal Server Error
even tho the api proxy is working well and i can use it with other apps without a problem
<!-- gh-comment-id:1989407193 -->
@Mortezanavidi commented on GitHub (Mar 11, 2024):
@tjbck thank you for mentioning that, it worked but it didn't fixed the problem, the error i'mg getting is:
`
"GET /openai/api/models HTTP/1.1" 500 Internal Server Error
`
even tho the api proxy is working well and i can use it with other apps without a problem
@Mortezanavidi commented on GitHub (Mar 11, 2024):
a simple fastapi model that i created myself over my other apis, something close to litellm, it has the /v1/models endpoint with the correct json output result.
as of OPENAI_API_BASE_URL, my address is localhost:10000/v1
<!-- gh-comment-id:1989439725 -->
@Mortezanavidi commented on GitHub (Mar 11, 2024):
a simple fastapi model that i created myself over my other apis, something close to litellm, it has the /v1/models endpoint with the correct json output result.
as of OPENAI_API_BASE_URL, my address is localhost:10000/v1
@Mortezanavidi commented on GitHub (Mar 12, 2024):
any progress on this? my api is giving 200 ok response which means openwebui is accessing it successfully, but on openwebui i am getting 500 internal error
<!-- gh-comment-id:1990876202 -->
@Mortezanavidi commented on GitHub (Mar 12, 2024):
any progress on this? my api is giving 200 ok response which means openwebui is accessing it successfully, but on openwebui i am getting 500 internal error
@Mortezanavidi commented on GitHub (Mar 12, 2024):
i just checked it with default https://api.openai.com/v1 and my own api and it gives the same 500 error on a fresh install (new volume as well)
<!-- gh-comment-id:1990911069 -->
@Mortezanavidi commented on GitHub (Mar 12, 2024):
i just checked it with default https://api.openai.com/v1 and my own api and it gives the same 500 error on a fresh install (new volume as well)
Restarting the app makes the error go away. But it didn't save the settings in any case.
<!-- gh-comment-id:2092631226 -->
@gramakri commented on GitHub (May 3, 2024):
I am the author of the Cloudron package for openwebui and I am seeing the same issue.
```
11:21:01 - INFO:apps.openai.main:get_all_models()
11:21:01 - INFO: 89.247.165.150:0 - "GET /openai/api/models HTTP/1.1" 500 Internal Server Error
```
Restarting the app makes the error go away. But it didn't save the settings in any case.
Maybe the settings UI is not supposed to work and it is simply showing environment variables? I can confirm that after setting env vars OPENAI_API_BASE_URLS and OPENAI_API_KEYS, it works.
<!-- gh-comment-id:2092652900 -->
@gramakri commented on GitHub (May 3, 2024):
@tjbck Just debugging this a bit. I think the issue is simply that these settings are never stored in the database. https://github.com/open-webui/open-webui/blob/main/backend/apps/openai/main.py#L81 seems to just modify the app state and thus it is lost across restart.
Maybe the settings UI is not supposed to work and it is simply showing environment variables? I can confirm that after setting env vars `OPENAI_API_BASE_URLS` and `OPENAI_API_KEYS`, it works.

Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @taidbui on GitHub (Mar 11, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/1135
I am wondering if it only happens to me or not, but my OpenAI API Key is always lost when updating a new version of the app via docker update using the following command (as suggested in the documentation):
docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webuiIs there a quick fix for this?
@justinh-rahb commented on GitHub (Mar 11, 2024):
Try this:
Modify the
docker runaccordingly to how you originally ran it, the important part is adding the-e OPENAI_API_KEY=your_openai_api_key_goes_herepart to it.@taidbui commented on GitHub (Mar 11, 2024):
Thanks. Looks good. I will try next time.
@Mortezanavidi commented on GitHub (Mar 11, 2024):
the problem is that OPENAI_API_KEY works but OPENAI_BASE_URL doessn't work, unfortunately if we edit openai base url, it won't save it and gives error
@tjbck commented on GitHub (Mar 11, 2024):
@Mortezanavidi The correct environment variable is
OPENAI_API_BASE_URL:)@Mortezanavidi commented on GitHub (Mar 11, 2024):
@tjbck thank you for mentioning that, it worked but it didn't fixed the problem, the error i'mg getting is:
"GET /openai/api/models HTTP/1.1" 500 Internal Server Erroreven tho the api proxy is working well and i can use it with other apps without a problem
@justinh-rahb commented on GitHub (Mar 11, 2024):
What are you using as the endpoint URL?
@Mortezanavidi commented on GitHub (Mar 11, 2024):
a simple fastapi model that i created myself over my other apis, something close to litellm, it has the /v1/models endpoint with the correct json output result.
as of OPENAI_API_BASE_URL, my address is localhost:10000/v1
@Mortezanavidi commented on GitHub (Mar 12, 2024):
any progress on this? my api is giving 200 ok response which means openwebui is accessing it successfully, but on openwebui i am getting 500 internal error
@Mortezanavidi commented on GitHub (Mar 12, 2024):
i just checked it with default https://api.openai.com/v1 and my own api and it gives the same 500 error on a fresh install (new volume as well)
@tjbck commented on GitHub (Mar 12, 2024):
@Mortezanavidi Could you share a screenshot of your settings with us.
@gramakri commented on GitHub (May 3, 2024):
I am the author of the Cloudron package for openwebui and I am seeing the same issue.
Restarting the app makes the error go away. But it didn't save the settings in any case.
@gramakri commented on GitHub (May 3, 2024):
@tjbck Just debugging this a bit. I think the issue is simply that these settings are never stored in the database. https://github.com/open-webui/open-webui/blob/main/backend/apps/openai/main.py#L81 seems to just modify the app state and thus it is lost across restart.
Maybe the settings UI is not supposed to work and it is simply showing environment variables? I can confirm that after setting env vars
OPENAI_API_BASE_URLSandOPENAI_API_KEYS, it works.