Unlimited Open Source Models

Get Plan
Skip to main content
Audio Gen

Voice Cloning API Developer Guide

Complete developer guide for integrating voice cloning into your application. Clone voices from 4-second samples, generate multilingual speech, and build voice-powered features.

Last updated · By ModelsLab Engineering

What is the best voice cloning API in 2026?

ElevenLabs is the quality leader, with instant voice cloning from its $6/month Starter plan and speech at $0.05 to $0.10 per 1,000 characters (about $0.045 to $0.09 a minute). Cartesia (from $5/month), Fish Audio, Hume and ModelsLab also clone voices through a public API. Fish Audio is the cheapest of these per minute, at $15 per million bytes of text (about $0.014 a minute). OpenAI, Google Cloud and Azure keep cloning for approved customers, and Amazon Polly has none.

ModelsLab clones a voice from 4 to 10 seconds of reference audio and speaks it in 48 languages, at $0.001 per second of generated audio ($0.06 a minute) on plans from $21/month. The $149/month Open Source Unlimited plan has no per-second charge, so above about 28 hours of speech a month it costs less than ElevenLabs Multilingual. PlayHT, which older guides still recommend, is gone: play.ht did not resolve on September 27, 2026.

Voice Cloning API: The Complete Developer Guide

What is Voice Cloning API Integration?

A voice cloning API lets developers programmatically replicate a voice from a short audio sample and use it to generate speech from any text. ModelsLab voice cloning works from 4 seconds of reference audio (up to 10 seconds are used; longer samples are trimmed) and generates natural, expressive speech in 48 languages.

This developer guide walks through the complete integration process: cloning in a single call, creating reusable voice profiles, handling async processing, error handling, and production best practices.

Prerequisites and Setup

Before you start integrating the voice cloning API:

  • ModelsLab account with API key — create an account at modelslab.com and subscribe to a plan (from $21/month)
  • Audio sample — 4 to 10 seconds of clear speech, WAV or MP3 format, minimal background noise
  • HTTP client — Python requests, Node.js fetch, or any REST-capable language
  • Storage — Somewhere to store generated audio files (S3, GCS, or local filesystem)
  • Webhook endpoint (optional) — For async processing notifications in production

API Architecture Overview

The ModelsLab voice cloning API has two integration paths:

  • One-call cloning — POST to /api/v6/voice/text_to_audio with your text as prompt and a reference sample URL as init_audio. The reference is cloned and the speech is generated in the same request.
  • Reusable voice profiles — POST the sample once to /api/v6/voice/voice_upload (name + init_audio + language) to get a permanent voice_id, then pass that voice_id to text_to_audio instead of re-uploading the sample each time. Accounts can store up to 200 voices.
  • Generation is queued: the response is either status "success" with output audio URLs, or status "processing" with an eta and a fetch_result URL to poll (or pass a webhook to be called when done).
  • Note: /api/v6/voice/text_to_speech is a separate endpoint for the pre-trained voice library only — custom cloned voices generate through text_to_audio.
  • All endpoints are standard REST with JSON payloads. Authentication is via API key in the request body.

Voice Cloning API Code Examples

From voice sample upload to speech generation — production-ready code.

Clone a voice and speak in one call (Python)

Python
1import requests
2
3# One call: clone from a reference sample and generate speech
4url = "https://modelslab.com/api/v6/voice/text_to_audio"
5payload = {
6 "key": "YOUR_API_KEY",
7 "prompt": "Welcome to our platform. We are glad to have you here.",
8 "init_audio": "https://your-storage.com/voice-sample.wav",
9 "language": "english",
10 "emotion": "neutral",
11 "speed": 1.0
12}
13
14response = requests.post(url, json=payload)
15data = response.json()
16
17if data["status"] == "success":
18 print(f"Generated audio: {data['output'][0]}")
19elif data["status"] == "processing":
20 # Queued — poll fetch_result (or pass a webhook instead)
21 print(f"ETA {data['eta']}s, poll: {data['fetch_result']}")

Create a reusable voice profile (Python)

Python
1import time
2
3# Upload the sample once, reuse the voice_id forever.
4# The voice_id is derived from the name and is globally unique —
5# pick a name specific to you.
6url = "https://modelslab.com/api/v6/voice/voice_upload"
7payload = {
8 "key": "YOUR_API_KEY",
9 "name": f"customer-voice-{int(time.time())}",
10 "init_audio": "https://your-storage.com/voice-sample.wav",
11 "language": "english"
12}
13
14data = requests.post(url, json=payload).json()
15if data["status"] != "success":
16 raise RuntimeError(data["message"])
17voice_id = data["voice_id"]
18
19# Generate with the stored profile — no re-upload needed
20payload = {
21 "key": "YOUR_API_KEY",
22 "prompt": "Welcome back. Here is today's update.",
23 "voice_id": voice_id,
24 "language": "english"
25}
26data = requests.post(
27 "https://modelslab.com/api/v6/voice/text_to_audio", json=payload
28).json()
29print(data["output"][0] if data["status"] == "success" else data)

