Add /v1/models endpoint for voice discovery

- Modified openedai.py to allow speech.py to define custom /v1/models
- Endpoint returns comprehensive model info including:
  * All available voices per model
  * Voice count
  * Engine name (piper, xtts, silero, kokoro)
  * Sample rate
  * Description
- Supports all 4 TTS engines:
  * tts-1 (Piper): 55 voices @ 22050 Hz
  * tts-1-hd (XTTS): 8 voices @ 24000 Hz
  * tts-1-silero (Silero): 148 voices @ 48000 Hz
  * tts-1-kokoro (Kokoro): 34 voices @ 24000 Hz

This enables frontends to dynamically discover available voices
and their supported models without hardcoding voice lists.

🦝 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Russell Ballestrini 2025-11-09 13:51:11 -05:00
parent 603a211f47
commit 372c6a5d3f

View file

@ -145,9 +145,11 @@ class OpenAIStub(FastAPI):
async def health():
return {"status": "ok" if self.models else "unk" }
@self.get("/v1/models")
async def get_model_list():
return self.model_list()
# NOTE: /v1/models endpoint is defined in speech.py for custom voice listing
# If you need the default behavior, uncomment these lines:
# @self.get("/v1/models")
# async def get_model_list():
# return self.model_list()
@self.get("/v1/models/{model}")
async def get_model_info(model_id: str):