mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #697] [CLOSED] Support multiple OpenAI Compatible APIs #20422
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?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/697
Author: @NinjaPerson24119
Created: 2/10/2024
Status: ❌ Closed
Base:
dev← Head:openai-compatible-APIs📝 Commits (10+)
4087caefeat: backende4d2e8efeat: frontendf3e140ffeat: Dockerfile args38f8b92feat: example.env0d14d50fix: backend4da6332fix: duplicated openAI (official) settings section05d6c42fix: frontendbddb80bfix: clean backend logs, don't write keys3a884b2fix: stop printing oapi creds to logs52e94a5chore: clean-up📊 Changes
16 files changed (+513 additions, -19 deletions)
View changed files
📝
Dockerfile(+5 -1)📝
backend/apps/openai/main.py(+1 -1)➕
backend/apps/openai_compat/main.py(+135 -0)📝
backend/config.py(+8 -0)📝
backend/main.py(+2 -0)📝
example.env(+5 -1)➕
src/lib/apis/openai_compat/index.ts(+257 -0)📝
src/lib/components/chat/MessageInput/Models.svelte(+1 -1)📝
src/lib/components/chat/Settings/External.svelte(+57 -2)📝
src/lib/components/chat/SettingsModal.svelte(+7 -1)📝
src/lib/components/common/Modal.svelte(+1 -1)📝
src/lib/constants.ts(+1 -0)📝
src/lib/utils/index.ts(+1 -0)📝
src/routes/(app)/+layout.svelte(+9 -1)📝
src/routes/(app)/+page.svelte(+8 -5)📝
src/routes/(app)/c/[id]/+page.svelte(+15 -5)📄 Description
Adds support for hitting OpenAI compatible UIs.
The backend uses the ENV as a simple key:value store, so to store an array of compatible APIs, I stored them as a
;separated list like:localhost1;localhost2;localhost3The backend/frontend implementations for OpenAI Compat are mostly copy pastes of the original OpenAI implemenation, with the changes:
I decided to add a 3rd pathway for
OPENAI_COMPATinstead of augmentingOPENAIbecause we probably want to allow the originalOPENAIpathway to be easily extended for any changes to the proprietary API / features.There's probably other ways this could have been built, but this was what came to me as I was reading the code for the first time + have never touched Svelte before.
Check
backend logs
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.