[GH-ISSUE #6303] OpenAI API not considered enabled when there's only one API URL and an empty API key #52978

Closed
opened 2026-05-05 14:12:17 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @alev000 on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/6303

From this discord thread

If a user has only one OpenAI API URL in the Admin "Connections" tab, and the corresponding API key is empty, the model connection can be verified, but it will not show up in model-selection menus elsewhere in the UI. (Note: this is a common scenario when running a local non-ollama model like vLLM or llama.cpp.)

I think I've tracked this down to the following backend code, in is_openai_api_disabled, which gets called as part of get_all_models when handling /api/v1/models.

https://github.com/open-webui/open-webui/blob/c2d1a3164e0a310f77a88ede2938c6adb58a334f/backend/open_webui/apps/openai/main.py#L239-L242

^ This code considers OpenAI API's to be disabled if there is only one empty key. I think it would be more correct to check for only one empty URL instead.

Potential short-term workarounds:

  • Admin user can enter a non-empty API key
    • Note: won't work if the chat endpoint actually checks for and requires an empty key
  • Admin user can add a second (unused) OpenAI API URL
Originally created by @alev000 on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/6303 From [this discord thread](https://discord.com/channels/1170866489302188073/1297664835265232916/1297664835265232916) If a user has only one OpenAI API URL in the Admin "Connections" tab, and the corresponding API key is empty, the model connection can be verified, but it will not show up in model-selection menus elsewhere in the UI. (Note: this is a common scenario when running a local non-ollama model like vLLM or llama.cpp.) I think I've tracked this down to the following backend code, in `is_openai_api_disabled`, which gets called as part of `get_all_models` when handling `/api/v1/models`. https://github.com/open-webui/open-webui/blob/c2d1a3164e0a310f77a88ede2938c6adb58a334f/backend/open_webui/apps/openai/main.py#L239-L242 ^ This code considers OpenAI API's to be disabled if there is only one empty key. I think it would be more correct to check for only one empty URL instead. Potential short-term workarounds: * Admin user can enter a non-empty API key * Note: won't work if the chat endpoint actually checks for and requires an empty key * Admin user can add a second (unused) OpenAI API URL
Author
Owner

@tjbck commented on GitHub (Oct 21, 2024):

Removed the constraint in dev.

<!-- gh-comment-id:2425867234 --> @tjbck commented on GitHub (Oct 21, 2024): Removed the constraint in dev.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#52978