Clone a Custom Voice with Sonus
Create a reusable custom voice from 1 to 3 audio samples with POST https://api.sagea.space/v1/audio/clone.
- Upload two 10s+ samples and create a
voice_id - Synthesize a test line with the cloned voice
- A/B compare cloned output against stock voice
nova
Time to complete: ~15 minutes
Prerequisites
- Python 3.9+ with
pip install requests. - Two clean samples (
sample1.wav,sample2.wav), each 10s or longer, single speaker, low noise. - A SAGEA API key exported as
SAGEA_API_KEY. - Read Synthesize speech with Sonus for synthesis basics.
- Skim the Sonus TTS model card for cloning limits and pricing.
Step 1: Prepare two voice samples
Use 16kHz or higher WAV files, one speaker, no music. Cloned voices cost $30 per 1M chars.
Each file must be at least 10 seconds. Record in a quiet room for best similarity.
Step 2: Create the cloned voice
Call POST https://api.sagea.space/v1/audio/clone with multipart name, audio_samples, and language. It returns a voice_id starting with vox_.
Example response is {"voice_id": "vox_a1b2c3d4"}. Save that ID for synthesis.
Step 3: Synthesize a test line and A/B compare
Use the voice_id as voice in POST https://api.sagea.space/v1/audio/speech, then render the same line with nova.
Compare with ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1 cloned.mp3 and pick by clarity and similarity.
Verify
A successful clone returns HTTP 200 with a voice_id. If it fails, check the error table below.
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | API key missing or invalid | Re-export SAGEA_API_KEY with a valid key |
400 text_too_long | Test line exceeds 4096 chars | Shorten the synthesis input to under 4096 chars |
422 voice_not_found | Bad voice_id in synthesis step | Copy voice_id exactly, it starts with vox_ |
429 rate_limit_exceeded | Over 50 req per min on Starter, 500 on Pro | Wait 60 seconds and retry with backoff |
