Skip to content

Do TTS Clone

POST https://api.newportai.com/api/async/do_tts_clone

Do TTS Clone API could use already cloned voice to create an audio with the target speaker's voice with the given text. Clone Id is required, use the Voice Clone API first to get the cloneId.

  • Use Voice Clone API first to get cloneId
    1. Use Voice Clone API to get taskId with POST method
    2. Use Polling API to get cloneId with POST method
  • Use Do TTS Clone API with cloneId, text, lan to get TaskId with POST method
  • Use Polling API to get audioUrl with POST method

Request Headers

  • Content-TypestringRequired
    Enum
    application/json
  • AuthorizationstringRequired
    Bearer authentication format, for example: Bearer

Request Body

  • cloneIdstringRequired
    cloneId returned from Voice Clone API
  • textstringRequired
    Text to be synthesized.
  • lanstringRequired
    Voice language.
    Support all language code, example: "en","zh-cn","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","hu","ko","ja","vi".
    • enEnglish
    • zh-CNChinese (Simplified)
    • esSpanish
    • frFrench
    • deGerman
    • itItalian
    • ptPortuguese
    • plPolish
    • trTurkish
    • ruRussian
    • nlDutch
    • csCzech
    • arArabic
    • huHungarian
    • koKorean
    • jaJapanese
    • viVietnamese

Response

  • codeinteger
    0 success, or error code.
  • messagestring
    "success", or error msg.
  • dataobject
    taskIdstring
    Use the taskId to request the Polling API to retrieve the generated outputs.

Example

First, create a task with voiceUrl and get taskId.

Request:

zsh
curl -X POST 'https://api.newportai.com/api/async/do_tts_clone' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
  "cloneId": "222b09922fcf4a028e9ecbc86ac2534c",
  "context": "let us see this world",
  "lan": "en"
}'

Response:

json
{
  "code": 0,
  "message": "success", 
  "data": {
    "taskId": "ae88-k9it-ss13-fa41-5664dd31ho"
  }
}

Next Step:

Use Polling API to get the result.

Request:

zsh
curl -X POST 'https://api.newportai.com/api/getAsyncResult' \
-H "Authorization: Bearer {{key}}" \
-H 'Content-Type: application/json' \
-d '{
  "taskId":"ae88-k9it-ss13-fa41-5664dd31ho"
}'

Response:

json
{
  "code": 0,
  "message": "success", 
  "data": {
    "audios": [
      {
        "audioUrl": "https://s3.amazonaws.com/pt-tts-new/oneshot_tts_result/20241113/_/4169774.wav",
        "audioType": ".wav"
      }
    ],
    "task": {
      "taskId": "9af2a0cee7734bbdabea229265d09869",
      "status": 3,
      "taskType": "tts_clone"
    }
  }
}