---
title: Voice Cloning API Developer Guide - Integration Tutorial | ModelsLab
description: Step-by-step developer guide for voice cloning API integration. Clone voices from 10s samples, generate multilingual speech. Python and JS examples.
url: https://modelslab-frontend-v2-927501783998.us-east4.run.app/voice-cloning-api-developer-guide
canonical: https://modelslab-frontend-v2-927501783998.us-east4.run.app/voice-cloning-api-developer-guide
type: website
component: Seo/VoiceCloningApiDeveloperGuide
generated_at: 2026-09-18T08:12:03.790224Z
---

Audio Gen

Voice Cloning API Developer Guide
---

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

[Get Voice Cloning API Key](https://modelslab-frontend-v2-927501783998.us-east4.run.app/register) [API Documentation](https://docs.modelslab.com)

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 as little as 3 seconds of reference audio (about 10 seconds is recommended — 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 — 10-30 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

```
<code>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']}")</code>
```

### Create a reusable voice profile (Python)

Python

```
<code>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)</code>
```

### Full integration with async handling (JavaScript)

JavaScript

```
<code>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}`);</code>
```

### Multilingual voice generation

Python

```
<code>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']}")</code>
```

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.

[Start Building ](https://modelslab-frontend-v2-927501783998.us-east4.run.app/register)

Voice Cloning API Providers Compared
---

How ModelsLab voice cloning compares to ElevenLabs and other providers.

| Feature | ModelsLab | ElevenLabs | Play.ht | Resemble AI |
|---|---|---|---|---|
| Min Sample Length | ~3s (10s recommended) | 30 seconds | 30 seconds | 1 minute |
| Languages Supported | 48 | 29 | 30+ | 24 |
| Starting Price | Flat plans from $21/mo | $5/mo (starter) | $39/mo | $24/mo |
| Free Tier | Paid, from $21/mo | 10k chars/mo | Trial only | Trial only |
| Emotional Control | Yes | Yes | Limited | Yes |
| Reusable Voice Profiles | Up to 200 voices | Paid tiers | Yes | Yes |
| Image + Video APIs Too | Same key | No | No | No |
| Webhook Support | Yes | Yes | No | Yes |

Data as of April 2026. Based on publicly available documentation.

### 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 3 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.

Related voice and audio guides
---

[### Voice Cloning API

Overview of ModelsLab voice cloning capabilities.](https://modelslab-frontend-v2-927501783998.us-east4.run.app/voice-cloning) [### ElevenLabs Alternative

Compare ModelsLab with ElevenLabs for voice AI.](https://modelslab-frontend-v2-927501783998.us-east4.run.app/elevenlabs-alternative) [### AI API for Production Apps

Best practices for deploying AI APIs in production.](https://modelslab-frontend-v2-927501783998.us-east4.run.app/ai-api-for-production-apps)

ModelsLab Voice Cloning API Features
---

Key advantages that set us apart

Clone any voice from a ~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:

Personalized Audio ContentMultilingual DubbingCustomer Service BotsE-Learning PlatformsAccessibility ToolsGame and Media Production

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

![Personalized Audio Content](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/0fbacb1a-6e34-4254-0a9d-5e75178cf200/768)

Voice Cloning API Developer FAQ
---

### How long does a voice sample need to be for cloning?

ModelsLab voice cloning requires a minimum of 3 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.

### How many languages does the voice cloning API support?

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.

### Can I use cloned voices in commercial products?

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.

### What audio format does the API return?

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.

### How does ModelsLab voice cloning compare to ElevenLabs?

ModelsLab clones from shorter samples (~10s recommended vs 30s minimum), supports more languages (48 vs 29), and uses flat plans from $21/month rather than character-capped tiers (ElevenLabs caps its free tier at 10k characters/month). ModelsLab also provides image, video, and LLM APIs through the same key. ElevenLabs has a more mature voice library.

### Is the voice cloning API suitable for real-time applications?

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.

### How do I handle errors and retries in production?

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](https://imagedelivery.net/PP4qZJxMlvGLHJQBm3ErNg/28133112-07fe-4c1c-44eb-36948d51ae00/768)

Get Expert Support in Seconds

We're Here to Help.
---

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

Chat with support[View Docs](https://docs.modelslab.com)

Explore Our Other Solutions
---

Unlock your creative potential and scale your business with ModelsLab's comprehensive suite of AI-powered solutions.

[Imagen

### AI Image Generation & Tools

Generate, edit, upscale, and transform images with state-of-the-art AI models.

Explore Imagen](https://modelslab-frontend-v2-927501783998.us-east4.run.app/imagen) [Audio Gen

### AI Audio Generation

Text-to-speech, voice cloning, music generation, and audio processing APIs.

Explore Audio Gen](https://modelslab-frontend-v2-927501783998.us-east4.run.app/audio-gen) [Video Fusion

### AI Video Generation & Tools

Create, edit, and enhance videos with AI-powered generation and transformation tools.

Explore Video Fusion](https://modelslab-frontend-v2-927501783998.us-east4.run.app/video-generation) [Chat

### Engage Seamlessly with LLM

Access powerful language models for chatbots, content generation, and AI assistants.

Explore Chat](https://modelslab-frontend-v2-927501783998.us-east4.run.app/custom-llm) [3D Verse

### Create Stunning 3D Models

Transform images and text into 3D models with advanced AI-powered generation.

Explore 3D Verse](https://modelslab-frontend-v2-927501783998.us-east4.run.app/text-to-3d)

Plugins

Explore Plugins for Pro
---

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

[Explore Plugins](https://modelslab-frontend-v2-927501783998.us-east4.run.app/pro#plugins) [Learn More](https://modelslab-frontend-v2-927501783998.us-east4.run.app/pro)

API

Build Apps with ModelsLab

ML

 API
---

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

[API Documentation](https://docs.modelslab.com) [Playground](https://modelslab-frontend-v2-927501783998.us-east4.run.app/models)

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-09-18*