Voice Cloning API

View as Markdown

Sarvam’s Voice Cloning API generates speech in a cloned voice from a short reference clip. Send a 10-15 second recording of a speaker and text to synthesize; the API returns audio in that speaker’s voice, in any of the supported target languages.

Voice Cloning is a single synchronous call: one request in, base64 audio out. It is the right tool when you already know the text and just need it spoken in a specific voice.

Base URL and authentication. See the API Reference for the current base URL and auth header. Generate a key from Key Management in the dashboard.

What one call gives you

How it works

Voice Cloning is synchronous by design: one POST request carries the reference audio and the text, and the response carries the finished audio. There is no job to create, upload, start, or poll.

1

Prepare a reference clip

Pick 10-15 seconds of clean, single-speaker audio. WAV is recommended. See Prepare Reference Audio.

2

Send the request

POST /voices/clone with ref_audio, text, and language_code as a multipart form.

3

Decode the audio

The response returns audio (base64 audio in your chosen codec) and a request_id for support.

Runnable code for the call, in cURL and other languages, is on the endpoint’s page in the API Reference.

Quickstart

Set SARVAM_API_KEY, point ref_audio at a local file, and decode the base64 audio from the response:

curl -s -X POST "https://api.sarvam.ai/voices/clone" \
-H "api-subscription-key: $SARVAM_API_KEY" \
-F "text=नमस्ते, मैं आपकी कैसे मदद कर सकता हूँ?" \
-F "language_code=hi-IN" \
-F "ref_audio=@reference.wav" \
-F "ref_text=Hello, this is a sample reference recording." \
-o response.json
# Decode audio from the response into a WAV file
python3 -c "import base64, json; open('output.wav', 'wb').write(base64.b64decode(json.load(open('response.json'))['audio']))"

The response contains audio (base64 audio in your chosen codec) and request_id. A non-2xx response returns an error envelope with error.code and error.message; see the API Reference for every status code.

Two ways to clone

1. Reference clip

Upload ref_audio directly. This is the simplest path and needs nothing stored anywhere. Optionally pass ref_text - the transcript of the clip - to improve fidelity; if you omit it, the API transcribes the clip automatically.

2. Saved voice

Pass a voice_id from your voice library (format: svc-{uuid}). Create the clone once - either via POST /voices/create (see Manage voices over the API) or in Content Studio (see Creating a Clone) - then copy Voice ID from the clone card under Voice Library → My voices (or Voice Cloning home). See Using a Cloned Voice. The API fetches the stored reference audio and transcript for that voice, so you do not re-upload the clip on every call. This requires your API key to be bound to an organization.

Studio and the API share the same org-scoped library: a voice created in either place appears in My voices and in GET /voices, and is usable from both surfaces.

Send exactly one of ref_audio or voice_id. Providing both returns a 400 error.

Manage voices over the API

The voice library itself is API-manageable - no Studio visit required. The same voices also show up in Content Studio My voices for that org:

EndpointWhat it does
POST /voices/createCreate a cloned voice from a reference clip in one shot. The response returns the new voice_id and the auto-generated transcript (reference_text) together - the voice is ready to use with POST /voices/clone immediately, and appears under Studio My voices.
GET /voicesList the cloned voices in your workspace (filter by name, gender, accent; paginated). Each item’s id is the same value you pass as voice_id on POST /voices/clone.
GET /voices/{voice_id}Full details for one voice, including its transcript and time-limited signed URLs for the reference and preview audio. The path param is the same svc-{uuid} as list id / create voice_id.
DELETE /voices/delete/{voice_id}Delete a voice. Its audio assets are removed and the voice stops being listed or usable in the API and in Studio.

Voice creation is capped by your subscription tier (e.g. 3 voices on the starter tier); deleting a voice frees a slot. Endpoint-level schemas and code samples are in the API Reference.

Limits and pricing

FieldLimit
ref_audio file size10 MB
ref_audio duration30 seconds
ref_text length500 characters

The model is tuned for short reference clips: 10-15 seconds is the sweet spot for clone quality, even though 30 seconds is accepted. text has no enforced character limit - the API splits it into sentences and synthesizes the chunks in parallel, so you do not need to split long scripts yourself.

Pricing is billed per character of text against the text_to_speech_voice_cloning API. See Pricing for the current rate, and Commercial Licensing for the production-rights conditions that apply to cloned voices - including voice-cloning consent.

Voice cloning requires consent. Only clone a voice you have the right to use. See Commercial Licensing for the consent requirements that apply to cloned-voice audio.

Explore

Need help scoping a voice-cloning integration? Reach out on Discord.