Files
moltbot/src
zhixian 6a9301c27d feat(tts): support custom OpenAI-compatible TTS endpoints (#1701)
* feat(tts): support custom OpenAI-compatible TTS endpoints

Add OPENAI_TTS_BASE_URL environment variable to allow using self-hosted
or third-party OpenAI-compatible TTS services like Kokoro, LocalAI, or
OpenedAI-Speech.

Changes:
- Add OPENAI_TTS_BASE_URL env var (defaults to OpenAI official API)
- Relax model/voice validation when using custom endpoints
- Add tts-1 and tts-1-hd to the model allowlist

This enables users to:
- Use local TTS for privacy and cost savings
- Use models with better non-English language support (Chinese, Japanese)
- Reduce latency with local inference

Example usage:
  OPENAI_TTS_BASE_URL=http://localhost:8880/v1

Tested with Kokoro-FastAPI.

* fix: strip trailing slashes from OPENAI_TTS_BASE_URL

Address review feedback: normalize the base URL by removing trailing
slashes to prevent double-slash paths like /v1//audio/speech which
cause 404 errors on some OpenAI-compatible servers.

* style: format code with oxfmt

* test: update tests for expanded OpenAI TTS model list

- Accept tts-1 and tts-1-hd as valid models
- Update OPENAI_TTS_MODELS length expectation to 3

---------

Co-authored-by: zhixian <zhixian@bunker.local>
2026-01-25 08:04:20 +00:00
..
2026-01-18 08:54:00 +00:00
2026-01-25 06:37:39 +00:00
2026-01-25 03:42:32 +00:00
2026-01-21 23:05:11 +00:00
2026-01-24 03:46:27 +00:00
2026-01-24 10:48:33 +00:00
2026-01-21 05:34:53 +00:00
2026-01-25 06:37:39 +00:00
2026-01-24 23:30:45 +00:00
2026-01-23 09:07:43 +00:00
2026-01-24 10:48:33 +00:00
2026-01-21 01:58:47 +00:00
2026-01-18 19:34:21 +00:00
2026-01-18 03:55:14 +00:00