mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #12940] [CLOSED] ✨ Introducing Custom TTS Engine Support! (OpenAPI Compatible) #38686
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/12940
Author: @RedsAnalysis
Created: 4/16/2025
Status: ❌ Closed
Base:
dev← Head:customtts_v1📝 Commits (4)
9b9fc90added a front end elemnt to show Customtts on admin settings page and also changed the getvoices function to respond to /audio/voices endpoint74e8df6This commit allows users to integrate their own external TTS provider by:d42fd9aEND OF THIS BRANCH: Added CustomTTS support with user friendly interface, allowing users to select models and voice from a drop down.241fcceADDED CORS_ALLOW_ORIGIN=http://localhost:5173 to the backend dev.sh script since i was running into a CORS error📊 Changes
6 files changed (+450 additions, -46 deletions)
View changed files
📝
backend/dev.sh(+1 -1)📝
backend/open_webui/config.py(+15 -0)📝
backend/open_webui/main.py(+4 -0)📝
backend/open_webui/routers/audio.py(+197 -0)📝
src/lib/apis/audio/index.ts(+47 -23)📝
src/lib/components/admin/Settings/Audio.svelte(+186 -22)📄 Description
Pull Request
devbranch. (Assuming this is correct)httpx, need to check docs )featChangelog Entry
Description
feat(audio): Add support for user-configurable Custom TTS engine
This pull request introduces a new Text-to-Speech engine option called "CustomTTS". This feature allows users to integrate external TTS services beyond the currently supported options by providing a custom API Base URL and an optional API Key directly within the Open WebUI audio settings. The backend now proxies requests for voice lists and speech synthesis to the configured custom endpoints.
Added
AUDIO_TTS_CUSTOM_TTS_OPEN_API_BASE_URL,AUDIO_TTS_CUSTOM_TTS_OPEN_API_KEY) to store user-defined custom TTS endpoint details./api/v1/audio/voicesdedicated to fetching the voice list from the configured custom TTS service. This endpoint handles the external API call and transforms the response (expected: list of strings) into the standard[{"id": ..., "name": ...}]format for the frontend./api/v1/audio/modelsendpoint to fetch models from the configured custom TTS service URL (<base_url>/models) when the "Custom TTS" engine is active, transforming the response (expected:{"data": [...]}) into the standard format./api/v1/audio/speechendpoint to proxy TTS requests to the configured custom TTS service URL (<base_url>/audio/speech) when the "Custom TTS" engine is selected.httpxfor making asynchronous HTTP requests in the backend/audio/voicesendpoint.Changed
$lib/apis/audio.ts): Consolidated voice fetching logic. ThegetVoicesfunction now accepts anengineTypeand calls the appropriate backend endpoint (/voicesor/audio/voices).main.py): Updated application startup to register the new custom TTS configuration settings with theAppConfiginstance.routers/audio.py): Modified/config(GET) and/config/update(POST) endpoints to handle reading and writing the new custom TTS configuration values, ensuring correct key mapping between frontend payload and backend storage.*.svelte):<input list>/<datalist>with<select>dropdowns for TTS Voice and Model selection for thecustomttsengine (and potentially others) for improved user experience.onMountlogic to correctly initializeTTS_VOICEandTTS_MODELstate based on the loadedTTS_ENGINEto prevent incorrect defaults from showing on page reload.Fixed
KeyErrorin backend config update (/config/update) by aligning variable names used for accessingAppConfigstate during startup (main.py) and update (routers/audio.py).UnboundLocalErrorin backend speech synthesis (/speech) endpoint's error handling by initializing the response variable (r = None) and adding checks (if r is not None) before accessing it inexceptblocks.NameError: name 'httpx' is not definedin/audio/voicesendpoint by adding the necessaryimport httpx.customttsby implementing the necessary backend logic in/modelsand ensuring correct data transformation in/audio/voices.Security
Breaking Changes
Additional Information
/models(for models list, returning{"data": [...]}) and/audio/voices(for voices list, returning{"voices": [...]}). The speech synthesis path is assumed to be/audio/speech.Video Preview
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.