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.
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the voice |
sample_audio | string | Yes | Base64-encoded audio file |
sample_filename | string | No | Original filename (used for format detection) |
slug | string | No | URL-friendly identifier |
languages | string[] | No | Languages the voice supports (e.g. ["en", "fr"]) |
gender | string | No | Gender label (e.g. "female", "male") |
age | integer | No | Approximate age of the speaker |
tags | string[] | No | Arbitrary tags for filtering |