[GH-ISSUE #22084] issue: RAG_OPENAI_ env vars do not inherit OPENAI_API_ values #35164

Closed
opened 2026-04-25 09:23:30 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @kirill-sch on GitHub (Mar 1, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22084

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.8.5

Ollama Version (if applicable)

No response

Operating System

Windows 11

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

If RAG_OPENAI_API_BASE_URL and RAG_OPENAI_API_KEY are not explicitly set, the app should automatically fall back to OPENAI_API_BASE_URL and OPENAI_API_KEY, as described in the environment variable configuration.

Actual Behavior

When RAG_OPENAI_API_BASE_URL and RAG_OPENAI_API_KEY are not set, the application does not correctly inherit the explicitly configured OPENAI_API_BASE_URL and OPENAI_API_KEY values. Instead, it falls back to the default (https://api.openai.com/v1) for OPENAI_API_BASE_URL, even if a different value was provided. Since OPENAI_API_KEY does not have a default value, it falls back to an empty string.

As a result, the explicitly configured OpenAI endpoint and API key are not reused for RAG operations. Users are therefore required to define both RAG_OPENAI_API_BASE_URL and RAG_OPENAI_API_KEY, even when they intend to use the same OpenAI compatible configuration for both general LLM usage and RAG.

Steps to Reproduce

OPENAI_API_BASE_URL: "http://litellm:4000/v1"
OPENAI_API_KEY: "sk-1234"
RAG_EMBEDDING_ENGINE: "openai"
RAG_EMBEDDING_MODEL: "text-embedding-3-small"
  1. Start the container with the following environment variables
  2. In the UI, go to Admin panel > Settings > Documents
    Under the Embedding Model Engine settings we can see that it doesn't use the two configured OPENAI envs.
  3. Upload a file
    It will return with an IndexError: list index out of range error and in the logs we can confirm that it's calling the same OpenAI endpoint observed in step 2.
  4. Add the two envs for RAG:
RAG_OPENAI_API_BASE_URL: "http://litellm:4000/v1"
RAG_OPENAI_API_KEY: "sk-1234"
  1. In the UI, go to Admin panel > Settings > Documents
    You will see that it now uses the configured environment variables, and the document upload will be successful.

Logs & Screenshots

Image
Image
Image

Additional Information

No response

Originally created by @kirill-sch on GitHub (Mar 1, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22084 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.8.5 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior If `RAG_OPENAI_API_BASE_URL` and `RAG_OPENAI_API_KEY` are not explicitly set, the app should automatically fall back to `OPENAI_API_BASE_URL` and `OPENAI_API_KEY`, as described in the environment variable configuration. ### Actual Behavior When `RAG_OPENAI_API_BASE_URL` and `RAG_OPENAI_API_KEY` are not set, the application does not correctly inherit the explicitly configured `OPENAI_API_BASE_URL` and `OPENAI_API_KEY` values. Instead, it falls back to the default (https://api.openai.com/v1) for OPENAI_API_BASE_URL, even if a different value was provided. Since `OPENAI_API_KEY` does not have a default value, it falls back to an empty string. As a result, the explicitly configured OpenAI endpoint and API key are not reused for RAG operations. Users are therefore required to define both `RAG_OPENAI_API_BASE_URL` and `RAG_OPENAI_API_KEY`, even when they intend to use the same OpenAI compatible configuration for both general LLM usage and RAG. ### Steps to Reproduce ``` OPENAI_API_BASE_URL: "http://litellm:4000/v1" OPENAI_API_KEY: "sk-1234" RAG_EMBEDDING_ENGINE: "openai" RAG_EMBEDDING_MODEL: "text-embedding-3-small" ``` 1. Start the container with the following environment variables 2. In the UI, go to Admin panel > Settings > Documents Under the Embedding Model Engine settings we can see that it doesn't use the two configured `OPENAI` envs. 3. Upload a file It will return with an `IndexError: list index out of range` error and in the logs we can confirm that it's calling the same OpenAI endpoint observed in step 2. 4. Add the two envs for RAG: ``` RAG_OPENAI_API_BASE_URL: "http://litellm:4000/v1" RAG_OPENAI_API_KEY: "sk-1234" ``` 5. In the UI, go to Admin panel > Settings > Documents You will see that it now uses the configured environment variables, and the document upload will be successful. ### Logs & Screenshots 2. <img width="1586" height="85" alt="Image" src="https://github.com/user-attachments/assets/6124c2fb-e8ef-4521-bfdf-bd0d8b5f0090" /> 3. <img width="1417" height="52" alt="Image" src="https://github.com/user-attachments/assets/ee96cac5-bd42-46a0-b7bd-30d2e51556ea" /> 5. <img width="1581" height="71" alt="Image" src="https://github.com/user-attachments/assets/c0cddd95-0f8b-4e75-a4d4-af81f687fc49" /> ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-25 09:23:30 -05:00
Author
Owner

@tjbck commented on GitHub (Mar 6, 2026):

They do inherit but they're PersistentConfigs

<!-- gh-comment-id:4013970956 --> @tjbck commented on GitHub (Mar 6, 2026): They do inherit but they're PersistentConfigs
Author
Owner

@kirill-sch commented on GitHub (Mar 6, 2026):

Sorry, I left it out of the config part, but what is shown above was done with PersistentConfig turned off. Even with that turned off, they do not inherit.
If I hadn’t set ENABLE_PERSISTENT_CONFIG: "False", then it wouldn’t have mattered whether I set the two env variables in step 4 or not, since it wouldn’t have changed anything.

<!-- gh-comment-id:4014397688 --> @kirill-sch commented on GitHub (Mar 6, 2026): Sorry, I left it out of the config part, but what is shown above was done with PersistentConfig turned off. Even with that turned off, they do not inherit. If I hadn’t set` ENABLE_PERSISTENT_CONFIG: "False"`, then it wouldn’t have mattered whether I set the two env variables in step 4 or not, since it wouldn’t have changed anything.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#35164