API Platform

Single-speaker Speech

Synthesize text into speech. This endpoint aligns with POST /v1/audio/speech; voice_id accepts only a voice id, not a voice url, a multipart voice file, or base64.

POST
/v1/audio/speech

Text-to-speech. The request body is JSON; delivery_method=url returns JSON (with a result URL), and delivery_method=audio (default) returns binary audio.

Authentication

Add Authorization: Bearer <API_KEY> to the request headers to authenticate. You can generate a key on the console "API Keys" page.

Example
curl -X POST https://api.mosi.cn/v1/audio/speech \
  -H "Authorization: Bearer $MOSS_API_KEY"

Supported models

FieldAllowed values
model

moss-tts-1.5-flash, moss-tts-1.0-pro

Request fields

FieldTypeRequiredDescription
modelstringYes

The full model ID. Supports moss-tts-1.5-flash, moss-tts-1.0-pro, and their snapshot IDs.

inputstringYes

The text to synthesize. Currently, only the moss-tts-1.5-flash model supports the inline pause marker [pause X.Ys]; X.Y ranges from 0.1 to 10.0 seconds, for example [pause 1.5s].

voice_idstringYes

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.

response_formatstringNo

Audio format for synchronous requests, e.g. mp3 / wav; for asynchronous tasks the actual format is subject to the task query response.

delivery_methodstringNo

audio (default) returns binary audio directly; url returns JSON with a result URL.

asyncbooleanNo

When set to true, creates an asynchronous task and immediately returns a task object; the result is obtained via task query or webhook_url.

webhook_urlstringNo

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

aigc_metadataobjectNo

Controls whether an AIGC implicit marking is written into the generated audio file; nothing is written by default. This field only affects the metadata of the final audio file and does not affect the synthesized speech content.

aigc_metadata.enabledbooleanNo

Whether to write the AIGC implicit marking. The default is false.

aigc_metadata.content_propagatorstringNo

The name or code of the content propagation service provider.

aigc_metadata.propagate_idstringNo

The content propagation ID that identifies this propagation.

Text input

Request example

Example
curl 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": "hello",
    "voice_id": "<voice_id>",
    "response_format": "mp3",
    "delivery_method": "url",
    "aigc_metadata": {
      "enabled": true,
      "content_propagator": "<content_propagator>",
      "propagate_id": "<propagate_id>"
    }
  }'

Response fields

When delivery_method=url, JSON (with a result URL) is returned:

FieldTypeAlways returnedDescription
idstringYes

Task/result ID. Synchronous URL JSON responses uniformly use id.

objectstringYes

Fixed as audio.speech.

statusstringYes

Task status, for example SUCCESS.

urlstringYes

Audio result URL.

response_formatstringYes

Actual output audio format, for example mp3.

content_typestringYes

Audio MIME type, for example audio/mpeg.

created_atintegerYes

Creation time, a Unix timestamp in seconds.

Asynchronous creation response fields

Returned immediately when async=true:

FieldTypeAlways returnedDescription
idstringYes

Task ID.

task_idstringYes

Task query ID, usually the same as id.

objectstringYes

Always audio.speech.

statusstringYes

Initial status, for example PENDING.

retry_afterintegerNo

Suggested polling interval, in seconds.

created_atintegerYes

Creation time, a Unix timestamp in seconds.

updated_atintegerNo

Update time, a Unix timestamp in seconds.

Response example

Response example
{
  "id": "task_abc123",
  "object": "audio.speech",
  "status": "SUCCESS",
  "url": "https://cdn.example.com/out.mp3",
  "response_format": "mp3",
  "content_type": "audio/mpeg",
  "created_at": 1710000000
}

Next steps