Ses klonlama
Konuşmacının kayıtlarından, onun rızasıyla projeniz için klonlanmış bir ses oluşturun.
MarkdownBu sayfada
/v1/audio/voicesKlonlamayı destekleyen modeller için bir konuşmacının kayıtlarından ses oluşturur. İstek multipart/form-data'dır. Adım adım anlatım: Seslendirme ve sesler.
Form alanları
filefilezorunluKonuşmacının bir kaydı. Birden çok kayıt için alanı yineleyin.
namestringzorunluSesin adı; en çok 100 karakter.
consentstringzorunlutrue.
modelstringKlonun yapılacağı seslendirme modeli (örneğin elevenlabs/eleven_multilingual_v2) ya da bir hazır ayar. Varsayılan @tts.
descriptionstringSes hakkında not.
languagestringKonuşmacının dili.
Örnek
# 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
}Yanıt
Sesle birlikte 201: id (lvc_…), object (voice), name, category (cloned), description, provider, model, created_at ve requires_verification (sağlayıcı kullanımdan önce konuşmacının klonu doğrulamasını istiyor mu).
Klon anahtarın projesine aittir ve yalnız orada, oluşturulduğu sağlayıcı ve anahtarla (Lykia'nın ya da sizin) çalışır. Klonlama ücretlendirilmez.
Hatalar
| Durum | Kod | Ne zaman |
|---|---|---|
400 | consent_required | consent=true yok. |
400 | unsupported_model | Model ses klonlayamıyor. |
413 | payload_too_large | Bir kayıt Lykia'nın izin verdiğinden büyük. |
{
"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"
}
}
}