From a58d6edd7913e0eedf60b8047b32d2227a63fdfe Mon Sep 17 00:00:00 2001 From: Richard Roberson Date: Fri, 11 Apr 2025 21:50:08 -0600 Subject: [PATCH] Add voices endpoint (for support with OpenReader-WebUI) (#22) --- app.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app.py b/app.py index 95d908a..3bb7c61 100644 --- a/app.py +++ b/app.py @@ -130,6 +130,18 @@ async def create_speech_api(request: SpeechRequest): filename=f"{request.voice}_{timestamp}.wav" ) +@app.get("/v1/audio/voices") +async def list_voices(): + """Return list of available voices""" + if not AVAILABLE_VOICES or len(AVAILABLE_VOICES) == 0: + raise HTTPException(status_code=404, detail="No voices available") + return JSONResponse( + content={ + "status": "ok", + "voices": AVAILABLE_VOICES + } + ) + # Legacy API endpoint for compatibility @app.post("/speak") async def speak(request: Request):