docs

Voice cloning

Clone any voice from a few seconds of reference audio.

Encode once, reuse forever

Cloning is zero-shot: give the model a few seconds of reference speech and it speaks new text in that voice, in any supported language. The reference is turned into compact codec codes once; cache those and skip re-encoding on every request.

POST/v1/audio/encode
curl -X POST https://platform.kenpathlabs.com/v1/audio/encode \
  -H "Authorization: Bearer $SVARA_API_KEY" \
  -F "file=@reference.wav" \
  > reference_codes.json          # { "codes": [ ... ] } - cache this
Use 6-15 seconds of clean, single-speaker speech with little background noise. Quality of the clone tracks quality of the reference.

Cloning per request

Pass mode: "voice_clone" with the cached reference_codes (fast path), or send reference_audio as base64 to encode inline. In clone mode the voice field is ignored.

import json
codes = json.load(open("reference_codes.json"))["codes"]

audio = client.audio.speech.create(
    model="svara-1",
    input="This is my cloned voice, now speaking in a new language.",
    response_format="mp3",
    extra_body={"mode": "voice_clone", "reference_codes": codes},
)
audio.write_to_file("cloned.mp3")

Saved custom voices

Prefer to register a reusable named voice? The ElevenLabs-compatible instant-voice-cloning route persists the clone server-side, after which it works by id or name in any TTS call on either dialect:

from elevenlabs.client import ElevenLabs
el = ElevenLabs(base_url="https://platform.kenpathlabs.com", api_key=SVARA_API_KEY)

v = el.voices.ivc.create(name="My Voice", files=[open("reference.wav", "rb")])
el.text_to_speech.convert(voice_id=v.voice_id, text="Saved and reusable.")

Manage saved clones (including in the browser) from the console Voices page.

Quality tips

  • Don’t lower the cloning temperature. The default is tuned to be collapse-proof; reducing it breaks long-form and cross-lingual cloning. Leave sampling knobs unset.
  • Cache reference_codes client-side and reuse across requests; encoding is the only per-reference cost.
  • One speaker per reference. Overlapping voices or music in the clip degrade the clone.
  • Cloned voices carry across languages: a reference recorded in one language can speak any of the 56.