mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 17:02:01 -05:00
[GH-ISSUE #1135] OpenAI API Key disappeared after updating #12355
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 @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.