Voice Design
Describe a voice style in natural language and generate speech from text in the corresponding style.
Workflow
POST /v1/audio/voice/generations
Endpoint
moss-voice-generator
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 request input
Use
modelto specify the model, useinstructionto describe the target voice style in natural language, and put the text to synthesize intoinput.input: text to generate speech from instruction: voice style description delivery_method: audio or url
request.json { "model": "moss-voice-generator", "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
POST /v1/audio/voice/generations. Whendelivery_method=url, JSON and a result URL are returned synchronously.curl https://api.mosi.cn/v1/audio/voice/generations \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Content-Type: application/json" \ -d @request.jsonRetrieve the result
When
delivery_method=url, read the result URL from the JSON of the synchronous response. If you passasync=true, the endpoint first returns atask_id, which you then use to query the task.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.