Custom Voice Cloning

Create a custom voice profile by uploading audio samples to mirror your own voice or that of others.

Start a Voice Cloning Task

Use the POST /v1/voice/clone endpoint with multipart form data.

import requests

api_key = "YOUR_API_KEY"
base_url = "https://api.mirako.ai/v1"
headers = {"Authorization": f"Bearer {api_key}"}

files = {
    "name": (None, "MyCustomVoice"),
    "annotation_list": (None, "sample1.wav, sample2.wav"),
    "audio_samples": (
        "sample1.wav",
        open("sample1.wav", "rb"),
        "audio/wav"
    ),
    # Optional: receive webhook notification when ready
    "webhook": (None, "https://yourapp.com/webhook")
}

response = requests.post(
    f"{base_url}/voice/clone",
    headers=headers,
    files=files
)
response.raise_for_status()
task_id = response.json().get("data", {}).get("task_id")
print(f"Voice cloning task started: {task_id}")

Checking Task Status

status_resp = requests.get(
    f"{base_url}/voice/clone/{task_id}/status",
    headers=headers
)
status_resp.raise_for_status()
status = status_resp.json().get("data", {})
print(f"Status: {status.get('status')}")

if status.get("status") == "succeeded":
    voice_id = status.get("target_id")
    print(f"Custom voice ready: {voice_id}")

Tip: Provide at least 30 seconds of clear, noise-free speech samples for best cloning quality.

Dive deeper