Clone a Voice
Upload a reference audio file to create a reusable voice_id for later use when generating speech with TTS or TTSD.
/v1/audio/voicesVoice Management ServiceCreate 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.
Environment variable MOSS_API_KEY=<your_api_key_here>Prepare the request input
Prepare a local reference audio file, and enter a voice name and description as needed.
FieldTypeRequirementDescriptionA local reference audio file used to clone the voice.
Voice name.
Voice description.
This request uploads
multipart/form-dataand has no JSON request body. See the complete command in the next step.Send a create request
Send a request to
POST /v1/audio/voices. After creation succeeds, the API returns a voice object.Request example curl -X POST "https://api.mosi.cn/v1/audio/voices" \ -H "Authorization: Bearer $MOSS_API_KEY" \ -F "audio_sample=@/path/to/sample.wav" \ -F "name=customer-service-voice"Read the voice_id
After creation succeeds, the
idin the response is thevoice_idyou can use for subsequent speech generation.JSON { "id": "<voice_id>", "object": "audio.voice", "created_at": 1710000000, "name": "customer-service-voice" }Verify success
Success indicator: the response returns a reusable
voice_id, which you can reference viavoiceorvoice_idin subsequent TTS / TTSD calls.