Voices

Save audio samples as reusable voices. Once created, a voice can be referenced by voice_id in any speech generation request, avoiding the need to pass ref_audio each time.

warning

Voice cloning usage policy: By using this model and its voice cloning feature, you agree to comply with all applicable laws and our usage policy. You are not authorized to use this model for any unlawful purpose, including to impersonate others, clone voices without explicit consent, or engage in fraud, deception, misinformation, disinformation, harm, or the generation of unlawful, harmful, libelous, abusive, harassing, discriminatory, hateful, or privacy-invasive content. You must disclose AI-generated or partially AI-generated content where required by law. We disclaim all liability for non-compliant use.

Create a voice by providing a name and a base64-encoded audio sample. The audio sample is used for voice cloning and can be retrieved later via get_sample_audio.

import base64
from pathlib import Path
from mistralai.client import Mistral

client = Mistral(api_key="your-api-key")

sample_audio_b64 = base64.b64encode(Path("sample.mp3").read_bytes()).decode()

voice = client.audio.voices.create(
    name="my-voice",
    sample_audio=sample_audio_b64,
    sample_filename="sample.mp3",
    languages=["en", "fr"],
    gender="female",
)

print(f"Created voice: {voice.id}")
print(f"Name: {voice.name}")
print(f"Languages: {voice.languages}")

Parameters:

ParameterTypeRequiredDescription
namestringYesDisplay name for the voice
sample_audiostringYesBase64-encoded audio file
sample_filenamestringNoOriginal filename (used for format detection)
slugstringNoURL-friendly identifier
languagesstring[]NoLanguages the voice supports (e.g. ["en", "fr"])
genderstringNoGender label (e.g. "female", "male")
ageintegerNoApproximate age of the speaker
tagsstring[]NoArbitrary tags for filtering