Voice Cloning API
Create reusable custom voices from a short reference recording using a project-scoped API key. Once created, pass the saved voice_id to the Text to Speech API just like a system voice.
Use cases
Quick start
Set your API base URL and API key first. If you do not have a key, see Get your API key.
This endpoint uses the X-API-Key request header and requires Voice Cloning to be enabled for the project along with active organization access for the key’s member.
export VUILABS_API_BASE_URL="https://api.vuilabs.ai"
export VUILABS_API_KEY="your-api-key"
You need an authorized reference recording (3–60 seconds, no larger than 20 MiB / 20,971,520 bytes, in WAV, MP3, M4A, WebM, and OGG). For a local file, upload it first with the Audio Upload API in the same project space and API environment and keep the returned data.object_key. If you already have a publicly accessible audio URL, pass it directly as ref_audio.
Replace YOUR_UPLOAD_OBJECT_KEY with the uploaded data.object_key and call POST /v1/voice/save to create a custom voice.
Request example:
curl --request POST \
--url "$VUILABS_API_BASE_URL/v1/voice/save" \
--header "X-API-Key: $VUILABS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"voice_id": "my_support_voice",
"ref_audio": "YOUR_UPLOAD_OBJECT_KEY",
"name": "Support Narrator",
"description": "Warm, clear voice for customer support announcements.",
"preview_text": "Hello, your appointment has been confirmed.",
"profile": {
"gender": "female",
"age_group": "young_adult",
"usage_scenario": "customer_service",
"persona": "comforting",
"texture": ["warm", "soft"],
"emotion": ["friendly"]
}
}'
- Billing and slots: Voice Cloning is free and does not consume Creator credits or your API account balance. Only successfully saved custom voices occupy slots, shared with Creator Voice Cloning. If slots are full, remove unused voices with the Delete Voice API or upgrade your plan first; see Pricing.
- Unique ID: Choose a new
voice_idfor every new voice. An existing ID is rejected to prevent accidental replacement. - Default preset avatar, sample, and timeout: No avatar input is needed; the service assigns a preset avatar from the same set used by Creator and generates a synchronous Luna-TTS 1.5 audition sample. The saved voice remains private to your organization and playable in Creator’s My Voices. Because saving validates the audio and generates this sample, set a client timeout of 30 seconds or longer.
- Query, delete, and synthesize next: To list custom voices in your organization, call the List Voices API with
source=personal. To remove a custom voice, see the Delete Voice API. To generate speech, pass the savedvoice_idwithmodel_id: "luna-tts-1.5"to the Text to Speech API.
API details
Endpoint: POST /v1/voice/save
Requires active organization access for the member associated with the API key (a deactivated or removed member returns HTTP 403 with error_code: 10004).
Request headers
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Project API key with Voice Cloning enabled. |
Content-Type | Yes | application/json |
JSON body
| Field | Type | Required | Description |
|---|---|---|---|
voice_id | string | Yes | After trimming leading/trailing whitespace and converting to lowercase, the new ID must be 1–30 characters using only a-z, 0-9, _, or -. |
ref_audio | string | Yes | The data.object_key returned by the Audio Upload API, a publicly accessible HTTP/HTTPS reference-audio URL or an existing readable object key. Uploaded keys must belong to the current API key's organization and project space. |
name | string | Yes | Display name, 1–30 Unicode code points after trimming. |
description | string | Yes | Voice description, 1–200 Unicode code points after trimming. |
profile | object | Yes | 12-dimension voice profile and attribute tags. See profile fields below for all subfields and allowed enum codes. |
preview_text | string | No | Custom audition sample text. Up to 500 weighted characters with speakable content. When omitted, uses the default text for the detected reference language. |
profile fields
In profile, gender, age_group, and usage_scenario are required and all other fields are optional. Duplicate values in array fields are deduplicated.
| Field | Type | Required | Description and allowed values |
|---|---|---|---|
gender | string | Yes | Gender: male, female, neutral. |
age_group | string | Yes | Age group: child, adolescent, young_adult, middle_aged, older_adult. |
usage_scenario | string | Yes | Use case: news_broadcasting, advertising, livestreaming, chat_companionship, teaching, customer_service, meetings, character_voice_acting, narration, audiobooks, public_speaking, podcasts, vlog, ai_assistant, sleep_meditation. |
persona | string | No | Crush Types: mature_intellectual, golden_retriever_boy, playful_bad_boy, daddy, alpha_boss, powerful_woman, sunny, flirt, straightforward, tsundere, charming_schemer, clingy_cutie, cold_aloof, dark_mysterious, comforting. |
texture | string[] | No | Voice texture (multi-select): soft, warm, breathy, bright, raspy, full_bodied, deep, thin. |
emotion | string[] | No | Emotion (multi-select): friendly, calm, confident, energetic, mysterious, restrained, sad, angry, sarcastic. |
rhythm | string[] | No | Rhythm (multi-select): conversational, distinct_pauses, brisk_concise, varied. |
attitude | string | No | Attitude: serious, somewhat_serious, neutral, lighthearted, playful. |
pitch | string | No | Pitch: very_low, low, medium, high, very_high. |
speed | string | No | Speaking pace: slow, slightly_slow, moderate, slightly_fast, fast. |
recording_environment | string | No | Recording environment: studio, phone_quality, indoor, outdoor. |
language | string | No | Primary language: zh / zh-CN (Chinese), en / en-US (English), ja / ja-JP (Japanese), ko / ko-KR (Korean). Defaults to the detected reference language when omitted (stored as zh, en, ja, or ko). |
name | string | No | Display name, 1–30 Unicode code points after trimming. May be omitted (derived from top-level name); if both top-level name and profile.name are provided, they must match. |
description | string | No | Voice description, 1–200 Unicode code points after trimming. May be omitted (derived from top-level description); if both top-level description and profile.description are provided, they must match. |
Reference audio and creation rules
Reference audio must use WAV (.wav), MP3 (.mp3), M4A (.m4a), WebM (.webm), or OGG (.ogg), be 3–60 seconds long, be no larger than 20 MiB, and contain clear speech from a single speaker (silence or audio without usable speech cannot create a voice).
- Formats and upload: FLAC (
.flac), raw AAC (.aac), and.opusfiles are not supported. Use an M4A container for AAC, or an OGG or WebM container for Opus. Changing a filename extension does not convert the file. A successful upload does not guarantee cloning eligibility; the upload endpoint has no cloning duration limit, so check its duration locally before uploading. - Supported languages: Reference speech supports Chinese, English, Japanese, and Korean. Other detected languages are rejected with HTTP
400/10001. Use a recording in a supported language; changing the synthesislanguagedoes not change the recording’s detected language. - Audition sample: Voice cloning uses Luna-TTS 1.5 to generate the audition sample synchronously. When
preview_textis provided, that custom text is used; otherwise the sample text matches the detected language of the reference recording (or English if no recognized language tag is returned). - ID rules: A new
voice_idlonger than 30 characters is rejected with HTTP400/10001. This creation limit does not shorten existing resource IDs: use the IDs returned by the API when listing, deleting, or generating speech with an existing voice.
Response format
Successful requests return HTTP 200 with the standard JSON envelope:
{
"error_code": 0,
"error_message": "",
"succeed": true,
"data": {}
}
Failures can return a non-2xx HTTP status or HTTP 200 with succeed: false and a nonzero error_code, so do not rely on HTTP status alone. When organization voice slots are full, the endpoint returns HTTP 200 with error_code: 12903 and data.errorKey: "VOICE_SLOTS_FULL"; see Voice Cloning errors.
Common error codes
error_code | Meaning | What to do |
|---|---|---|
10001 | Invalid parameters or unsupported reference language (HTTP 400) | Check the request (including name, description, preview_text, and profile enums) and use Chinese, English, Japanese, or Korean reference speech |
10023 | Custom preview_text contains no speakable content (HTTP 200) | Provide preview_text with valid speakable words and retry |
10004 | Member has no active organization access, or Voice Cloning is disabled for the project (HTTP 403) | Restore member access or enable Voice Cloning for the project before retrying |
12903 | Organization voice slots are full; data.errorKey is VOICE_SLOTS_FULL (HTTP 200) | Free an unused custom voice with the Delete Voice API or upgrade the plan before creating another voice |
12955 | name or description did not pass moderation (HTTP 400) | Update the display name or description that failed moderation and retry |
12956 | Moderation service is temporarily unavailable (HTTP 503) | Try again later |
12957 | Audition sample text (preview_text or default text) did not pass moderation (HTTP 400) | Update preview_text and retry; contact support if the default text continues to fail |
20002 | Audition sample generation service is temporarily unavailable (HTTP 503) | Try saving again later |
10018 | voice_id already exists in the organization or is reserved (HTTP 409) | Use another voice_id |
10002 | Reference audio does not exist or has been deleted (HTTP 404) | Upload the file again and use the new ref_audio; do not retry unchanged input |
20010 | Reference audio is too large (HTTP 413) | Use a file no larger than 20 MiB |
20012 | Reference audio format is unsupported, unreadable, corrupt, or has no audio stream (HTTP 400) | Use a valid supported audio file |
20015 | Reference audio exceeds 60 seconds (HTTP 400) | Use a recording between 3 and 60 seconds |
20016 | Reference audio is under 3 seconds, has insufficient usable speech, or has no detected speech (HTTP 400) | Use a longer, clearer recording |
20017 | Recording contains a pause longer than allowed (HTTP 400) | Use a more continuous recording |
For authentication, rate-limit, billing, timeout, service, and other common errors, see Errors. For voice-slot rules, see Pricing.