Clone a Voice
Upload a reference audio file to create a reusable voice_id for later use when generating speech with TTS or TTSD.
Workflow
POST /v1/audio/voices
Endpoint
Voice Management Service
Model
Create an API Key
Open the API Key management platform, create an API Key, and save it as an environment variable. Do not write the API Key into client-side code or commit it to a repository.
Example export MOSS_API_KEY="<your-api-key>"Prepare the reference audio
Prepare a reference audio file. Voice creation supports only
multipart/form-data; the reference audio is uploaded via theaudio_samplefile field. A JSON body,file_id, oraudio_urlis not supported.audio_sample: reference audio file (multipart) name: voice name description: voice description
Create the voice
Create a voice from the reference audio file, optionally passing
nameanddescription. This endpoint supports onlymultipart/form-data.curl https://api.mosi.cn/v1/audio/voices \ -H "Authorization: Bearer $MOSS_API_KEY" \ -F audio_sample=@sample.wav \ -F name=customer-service-voiceVerify success
Success indicator: the response returns a reusable
voice_id, which you can reference viavoiceorvoice_idin subsequent TTS / TTSD calls.