Console

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.

Endpoint
POST/v1/audio/speech
Model name
moss-tts-1.5-flash
  1. 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.

    Environment variable
    MOSS_API_KEY=<your_api_key_here>
  2. Prepare the request input

    Provide the text, voice, and moss-tts-1.5-flash model. Non-streaming requests return audio or a URL; pass stream=true to enable streaming.

    FieldTypeRequirementDescription
    model: stringRequired

    moss-tts-1.5-flash

    input: stringRequired

    Text to synthesize

    voice_id: stringRequired

    Voice ID obtained from the list-voices or create-voice endpoint

    response_format: stringOptional

    Audio format for synchronous requests, such as mp3 or wav; mp3 is recommended

    delivery_method: stringOptional

    audio returns audio directly; url returns JSON with a result URL

    stream: booleanOptional

    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.

  3. 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"
    }'
  4. Retrieve the task result

    For synchronous calls with delivery_method=url, read the result URL from the response JSON; when using SSE, read through the speech.audio.done event. Passing async=true returns a task_id; query the task result via GET /v1/audio/tasks/{task_id}.

    Request example
    curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \
      -H "Authorization: Bearer $MOSS_API_KEY"
  5. 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.

Next steps