Full integration with async handling (JavaScript)

JavaScript
1async function cloneVoiceAndSpeak(sampleUrl, text) {
2 const res = await fetch('https://modelslab.com/api/v6/voice/text_to_audio', {
3 method: 'POST',
4 headers: { 'Content-Type': 'application/json' },
5 body: JSON.stringify({
6 key: 'YOUR_API_KEY',
7 prompt: text,
8 init_audio: sampleUrl,
9 language: 'english'
10 })
11 });
12
13 let data = await res.json();
14 if (data.status === 'error') throw new Error(data.message);
15
16 // Queued generation: poll fetch_result until the audio is ready
17 while (data.status === 'processing') {
18 await new Promise((r) => setTimeout(r, (data.eta || 5) * 1000));
19 const poll = await fetch(data.fetch_result, {
20 method: 'POST',
21 headers: { 'Content-Type': 'application/json' },
22 body: JSON.stringify({ key: 'YOUR_API_KEY' })
23 });
24 data = await poll.json();
25 }
26
27 if (data.status !== 'success') throw new Error(data.message || data.status);
28 return data.output[0]; // Audio URL
29}
30
31// Usage
32const audioUrl = await cloneVoiceAndSpeak(
33 'https://storage.example.com/sample.wav',
34 'This is generated speech using a cloned voice.'
35);
36console.log(`Audio: ${audioUrl}`);

Multilingual voice generation

Python
1# Generate the same cloned voice in multiple languages
2texts = {
3 "english": "Hello, welcome to our service.",
4 "spanish": "Hola, bienvenido a nuestro servicio.",
5 "french": "Bonjour, bienvenue dans notre service.",
6 "german": "Hallo, willkommen bei unserem Service.",
7 "japanese": "こんにちは、サービスへようこそ。"
8}
9
10for lang, text in texts.items():
11 payload = {
12 "key": "YOUR_API_KEY",
13 "prompt": text,
14 "voice_id": voice_id, # from voice_upload
15 "language": lang
16 }
17 response = requests.post("https://modelslab.com/api/v6/voice/text_to_audio", json=payload)
18 data = response.json()
19 print(f"{lang}: {data['output'][0] if data['status'] == 'success' else data['fetch_result']}")

Integration Workflow

Build voice cloning into your app in three steps.

STEP 01
STEP 01

Step 1: Create a Voice Profile

Upload a ~10 second sample of clear speech to voice_upload. The API stores the sample and returns a voice_id — a reusable identifier for all future generation with that voice. (Or skip this step and pass the sample directly as init_audio.)

STEP 02
STEP 02

Step 2: Generate Speech

Send any text as prompt along with the voice_id (or init_audio) to text_to_audio. Receive generated audio as a URL (reference audio can also be sent as base64 via the base64 parameter). Supports speed, emotion, and language controls.

STEP 03
STEP 03

Step 3: Production Integration

Use webhooks for async processing, cache voice profiles, implement error handling and retries, and add multilingual support. Scale to thousands of voice generations per day.

Voice Cloning API Providers Compared

Who clones voices through a public API, what sample it needs, and what speech costs. Per-minute figures assume about 900 characters per minute.

ProviderCloning through the APISample neededEntry priceSpeech price (about per minute)
ModelsLabEvery plan: init_audio per call, or a reusable voice_id4 to 10 seconds$21/month$0.001 per second ($0.06); none on the $149 plan
ElevenLabsInstant from Starter; Professional from CreatorA few minutes recommended$6/month$0.05 to $0.10 per 1K characters ($0.045 to $0.09)
CartesiaInstant from Pro; Professional from StartupNot published$5/month$38 to $65 per 1M credits ($0.034 to $0.059)
Fish AudioCreate Model APIAt least 10 seconds per clip recommendedNo subscription$15 per 1M UTF-8 bytes (about $0.014)
HumeEvery planNot published$3/month$0.05 to $0.15 per 1K characters over the plan
Resemble AIBusiness plan or higherRapid Clone from 10 secondsBusiness planNot published
OpenAIEligible customers, through salesUp to 30 seconds plus a consent recording—tts-1 $15 per 1M characters (about $0.014)
Google CloudInstant Custom Voice, allow-listedUp to 10 seconds—$60 per 1M characters (about $0.054)
Azure AI SpeechPersonal Voice, limited accessNot published—$24 per 1M characters (about $0.022)
PlayHTNo longer available———

Checked September 27, 2026 on elevenlabs.io/pricing/api, cartesia.ai/pricing, docs.fish.audio (pricing and voice cloning guide), hume.ai/pricing, resemble.ai/products/voice-creation, developers.openai.com/api/docs/pricing, cloud.google.com/text-to-speech/pricing and the Azure retail prices API. Per-minute figures are our arithmetic. ModelsLab bills $0.001 per second of audio with a $0.0047 minimum per request.

Production Best Practices

