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 https://api.mosi.cn/v1/audio/speech \
  -H "Authorization: Bearer $MOSS_API_KEY"

Supported models

FieldAllowed values
model

moss-tts

Request fields

FieldTypeRequiredDescription
modelstringYes

Model name; see "Supported models" for allowed values, for example moss-tts.

versionstringNo

Specify a model version that is live and publicly available; omit it to use the server's current default.

inputstringYes

The text to synthesize.

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.

Request example

curl https://api.mosi.cn/v1/audio/speech \
  -H "Authorization: Bearer $MOSS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moss-tts",
    "input": "hello",
    "voice_id": "<voice_id>",
    "response_format": "mp3",
    "delivery_method": "url"
  }'

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