mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[GH-ISSUE #19683] issue: Potential Issues in API Base URL & Key Resolution Logic (Needs Double Check) #18955
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 @flefevre on GitHub (Dec 2, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19683
Check Existing Issues
Installation Method
Docker
Open WebUI Version
V0.6.40
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Description
There are several areas in the current API configuration code that potentially introduce unexpected behavior. These issues should be double-checked to ensure that environment variables, base URLs, and API keys work as intended.
I am looking at [backend\open_webui\config.py](https://github.com/open-webui/open-webui/blob/main/backend/open_webui/config.py)
1. Base URL might be unintentionally overwritten
At the end of the file, the following line:
unconditionally replaces the previously computed value.
This may override:
OPENAI_API_BASE_URLOPENAI_API_BASE_URLSIt’s possible this was not intended and should be double-checked.
2. API key/base URL mapping might silently fail
The mapping logic:
can raise an exception if the default OpenAI URL is not present in the list.
Because the exception is fully swallowed:
OPENAI_API_KEYmight stay empty without any warning.This should be reviewed to avoid silent misconfiguration.
3.
OPENAI_API_KEYmight be overwritten unintentionallyThe code resets the key:
even if the user provided a simple
OPENAI_API_KEY. If the mapping fails, the effective key becomes an empty string.This behavior should probably be double-checked.
4. Possible key/base URL desynchronization
Because the base URL is forced back to the default at the end, while the key might have been resolved for a different URL, the final config could potentially become inconsistent.
Actual Behavior
each time when deploying with Kubernetes the value OPENAI_API_KEY and OPENAI_API_BASE_URL are overwritten by the code.
Steps to Reproduce
Here the configuration for our values for kubernetes
name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: pipelines-secret
key: pipelines_api_key
name: OPENAI_API_KEYS
valueFrom:
secretKeyRef:
name: pipelines-secret
key: litellm-api-keys
name: OPENAI_API_BASE_URL
value: 'http://mylab-pipelines-openwebui:9099'
name: OPENAI_API_BASE_URLS
value: 'http://mylab-pipelines-openwebui:9099;http://mylab-litellm:8989/v1'
Logs & Screenshots
✅ Proposed Fix (Patch Example)
Below is a suggested correction that:
OPENAI_API_KEYAdditional Information
Nothing here is necessarily a confirmed bug, but there are several places where behavior might be unintended, and a double-check is recommended. The proposed patch above aims to make the configuration predictable and robust.
@owui-terminator[bot] commented on GitHub (Dec 2, 2025):
🔍 Similar Issues Found
I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:
#19519 issue: Base64 encoded images included in API responses
by luke-wren • Nov 26, 2025 •
bug#19563 issue:
by naruto7g • Nov 28, 2025 •
bug#19211 issue:
by Byrnes9 • Nov 16, 2025 •
bug#19420 issue: Unable to create new api-keys - 403 forbidden
by DominikStarke • Nov 24, 2025 •
bug#14908 issue: 401 x-api-key header is required web search
by deresolution20 • Jun 11, 2025 •
bugShow 5 more related issues
#19260 issue: Elevenlabs TTS API Key appears unobscured in the admin/settings page
by tomhaynes • Nov 18, 2025 •
bug#19168 issue: SCIM endpoints accessible even when not listed in
API_KEY_ALLOWED_ENDPOINTSby flefevre • Nov 13, 2025 •
bug#19017 issue: OPENAI_API_CONFIGS and OLLAMA_API_CONFIGS environment variables are not parsed from JSON
by runixer • Nov 07, 2025 •
bug#19417 issue: v0.6.37 SQL Error
by AKHYP • Nov 24, 2025 •
bug#17907 issue: API Key rejected for /api/v1/files/ upload despite correct config in v0.6.32
by sanctimon • Sep 29, 2025 •
bug💡 Tips:
This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.