When deploying voice cloning in production applications:

  • Cache voice profiles — Upload the sample once via voice_upload and reuse the voice_id. Do not re-upload samples for each generation.
  • Use webhooks for async — Generation is queued with an ETA of roughly 10 seconds. Pass a webhook URL instead of polling fetch_result in production.
  • Handle errors gracefully — Validation and generation errors return status "error" with a message in the JSON body. Implement retry logic with exponential backoff.
  • Validate audio samples — At least 4 seconds of clear speech with minimal background noise; only the first ~10 seconds of the reference are used for cloning.
  • Store generated audio — Download output URLs into your own storage (S3, GCS). Pass temp: true if you want the platform to write to temporary storage instead.
  • Monitor usage — Track API calls and generation quality. Use ModelsLab dashboard for usage analytics.

Authentication and Rate Limits

The ModelsLab voice cloning API uses API key authentication passed in the request body. Plans start at $21/month (Basic, 3,250 API calls) and scale to thousands of concurrent requests on higher tiers. Errors — including rate limits — are returned as JSON with status "error" and a descriptive message, so check the status field of every response rather than relying on HTTP status codes.

For enterprise workloads, dedicated instances provide guaranteed throughput and custom rate limits. Contact sales for SLA-backed voice cloning infrastructure.

ModelsLab Voice Cloning API Features

Key advantages that set us apart

Clone any voice from a 4-to-10-second sample
48 languages supported for multilingual generation
Emotion control: neutral, happy, sad, angry, dull
Reusable voice profiles — store up to 200 voices
Webhook callbacks for async processing
Plans start at $21/month (Basic, 3,250 API calls)
Same API key for voice + image + video + LLM
Python and JavaScript code examples
Production-ready error handling and retry logic
GDPR-compliant with configurable data retention
Enterprise SLA with dedicated instances
Audio output as URL; base64 reference-audio input

Our Popular Use Cases

What developers build with the voice cloning API:

Generate podcast intros, audiobook narrations, and personalized voice messages using cloned voices. Scale audio content creation.

Personalized Audio Content

Voice Cloning API Developer FAQ

ElevenLabs for voice quality and library size, with instant cloning from its $6/month Starter plan. Fish Audio for the lowest price per minute with cloning (about $0.014 a minute at $15 per million bytes). Cartesia for low-latency voices from $5/month. ModelsLab when you want cloning from a 4-second sample in 48 languages on the same key as image, video and LLM APIs, at $0.001 per second of audio, or with no per-second charge on the $149/month plan. Prices checked 2026-09-27.

No. play.ht did not resolve on September 27, 2026, and its API is no longer reachable, so integrations built on it need a new provider. ElevenLabs, Cartesia, Fish Audio, Hume and ModelsLab all clone voices through a public API.

ModelsLab voice cloning requires a minimum of 4 seconds of clear speech, and about 10 seconds is recommended — only the first ~10 seconds of the reference are used, so longer samples are trimmed. Provide clear speech with minimal background noise. WAV and MP3 formats are supported.

ModelsLab voice cloning API supports 48 languages for speech generation, passed as full names in the language parameter (e.g. "english", "spanish", "japanese"). The cloned voice maintains its characteristics across languages, so one sample can speak English, Spanish, French, German, Japanese, and more.

Yes. ModelsLab voice cloning API can be used in commercial applications. Ensure you have appropriate consent from the voice owner. ModelsLab provides usage rights for voices generated through the API for commercial use.

The voice cloning API returns generated audio as publicly accessible URLs. Download and store the files in your own storage for permanent access, or pass temp: true to write to temporary storage. If your reference sample is not hosted anywhere, send it as base64 in init_audio with base64: true.

ElevenLabs has the more mature voice library and instant cloning from its $6/month Starter plan, with speech at $0.05 to $0.10 per 1,000 characters (about $0.045 to $0.09 a minute). ModelsLab clones from 4 to 10 seconds of audio in 48 languages, bills $0.001 per second of audio ($0.06 a minute) on plans from $21/month, and has no per-second charge on the $149/month Open Source Unlimited plan, which is cheaper than ElevenLabs Multilingual above about 28 hours of speech a month. The same key also covers image, video and LLM APIs. Prices checked 2026-09-27.

Voice cloning generation is asynchronous with an ETA of roughly 10 seconds — responses return either the finished audio or a fetch_result URL to poll, and webhooks notify your app when generation completes. For live conversational audio, ModelsLab provides a separate voice-call API.

Check the status field of every JSON response: "error" carries a descriptive message (including rate limits), "processing" means poll fetch_result or wait for your webhook, and "failed" means the generation did not complete. Implement exponential backoff with 3-5 retries and monitor with the ModelsLab dashboard for usage analytics and error rates.

Your Data is Secure: GDPR Compliant AI Services

ModelsLab GDPR Compliance Certification Badge

GDPR Compliant

Get Expert Support in Seconds

We're Here to Help.

Want to know more? You can email us anytime at support@modelslab.com

View Docs
Plugins

Explore Plugins for Pro

Our plugins are designed to work with the most popular content creation software.

API

Build Apps with
ML
API

Use our API to build apps, generate AI art, create videos, and produce audio with ease.