Console

Clone a Voice

Upload a reference audio file to create a reusable voice_id for later use when generating speech with TTS or TTSD.

Endpoint
POST/v1/audio/voices
Model name
Voice Management Service
  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 a local reference audio file, and enter a voice name and description as needed.

    FieldTypeRequirementDescription
    audio_sample: fileRequired

    A local reference audio file used to clone the voice.

    name: stringOptional

    Voice name.

    description: stringOptional

    Voice description.

    This request uploads multipart/form-data and has no JSON request body. See the complete command in the next step.

  3. Send a create request

    Send a request to POST /v1/audio/voices. After creation succeeds, the API returns a voice object.

    Request example
    curl -X POST "https://api.mosi.cn/v1/audio/voices" \
      -H "Authorization: Bearer $MOSS_API_KEY" \
      -F "audio_sample=@/path/to/sample.wav" \
      -F "name=customer-service-voice"
  4. Read the voice_id

    After creation succeeds, the id in the response is the voice_id you can use for subsequent speech generation.

    JSON
    {
      "id": "<voice_id>",
      "object": "audio.voice",
      "created_at": 1710000000,
      "name": "customer-service-voice"
    }
  5. Verify success

    Success indicator: the response returns a reusable voice_id, which you can reference via voice or voice_id in subsequent TTS / TTSD calls.

Next steps