Voice Design
Generate a matching voice or speech preview from the text to synthesize and a natural-language voice-style description.
/v1/audio/voice/generationsmoss-voice-generator-1.0Create 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 the request parameters for this scenario. A synchronous call can wait for the result directly; for long-running work, pass
async=trueandwebhook_url.FieldTypeRequirementDescriptionmoss-voice-generator-1.0
Text to generate speech from
Voice style description
url returns JSON with a result URL
Audio format for synchronous requests; mp3 is recommended
Request body { "model": "moss-voice-generator-1.0", "input": "Welcome to tonight's show.", "instruction": "A gentle, natural young female voice with a hint of a smile", "delivery_method": "url", "response_format": "mp3" }Send the first request
Send a request to the scenario endpoint. A synchronous request returns audio bytes directly, or JSON containing a result URL when
delivery_method=url; withasync=true, it returns a task object.Request example curl https://api.mosi.cn/v1/audio/voice/generations \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "moss-voice-generator-1.0", "input": "Welcome to tonight’s program.", "instruction": "A gentle, natural young woman’s voice with a slight smile", "delivery_method": "url", "response_format": "mp3" }'Retrieve the task result
For synchronous calls with
delivery_method=url, read the voice generation result URL from the response JSON. Passingasync=truereturns atask_id; query the task result viaGET /v1/audio/tasks/{task_id}. The final audio format is determined by the task result.Query the task curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \ -H "Authorization: Bearer $MOSS_API_KEY"Verify success
Success indicator: you obtain audio generated in the described style or a result URL, and can download or play it.