Skip to Content
EnglishAPI ReferenceSynchronous Voice Cloning

Synchronous Voice Cloning

The synchronous voice cloning endpoint allows you to clone a voice and generate speech from text in a single request. This endpoint is ideal for short text content (less than 1000 characters) where you need immediate results.

Endpoint

POST https://aivoiceclonefree.com/api/sync-clone

Authentication

This endpoint requires authentication using your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Request Parameters

Required Parameters

ParameterTypeDescription
audio_fileFileThe audio sample file for voice cloning (WAV, MP3, M4A formats)
textStringThe text to be converted to speech using the cloned voice

Optional Parameters

ParameterTypeDefaultDescription
speedFloat1.0Speech speed (0.5 - 2.0)
pitchFloat0.0Pitch adjustment (-1.0 to 1.0)

Audio File Requirements

  • Formats: WAV, MP3, M4A
  • Duration: 5-30 seconds
  • Quality: Clear audio with minimal background noise
  • File Size: Maximum 4.5MB
  • Content: Natural speech in the target voice

Request Example

cURL

curl -X POST "https://aivoiceclonefree.com/api/sync-clone" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "audio_file=@voice_sample.wav" \ -F "text=Hello, this is a test of voice cloning technology." \ -F "speed=1.2" \ -F "pitch=0.1"

Python

import requests url = "https://aivoiceclonefree.com/api/sync-clone" headers = { "Authorization": "Bearer YOUR_API_KEY" } with open("voice_sample.wav", "rb") as audio_file: files = { "audio_file": audio_file } data = { "text": "Hello, this is a test of voice cloning technology.", "speed": 1.2, "pitch": 0.1 } response = requests.post(url, headers=headers, files=files, data=data)

JavaScript

const formData = new FormData(); formData.append('audio_file', audioFile); formData.append('text', 'Hello, this is a test of voice cloning technology.'); formData.append('speed', '1.2'); formData.append('pitch', '0.1'); fetch('https://aivoiceclonefree.com/api/sync-clone', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY' }, body: formData }) .then(response => response.blob()) .then(audioBlob => { // Handle the audio blob });

Response

Success Response (200 OK)

The response will be an audio file in WAV format containing the generated speech.

Headers:

  • Content-Type: audio/wav
  • Content-Length: [file_size]

Error Responses

400 Bad Request

{ "detail": "Invalid audio file format. Supported formats: WAV, MP3, M4A" }

401 Unauthorized

{ "detail": "Invalid or missing API key" }

403 Forbidden

{ "detail": "Professional or Unlimited subscription required" }

413 Payload Too Large

{ "detail": "Audio file too large. Maximum size: 4.5MB" }

422 Unprocessable Entity

{ "detail": "Text too long for synchronous processing. Use async endpoint for texts over 1000 characters" }

429 Too Many Requests

{ "detail": "Rate limit exceeded. Please try again later" }

500 Internal Server Error

{ "detail": "Internal server error. Please try again later" }

Usage Limits

  • Text Length: Maximum 1000 characters per request
  • Audio Duration: 5-30 seconds
  • File Size: Maximum 4.5MB
  • Rate Limiting: Varies by subscription plan

Best Practices

  1. Audio Quality: Use high-quality audio samples with clear speech and minimal background noise
  2. Text Length: Keep text under 1000 characters for optimal performance
  3. File Format: WAV format generally provides the best results
  4. Error Handling: Always implement proper error handling for API responses
  5. Rate Limiting: Respect rate limits and implement exponential backoff for retries

Next Steps

Last updated on