Clone a voice
Create a cloned voice for your project from recordings of the speaker, with their consent.
MarkdownOn this page
/v1/audio/voicesCreates a voice from recordings of a speaker, for models that support cloning. The request is multipart/form-data. Walkthrough: Speech and voices.
Form fields
filefilerequiredA recording of the speaker. Repeat the field to send several recordings.
namestringrequiredA name for the voice, up to 100 characters.
consentstringrequiredtrue.
modelstringThe speech model to clone for (for example elevenlabs/eleven_multilingual_v2), or a preset. Defaults to @tts.
descriptionstringA note about the voice.
languagestringThe speaker's language.
Example
# consent=true confirms that you have the speaker's permission to clone this voice
curl https://api.getlykia.com/v1/audio/voices \
-H "Authorization: Bearer $LYKIA_API_KEY" \
-F model=elevenlabs/eleven_multilingual_v2 \
-F name="Store narrator" \
-F description="Calm narration voice" \
-F consent=true \
-F file=@sample.mp3import os
import requests
with open("sample.mp3", "rb") as sample:
response = requests.post(
"https://api.getlykia.com/v1/audio/voices",
headers={"Authorization": f"Bearer {os.environ['LYKIA_API_KEY']}"},
data={
"model": "elevenlabs/eleven_multilingual_v2",
"name": "Store narrator",
# You confirm that you have the speaker's permission to clone this voice
"consent": "true",
},
files={"file": ("sample.mp3", sample, "audio/mpeg")},
timeout=120,
)
response.raise_for_status()
voice = response.json()
print(voice["id"], voice["name"]) # use the id as `voice` in speech requests of this projectimport { readFile } from "node:fs/promises";
const form = new FormData();
form.append("model", "elevenlabs/eleven_multilingual_v2");
form.append("name", "Store narrator");
// You confirm that you have the speaker's permission to clone this voice
form.append("consent", "true");
form.append("file", new Blob([await readFile("sample.mp3")], { type: "audio/mpeg" }), "sample.mp3");
const response = await fetch("https://api.getlykia.com/v1/audio/voices", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.LYKIA_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error(`Lykia returned ${response.status}: ${await response.text()}`);
const voice = (await response.json()) as { id: string; name: string };
console.log(voice.id, voice.name); // use the id as `voice` in speech requests of this project{
"id": "lvc_xg3eZdWjqZ19YY04ozRw",
"object": "voice",
"name": "Narrator",
"category": "cloned",
"description": "Calm narration voice",
"provider": "elevenlabs",
"model": "elevenlabs/eleven_multilingual_v2",
"created_at": 1795463459,
"requires_verification": false
}Response
201 with the voice: id (lvc_…), object (voice), name, category (cloned), description, provider, model, created_at and requires_verification (whether the provider wants the speaker to verify the clone before use).
The clone belongs to the key's project and works only there, with the same provider and the same key (Lykia's or your own) it was created with. Cloning is not charged.
Errors
| Status | Code | When |
|---|---|---|
400 | consent_required | consent=true is missing. |
400 | unsupported_model | The model cannot clone voices. |
413 | payload_too_large | A recording is larger than Lykia allows. |
{
"error": {
"message": "Voice cloning requires `consent=true`: you confirm you have the speaker's permission to clone this voice",
"type": "invalid_request_error",
"code": "consent_required",
"status": 400,
"metadata": {
"reason": "invalid_request",
"param": "consent"
}
}
}