DEV Community

Cover image for Mimo TTS API Guide: How to Use Xiaomi Text-to-Speech, Voice Clone & Voice Design (2026)
TokenPAPA
TokenPAPA

Posted on • Originally published at doc.tokenpapa.ai

Mimo TTS API Guide: How to Use Xiaomi Text-to-Speech, Voice Clone & Voice Design (2026)

Mimo TTS API Guide: How to Use Xiaomi Text-to-Speech, Voice Clone & Voice Design

This guide covers everything you need to integrate Xiaomi's Mimo TTS models into your application. All three models are completely free on TokenPAPA.


Prerequisites

  • A TokenPAPA account (sign up free)
  • Your API key from the dashboard
  • Python 3.8+ with the OpenAI library
pip install openai
Enter fullscreen mode Exit fullscreen mode

1. Basic Text-to-Speech (mimo-v2.5-tts)

The standard TTS model converts text to natural speech with multiple voice options.

from openai import OpenAI

client = OpenAI(
    base_url="https://tokenpapa.ai/v1",
    api_key="your-tokenpapa-key"
)

# Basic speech generation
response = client.audio.speech.create(
    model="mimo-v2.5-tts",
    voice="alloy",
    input="Welcome to TokenPAPA! Xiaomi Mimo TTS is fast and completely free.",
)

# Save as MP3
response.stream_to_file("welcome.mp3")
print("✅ Speech saved to welcome.mp3")
Enter fullscreen mode Exit fullscreen mode
curl https://tokenpapa.ai/v1/audio/speech \
  -H "Authorization: Bearer *** \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mimo-v2.5-tts",
    "input": "Xiaomi Mimo TTS is completely free on TokenPAPA.",
    "voice": "alloy",
    "response_format": "mp3",
    "speed": 1.0
  }' \
  --output speech.mp3
Enter fullscreen mode Exit fullscreen mode

Available Voice Options

Voice Description
alloy Balanced, neutral voice
echo Deeper, resonant tone
fable Soft, storytelling style
onyx Deep, authoritative voice
nova Warm, friendly female voice
shimmer Clear, bright voice

Adjusting Speed and Format

response = client.audio.speech.create(
    model="mimo-v2.5-tts",
    voice="nova",
    input="This is a slower, clearer narration example.",
    speed=0.8,                 # Speed: 0.25 to 4.0
    response_format="wav",     # mp3, wav, flac, opus
)
Enter fullscreen mode Exit fullscreen mode

2. Voice Cloning (mimo-v2.5-tts-voiceclone)

Clone any voice from an audio sample. The model learns the unique characteristics of a speaker's voice and can generate new speech that sounds like them.

How It Works

  1. Prepare your audio sample — a clean recording of 10–30 seconds of speech
  2. Send it to the voice clone model with the text you want spoken
  3. Receive the cloned voice output
from openai import OpenAI

client = OpenAI(
    base_url="https://tokenpapa.ai/v1",
    api_key="your-tokenpapa-key"
)

# Read the reference audio file
with open("reference_speech.mp3", "rb") as f:
    audio_bytes = f.read()

audio_base64 = base64.b64encode(audio_bytes).decode("utf-8")

# Generate speech in the cloned voice
response = client.audio.speech.create(
    model="mimo-v2.5-tts-voiceclone",
    voice="alloy",  # Not used by clone model
    input="This speech is in the cloned voice! Listen to how natural it sounds.",
    extra_body={
        "reference_audio": audio_base64,
    }
)

response.stream_to_file("cloned_output.mp3")
Enter fullscreen mode Exit fullscreen mode

Tips for best voice clone quality:

  • Use a quiet recording environment (no background noise)
  • Keep samples between 10–30 seconds
  • Use a consistent speaking pace
  • Avoid multiple speakers in one sample
  • Higher quality input = better clone output

3. Voice Design (mimo-v2.5-tts-voicedesign)

Create entirely synthetic voices by describing the characteristics you want. No audio sample needed.

from openai import OpenAI

client = OpenAI(
    base_url="https://tokenpapa.ai/v1",
    api_key="your-tokenpapa-key"
)

# Design a custom voice by describing its characteristics
response = client.audio.speech.create(
    model="mimo-v2.5-tts-voicedesign",
    voice="alloy",
    input="Hello! I am a custom-designed voice created by Xiaomi Mimo.",
    extra_body={
        "voice_description": "A warm, friendly middle-aged male voice with a slight British accent. Calm and professional tone, suitable for corporate narration."
    }
)

response.stream_to_file("designed_voice.mp3")
Enter fullscreen mode Exit fullscreen mode

Voice Design Parameters You Can Specify

Parameter Examples
Gender male, female, neutral
Age young, middle-aged, elderly
Accent British, American, neutral, Chinese
Tone warm, professional, cheerful, serious, soothing
Style conversational, authoritative, storytelling, instructional
Pitch low, medium, high
Speed slow, normal, fast

4. Streaming Audio (Real-Time)

All three Mimo TTS models support real-time audio streaming. This is useful for voice assistants, real-time translation, and live narration.

from openai import OpenAI

client = OpenAI(
    base_url="https://tokenpapa.ai/v1",
    api_key="your-tokenpapa-key"
)

# Stream audio in real-time
with client.audio.speech.with_streaming_response.create(
    model="mimo-v2.5-tts",
    voice="alloy",
    input="This is streaming audio from Xiaomi Mimo TTS. It plays in real time.",
) as response:
    with open("streamed_speech.mp3", "wb") as f:
        for chunk in response.iter_bytes():
            f.write(chunk)

print("✅ Streaming complete")
Enter fullscreen mode Exit fullscreen mode

5. Error Handling

from openai import OpenAI, APIError

client = OpenAI(
    base_url="https://tokenpapa.ai/v1",
    api_key="your-tokenpapa-key"
)

try:
    response = client.audio.speech.create(
        model="mimo-v2.5-tts",
        voice="alloy",
        input="Hello, world!",
    )
    response.stream_to_file("output.mp3")

except APIError as e:
    print(f"API Error: {e.status_code} - {e.message}")
except Exception as e:
    print(f"Error: {e}")
Enter fullscreen mode Exit fullscreen mode

Quick Reference

Model Endpoint Purpose Cost
mimo-v2.5-tts /v1/audio/speech Standard TTS Free
mimo-v2.5-tts-voiceclone /v1/audio/speech Voice cloning Free
mimo-v2.5-tts-voicedesign /v1/audio/speech Voice design Free

All models support: mp3, wav, flac, opus output formats.
Streaming support: Yes (SSE-based).


Next Steps

  1. Sign up for TokenPAPA — free account, no Chinese phone needed
  2. Get your API key from the dashboard
  3. Try the code examples above — they cost nothing

Need help? The TokenPAPA API documentation covers every endpoint in detail.


Originally published at https://doc.tokenpapa.ai/en/docs/blog/mimo-tts-api-guide.

Top comments (0)