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.

i
Information

For how a cloned voice compares with a preset voice, and what it keeps from its recording, see Voices in Concepts.

API reference — POST /v1/audio/speech API reference — POST /v1/audio/voices
Prepare a reference clip

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

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

Clone a voice for one request

Pass the recording, base64-encoded, as ref_audio. The voice isn't saved.

import base64
import os
from pathlib import Path

from mistralai.client import Mistral

client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])

reference = Path("voice_sample.mp3")
response = client.audio.speech.complete(
    model="voxtral-mini-tts-3-0",
    input="Your order shipped this morning and should arrive on Thursday.",
    ref_audio=base64.b64encode(reference.read_bytes()).decode(),
    response_format="wav",
)

output = Path("cloned_one_off.wav")
output.write_bytes(base64.b64decode(response.audio_data))
print(f"Saved {output.resolve()}")
Save a cloned voice

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.

i
Information
Use a cloned voice in other languages

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

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.

Share a cloned voice

Share a cloned voice

Saved voices, including cloned ones, can be shared within your workspace. Sharing is managed in AI Studio: workspace admins control whether a voice is private or shared with the workspace. The sharing API endpoints are internal for now; sharing is done through the AI Studio interface.

Going further

Going further