Single-Speaker Speech Generation
Synthesize a piece of text into speech with a single voice, suited to narration, customer-service scripts, announcements, and audio content generation.
/v1/audio/speechmoss-tts-1.5-flashCreate 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
Provide the text, voice, and
moss-tts-1.5-flashmodel. Non-streaming requests return audio or a URL; passstream=trueto enable streaming.FieldTypeRequirementDescriptionmoss-tts-1.5-flash
Text to synthesize
Voice ID obtained from the list-voices or create-voice endpoint
Audio format for synchronous requests, such as mp3 or wav; mp3 is recommended
audio returns audio directly; url returns JSON with a result URL
Set to true to enable streaming
Request example { "model": "moss-tts-1.5-flash", "input": "Welcome to the Moss API.[pause 0.8s]Now generating speech.", "voice_id": "94aa4989-c7e9-5007-ae42-ab401823e6c9", "response_format": "mp3", "delivery_method": "url" }Preview a voice and copy its Voice ID into your request.
Browse more voices in the Mossland voice library.
Send the first request
Send a request to the scenario endpoint. A synchronous request can return audio, a URL, or text directly; an asynchronous request returns a task object.
Request example curl -X POST "https://api.mosi.cn/v1/audio/speech" \ -H "Authorization: Bearer $MOSS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "moss-tts-1.5-flash", "input": "Welcome to the Moss API.[pause 0.8s]Now generating speech.", "voice_id": "94aa4989-c7e9-5007-ae42-ab401823e6c9", "response_format": "mp3", "delivery_method": "url" }'Retrieve the task result
For synchronous calls with
delivery_method=url, read the result URL from the response JSON; when using SSE, read through thespeech.audio.doneevent. Passingasync=truereturns atask_id; query the task result viaGET /v1/audio/tasks/{task_id}.Request example curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \ -H "Authorization: Bearer $MOSS_API_KEY"Verify success
Success indicator: you obtain the result audio (
delivery_method=audio) or a result URL (delivery_method=url), and can download or play the generated audio.