Console

Voice Design

Generate a matching voice or speech preview from the text to synthesize and a natural-language voice-style description.

Endpoint
POST/v1/audio/voice/generations
Model name
moss-voice-generator-1.0
  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

    Prepare the request parameters for this scenario. A synchronous call can wait for the result directly; for long-running work, pass async=true and webhook_url.

    FieldTypeRequirementDescription
    model: stringRequired

    moss-voice-generator-1.0

    input: stringRequired

    Text to generate speech from

    instruction: stringRequired

    Voice style description

    delivery_method: stringOptional

    url returns JSON with a result URL

    response_format: stringOptional

    Audio format for synchronous requests; mp3 is recommended

    Request body
    {
      "model": "moss-voice-generator-1.0",
      "input": "Welcome to tonight's show.",
      "instruction": "A gentle, natural young female voice with a hint of a smile",
      "delivery_method": "url",
      "response_format": "mp3"
    }
  3. Send the first request

    Send a request to the scenario endpoint. A synchronous request returns audio bytes directly, or JSON containing a result URL when delivery_method=url; with async=true, it returns a task object.

    Request example
    curl https://api.mosi.cn/v1/audio/voice/generations \
      -H "Authorization: Bearer $MOSS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "moss-voice-generator-1.0",
      "input": "Welcome to tonight’s program.",
      "instruction": "A gentle, natural young woman’s voice with a slight smile",
      "delivery_method": "url",
      "response_format": "mp3"
    }'
  4. Retrieve the task result

    For synchronous calls with delivery_method=url, read the voice generation result URL from the response JSON. Passing async=true returns a task_id; query the task result via GET /v1/audio/tasks/{task_id}. The final audio format is determined by the task result.

    Query the task
    curl https://api.mosi.cn/v1/audio/tasks/$TASK_ID \
      -H "Authorization: Bearer $MOSS_API_KEY"
  5. Verify success

    Success indicator: you obtain audio generated in the described style or a result URL, and can download or play it.

Next steps