Generates speech in a cloned voice from a reference audio clip or a saved cloned voice.
Accepts `multipart/form-data` - send `ref_audio` as a file upload and all other parameters as form fields.
**Two ways to clone:**
1. **Reference clip** - upload `ref_audio` (optionally with its transcript in `ref_text`).
2. **Saved voice** - pass a `voice_id` from your voice library; the stored reference audio and transcript are reused.
**Base URL:** `https://api.sarvam.ai`.
**Auth:** send your key in the `api-subscription-key` header (recommended); `Authorization: Bearer <key>` is also accepted.
The cloned voice is cross-lingual: the reference clip's language does not need to match `language_code`. The model preserves the speaker's timbre and identity while applying the phonetics and prosody of the target language.
**Billing:** charged per character of `text` against the `text_to_speech_voice_cloning` API. See the [pricing page](https://docs.sarvam.ai/api/getting-started/pricing).
Request
This endpoint expects a multipart form containing an optional file.
ref_audiofileOptional
Reference audio file for voice cloning. Supported formats: WAV, MP3, FLAC, OPUS, AAC, MULAW, ALAW, LINEAR16. WAV is recommended for best quality and fastest decoding.
Limits: max file size 10 MB, max duration 30 seconds. Recommended duration is 10-15 seconds, single speaker, minimal background noise.
Either `ref_audio` or `voice_id` is required. Sending both returns a 400 error.
voice_idstring or nullOptional
Cloned voice ID (`svc-{uuid}`) from your voice library, created via the Content Studio Voice Library. When provided, the reference audio stored for that voice is used and `ref_audio` is not needed. Requires your API key to be bound to an organization. Sending both `ref_audio` and `voice_id` returns a 400 error.
textstringRequired1-1000 characters
Text to synthesize in the cloned voice. Native scripts and code-mixed text are supported. Maximum 1000 characters; longer text is rejected with a 400. Split longer input client-side and synthesize it in parts.
language_codeenumRequired
BCP-47 language code for the synthesized output. The cloned voice can speak any supported language, regardless of the reference clip's language (cross-lingual cloning).
**Available Options:**
- `as-IN`: Assamese
- `bn-IN`: Bengali
- `en-IN`: English (Indian)
- `gu-IN`: Gujarati
- `hi-IN`: Hindi
- `kn-IN`: Kannada
- `ml-IN`: Malayalam
- `mr-IN`: Marathi
- `od-IN`: Odia
- `pa-IN`: Punjabi
- `ta-IN`: Tamil
- `te-IN`: Telugu
pacedouble or nullOptional0.5-2
Speech speed multiplier. 1.0 is natural speed; 0.5 to 2.0 is accepted. Speed is adjusted without changing pitch. Mutually exclusive with max_audio_duration - sending both returns a 400 error.
ref_textstring or nullOptional<=500 characters
Transcript of the reference audio. Optional: when omitted with a `ref_audio` upload, the API transcribes the reference clip automatically. Providing the actual transcript improves fidelity, especially for cross-lingual cloning. Maximum length is 500 characters. When using `voice_id`, the stored reference transcript is used unless you override it here.
output_audio_codecenum or nullOptionalDefaults to wav
Audio codec for the output audio. Default is `wav`.
- `wav`: Uncompressed. Best quality for downstream processing.
- `mp3`: Smaller file size; suitable for web playback.
- `flac`: Lossless compression.
- `opus`: Low-bitrate codec ideal for streaming. When `speech_sample_rate` is explicitly set with `opus`, it must be one of 8000, 16000, 24000 or 48000 Hz; when omitted, opus output is returned at the native 24000 Hz.
- `aac`: Common in mobile and broadcast.
- `linear16`: Raw 16-bit PCM.
- `mulaw` / `alaw`: 8-bit telephony codecs for IVR pipelines.
speech_sample_rateenum or nullOptional
Output sample rate in Hz. Supported values are 8000, 16000, 22050, 24000, 32000, 44100, 48000. If omitted, the API returns 24000 Hz. This is a service-side default: the output is resampled to it, so it does not change with the generating model. Set it to match your downstream pipeline: 8000 for telephony/IVR, 16000 for voice agents, 24000 for web playback, 44100/48000 for broadcast.
enable_qcbooleanOptionalDefaults to true
Enable quality control: ASR transcription of the generated audio, character error rate (CER) scoring against the input text, and prompt-leak detection with bounded regeneration. Applies to single-chunk (short) generations; long text that is split into sentence chunks is generated without QC. Recommended for production use; disable only when you need the lowest latency or run your own downstream verification.
enable_cached_responsesbooleanOptionalDefaults to false
Enable response caching. Coming soon - accepted for forward compatibility, currently ignored.
enable_vadbooleanOptionalDefaults to true
Enable VAD-based silence trimming of the generated audio. Default is true. Applies to single-chunk (short) generations; long text that is split into sentence chunks is returned untrimmed.
enable_text_normalizationboolean or nullOptional
Enable pre-TTS text normalization: numbers, currencies and dates are converted to their spoken form before synthesis (e.g. 9840950950 becomes the spoken digit sequence). Defaults to the server-side setting. Supported for all 12 languages accepted by language_code; any other code passes through unchanged.
min_audio_durationdouble or nullOptional
Minimum output audio duration in seconds. If the generated audio is shorter, it is padded with silence.
max_audio_durationdouble or nullOptional
Maximum output audio duration in seconds. If the generated audio is longer, it is time-stretched to fit. Must be >= min_audio_duration. Silently floored to the reference clip’s duration when the clip is longer. Mutually exclusive with pace - sending both returns a 400 error.
ref_audio_durationdouble or nullOptional
Override for the reference audio duration in seconds. Useful for dubbing/sync scenarios where the model should treat the reference as a specific length.
Response
Successful Response
audiostring
Base64-encoded output audio in the requested codec.
request_idstring
Unique request identifier for debugging and support.
audio_durationdouble or nullOptional
Duration of the generated audio in seconds.