- Studio
- Voice
- Text to Speech
Voice cloning
Voice cloning
Voice cloning generates speech in the voice of a recording that you provide, with no training. Clone a voice for a single request, or save it in your workspace and reuse it by its ID.
For how a cloned voice compares with a preset voice, and what it keeps from its recording, see Voices in Concepts.
Prepare a reference clip
The reference clip is the recording of the voice to clone. Check it before you send it:
- Format: an MP3 or WAV file.
- Encoding: the audio itself, base64-encoded. A URL isn't accepted.
- Content:
Zero-shot cloning
Zero-shot cloning reproduces a voice from a short recording, without training. Use the recording for a single request, or save it as a voice in your workspace and reuse it by ID.
Clone a voice for one request
Pass the recording, base64-encoded, as ref_audio. The voice isn't saved.
jq -n --arg ref_audio "$(base64 < voice_sample.mp3 | tr -d '\n')" '{
model: "voxtral-mini-tts-3-0",
input: "Your order shipped this morning and should arrive on Thursday.",
ref_audio: $ref_audio,
response_format: "wav"
}' | curl -s https://api.mistral.ai/v1/audio/speech \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "Content-Type: application/json" \
-d @- | jq -r '.audio_data' | base64 --decode > cloned_one_off.wav
Save a cloned voice
Create a voice from the recording, then pass its ID as voice_id. Saved voices carry a retention_notice field (default 30 days, min 1, max 365). Set it when creating or updating a voice via the API. Voices created from the AI Studio UI default to 30 days.
import base64
import os
from pathlib import Path
from mistralai.client import Mistral
client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])
sample = Path("voice_sample.mp3")
voice = client.audio.voices.create(
name="Support agent",
sample_audio=base64.b64encode(sample.read_bytes()).decode(),
sample_filename=sample.name,
languages=["en"],
)
print(f"Created voice {voice.id}")
response = client.audio.speech.complete(
model="voxtral-mini-tts-3-0",
input="Your order shipped this morning and should arrive on Thursday.",
voice_id=voice.id,
response_format="wav",
)
output = Path("cloned_saved_voice.wav")
output.write_bytes(base64.b64decode(response.audio_data))
print(f"Saved {output.resolve()}")
The examples read the recording from voice_sample.mp3 in the working directory.
To list, rename, or delete a saved voice, see Manage voices.
Use a cloned voice in other languages
A cloned voice isn't limited to the language of its recording. For the supported languages, see Languages.
Professional voice cloning
For best results with professional voice cloning, we recommend 30 minutes to 3 hours of clean, high-quality audio featuring only one speaker. Record in a quiet room with minimal echo, using the same microphone, distance, and setup throughout, because consistency matters more than length. Speak naturally in the style you want the voice to reproduce, and depending on your application, include a range of emotions and expressions; a single flat tone throughout can make the cloned voice sound robotic. Avoid background noise, music, long pauses, or heavy audio processing such as noise reduction or effects.
Going further
Browse voices
Browse the preset voices and manage the voices saved in your workspace through the API.
Style instructions
Steer the delivery of the whole speech output with a short free-form instruction.
Troubleshooting
The errors that speech requests return, the usual causes of speech that sounds wrong, flat, cut short, or slow to start, and the setting that fixes each one.