Console

Single-speaker Speech

POST/v1/audio/speech

Generate speech from text with a voice_id, using non-streaming output, raw PCM, or SSE.

Request parameters

FieldTypeRequiredDescription
model: stringRequired

Model ID. Use a stable model ID by default; use a snapshot model ID when you need to reproduce results from a fixed version.

input: stringRequired

Text to synthesize. Only moss-tts-1.5-flash supports inserting pauses with [pause 0.1s] through [pause 10.0s]; moss-tts-1.0-pro does not support this syntax.

voice_id: stringRequired

Voice ID; get one via List Voices, or go to the Mossland voice library and copy it from a voice card's copy icon. TTS accepts only a voice ID and does not support voice_url / voice_data, nor inline or reference audio.

language: stringOptional

Only moss-tts-1.5-flash supports this field. Specify the pronunciation language of the target text; this does not translate the text. For cross-language voice cloning, choose the language of the target text. Use the full English name of a supported language, such as Chinese or English; language codes such as zh and en are not supported. If omitted, the model detects the language automatically.

expected_duration_sec: numberOptional

Desired audio duration in seconds; when provided, it must be greater than 0.

stream: booleanOptional

Set to true for streaming output. It cannot be combined with async=true or a non-empty webhook_url.

response_format: stringOptional

Output audio format. Streaming requests must use pcm; non-streaming requests can use other formats. For asynchronous tasks, use the task-query result as the authority.

delivery_method: stringOptional

Delivery mode for non-streaming results. By default, the endpoint returns binary audio directly. Do not send this field for streaming requests.

stream_format: stringOptional

Applies only when stream=true and defaults to audio. Expand to view the two streaming response protocols.

async: booleanOptional

When set to true, creates an asynchronous task and immediately returns a task object. Query the task for its result; webhook_url is only used for terminal-state notifications.

webhook_url: stringOptional

The HTTPS URL to call back once the asynchronous task completes.

aigc_metadata: objectOptional

Controls whether an invisible AIGC marker is written to the generated audio file. It is not written by default. This field affects only the metadata of the final audio file, not the synthesized speech content.

aigc_metadata.enabled: booleanOptional

Whether to write an invisible AIGC marker. Defaults to false.

aigc_metadata.content_propagator: stringOptional

The name or code of the content distribution service provider.

aigc_metadata.propagate_id: stringOptional

The content distribution ID used to identify this distribution.

Return value

Depending on how the endpoint is called, it returns audio content, JSON containing an audio URL, or an asynchronous task object. With streaming enabled, it returns an audio data stream or an SSE event stream.

Error codes

HTTPerror.codeTrigger and suggested action
404: voice_not_found

The specified voice_id does not exist or is unavailable. Verify that voice_id comes from List Voices, Create Voice, or the Mossland voice library.

400: 4 error codes

Streaming is combined with an unsupported model, field, or option.