readest icon indicating copy to clipboard operation
readest copied to clipboard

Custom TTS incompatible with chat-completions format (e.g. Xiaomi MiMo mimo-v2.5-tts)

Open Hr-byte-art opened this issue 1 month ago • 2 comments

Problem

Readest's Custom TTS feature only supports the OpenAI /v1/audio/speech endpoint format (POST {baseUrl}/audio/speech). However, some TTS providers — notably Xiaomi MiMo's mimo-v2.5-tts — expose TTS through the chat completions endpoint (POST {baseUrl}/v1/chat/completions) instead, returning base64-encoded audio in the response body.

This means there is no valid Base URL a user can configure to make these services work:

  • Setting baseUrl to https://api.xiaomimimo.com/v1 causes Readest to call https://api.xiaomimimo.com/v1/audio/speech, which returns 404.
  • Setting baseUrl to https://api.xiaomimimo.com/v1/chat/completions causes Readest to append /audio/speech to it, producing an invalid URL that returns 400.

MiMo TTS request format (working)

POST https://api.xiaomimimo.com/v1/chat/completions
Authorization: Bearer <api_key>
Content-Type: application/json

{
  "model": "mimo-v2.5-tts",
  "messages": [
    { "role": "user", "content": "请朗读以下内容" },
    { "role": "assistant", "content": "<text to speak>" }
  ],
  "modalities": ["text", "audio"],
  "audio": { "voice": "茉莉", "format": "mp3" }
}

Response: choices[0].message.audio.data contains base64-encoded MP3 audio.

Available voices (returned in error message): mimo_default, 冰糖, 茉莉, 苏打, 白桦, Mia, Chloe, Milo, Dean

Suggestion

Add a format field to CustomTTSService (values: 'openai' default, 'chat') so users can select the appropriate protocol. When format is 'chat', the provider would send the chat-completions request above and decode the base64 audio from the response. This would also benefit other providers that use the same pattern.

Environment

  • Readest version: 0.12.16 (macOS arm64)
  • Provider: Xiaomi MiMo (https://api.xiaomimimo.com)

Hr-byte-art avatar Oct 19 '26 02:10 Hr-byte-art

How about adding a specific custom TTS type option for MiMo, similar to what we currently have in the Add Custom Translator menu? Since MiMo seems to be the only TTS service that uses the chat-completions format, adding an entire generic chat-completions format option feels like overkill.

54wedge avatar Oct 19 '26 03:10 54wedge

Fixed by #6863 and #6906. Custom TTS now sends any service on xiaomimimo.com to /v1/chat/completions, so there is no format option to set. Both URLs from this report work: https://api.xiaomimimo.com/v1 and https://api.xiaomimimo.com/v1/chat/completions, as does the bare host.

Checked against the live MiMo API: with model mimo-v2.5-tts, all three base URL forms returned MP3 audio (冰糖 reading Chinese; Mia reading English with style instructions). The settings Test button and Read Aloud in a book worked in the web app. The eight preset voices appear in the voice picker without a voice-list request.

To set it up: Settings → Read Aloud → Custom TTS Services → Add, with base URL https://api.xiaomimimo.com/v1, model mimo-v2.5-tts and your MiMo API key. It will be in the next release. If it fails there, please reopen with the error the Test button shows.

chrox avatar Oct 20 '26 08:10 chrox