feat: Add OpenAI-compatible TTS endpoint and engines

- Implements POST /v1/audio/speech endpoint (OpenAI API compatible).
- Integrates Kokoro and XTTS engines (including dependencies and implementations).
- Updates main application to register new engines and router.
- Adds unit tests for OpenAI compatibility.
- Updates requirements.txt for new engines.
This commit is contained in:
2025-12-09 12:45:17 +01:00
parent c06fd677dc
commit fff0252d52
9 changed files with 985 additions and 3 deletions

View File

@ -19,11 +19,22 @@ class Settings(BaseSettings):
ACTIVE_ENGINES: Set[str] = {"piper"}
ASSET_DIR: str = "app/asset"
AUDIO_CACHE_DIR: str = "app/asset/audio"
MODELS_DIR: str = "app/models"
LOG_LEVEL: str = "INFO" # Added log level setting
# Piper Engine Timeouts (in seconds)
PIPER_TIMEOUT_SECONDS: int = 30
FFMPEG_TIMEOUT_SECONDS: int = 60
# Kokoro Engine Configuration
KOKORO_DEVICE: str = "cuda" # or "cpu"
KOKORO_TIMEOUT_SECONDS: int = 30
# Coqui XTTS Engine Configuration
XTTS_DEVICE: str = "cuda" # or "cpu"
XTTS_ACCEPT_LICENSE: bool = False # User must opt-in
VOICES_DIR: str = "app/asset/voices" # Directory for reference speaker wavs
model_config = SettingsConfigDict(env_file=".env", env_file_encoding='utf-8')
settings = Settings()