Voice cloning HTTP API reference

Updated at:

Refer to the target model for the HTTP parameters, responses, and examples related to creating, querying, updating, and deleting voices.

This document describes the voice cloning HTTP API. Select the fields and examples for the model that will use the voice. Each operation uses one parameter table. The model-specific notes describe differences in field types, required fields, and values.

Target ModelOperations Provided Here
Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoiceCreate Voice, Query Voice List, Query Voice Details, Update Voice, Delete Voice
Qwen-Omni、Qwen-Omni-RealtimeCreate Voice, Query Voice List, Delete Voice
Qwen-LiveTranslate-RealtimeCreate Pre-created Voice, Delete Pre-created Voice
MiniMaxCreate Voice

First Obtain API Key and Configure Environment Variables. Request examples read from DASHSCOPE_API_KEY. When managing the same voice across different APIs, use the same account.

Service endpoint

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice、Qwen-Omni、Qwen-Omni-Realtime

China (Beijing)

POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization

Singapore

POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/audio/tts/customization

Replace {WorkspaceId} with the actual Workspace ID; this can be found on the Workspace Details page in the Alibaba Cloud Model Studio console. The API Keys for Beijing and Singapore differ.

ImportantAlibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:

  • North China 2 (Beijing) Region: Migrate from dashscope.aliyuncs.com to {WorkspaceId}.cn-beijing.maas.aliyuncs.com.
  • Singapore Region: Migrate from dashscope-intl.aliyuncs.com to {WorkspaceId}.ap-southeast-1.maas.aliyuncs.com.

Existing domain names remain fully functional.

Qwen-LiveTranslate-Realtime

North China 2 (Beijing) Region:

POST https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization

MiniMax

HTTP Request URL: POST https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

SDK calls the configured base_url: https://dashscope.aliyuncs.com/api/v1.

NoteThird-party models (MiniMax) currently only support invocation via the dashscope.aliyuncs.com domain and do not yet support dedicated domains.

Request headers

ParameterTypeRequiredDescription

Authorization

string

Yes

Authentication token in the format Bearer <your_api_key>. Replace <your_api_key> with your actual API key.

Content-Type

string

Yes

Media type of the request body. Set it based on the model series:

  • Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice、Qwen-Omni、Qwen-Omni-Realtime、Qwen-LiveTranslate-Realtime:application/json。
  • MiniMax:application/json; charset=utf-8。

Create Voice

Audio Requirements and Costs

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Refer to the Voice Cloning User Guide for audio requirements. The cloning process for Qwen-Audio-Realtime is described in Real-time voice conversation Voice Cloning. Creating a voice with Qwen-Audio-Realtime is free; model invocation is billed according to the target model, details in Billing Information, and quantity limits are outlined in Quota Information.

Qwen-Omni、Qwen-Omni-Realtime:

Supported input audio formats include WAV (16-bit), MP3, and M4A. Recommended length is 10–20 seconds, maximum 60 seconds, file size under 10 MB, sampling rate no less than 24 kHz, and mono-only. The audio must contain at least 3 seconds of continuous, clear speech, with pauses no longer than 2 seconds; avoid background music, noise, or other voices throughout the recording. Use normal speech audio—do not upload songs or singing. Supported languages and dialects are listed in the language parameters below; recording recommendations are provided in the Audio Requirements.

Cloning steps, complete examples, and costs are detailed in the Voice Cloning User Guide.

Qwen-LiveTranslate-Realtime:

Supports qwen3.8-livetranslate-flash-realtime and qwen3.5-livetranslate-flash-realtime. This section describes pre-creating a voice; real-time extraction of input voice during translation is covered in Voice Configuration. Pre-creating a voice incurs separate charges; model invocation remains billed by token usage, as outlined in Billing Information. Reference audio must use a publicly accessible URL.

MiniMax:

NoteA voice cloning request generates a demo audio clip. The demo audio is billed additionally at the synchronous TTS unit price of the selected model.

Request Body

model string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Set to voice-enrollment.

Qwen-Omni, Qwen-Omni-Realtime (required):

The voice cloning model. Fixed to qwen-voice-enrollment.

Qwen-LiveTranslate-Realtime:

Voice cloning model, using qwen-voice-enrollment.

MiniMax (required):

The speech model used to generate the demo audio.

Supported models:

  • MiniMax/speech-2.8-hd
  • MiniMax/speech-02-hd
  • MiniMax/speech-2.8-turbo
  • MiniMax/speech-02-turbo

input object

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

The input parameters.

Qwen-Omni, Qwen-Omni-Realtime (required):

The input parameters.

Qwen-LiveTranslate-Realtime:

The input parameters.

MiniMax (required):

The input parameters.

Properties

action string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Fixed as create_voice.

Qwen-Omni, Qwen-Omni-Realtime (required):

Operation type, fixed as create.

Qwen-LiveTranslate-Realtime:

Used when creating a voice style create.

MiniMax (required):

The operation to perform. Set to voice_clone for voice cloning.

target_model string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

The target model driving the voice style. Must match the model that will subsequently use this voice style; otherwise, the call will fail.

Qwen-Omni, Qwen-Omni-Realtime (required):

The omni model that drives the voice:

  • qwen3.8-omni-flash-realtime
  • qwen3.5-omni-plus-realtime
  • qwen3.5-omni-flash-realtime
  • qwen3.5-omni-plus
  • qwen3.5-omni-flash

It must match the model used in subsequent calls to the omni API. Otherwise, synthesis will fail.

Qwen-LiveTranslate-Realtime:

The real-time translation model driving the voice style must match the model used in subsequent sessions.

audio string / object

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (required), type string:

Reference audio used for voice cloning, supporting publicly accessible URLs or Base64 Data URIs, such as data:audio/wav;base64,....

NoteCompatible with the legacy parameter url; when using url, audio may be omitted. url will be phased out; it is recommended to switch to audio.

Qwen-Omni, Qwen-Omni-Realtime (required), type object:

Reference audio object.

Qwen-LiveTranslate-Realtime, type object:

Reference audio object.

Properties

data string

Qwen-Omni, Qwen-Omni-Realtime (required):

Audio used for cloning (recording must follow the Recording Guidelines, and the audio must meet the Audio Requirements).

Audio data can be submitted in one of two ways:

  1. Data URL

    Format: data:<mediatype>;base64,<data>

    • <mediatype>: MIME type

      • WAV:audio/wav
      • MP3:audio/mpeg
      • M4A:audio/mp4
    • <data>: Base64-encoded string of the audio

      Base64 encoding increases file size; please keep the original file small so that the encoded file remains under 10 MB.

    • Example: data:audio/wav;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//PAxABQ/BXRbMPe4IQAhl9

  2. Audio URL (it is recommended to upload the audio to OSS)

    • File size must not exceed 10 MB.
    • The URL must be publicly accessible and require no authentication.

Data URL encoding example

import base64, pathlib

# input.mp3 is the local audio file used for voice cloning. Replace it with your own file path and ensure the file meets the audio requirements.
file_path = pathlib.Path("input.mp3")
base64_str = base64.b64encode(file_path.read_bytes()).decode()
data_uri = f"data:audio/mpeg;base64,{base64_str}"
import java.nio.file.*;
import java.util.Base64;

public class Main {
    /**
     * filePath is the local audio file used for voice cloning. Replace it with your own file path and ensure the file meets the audio requirements.
     */
    public static String toDataUrl(String filePath) throws Exception {
        byte[] bytes = Files.readAllBytes(Paths.get(filePath));
        String encoded = Base64.getEncoder().encodeToString(bytes);
        return "data:audio/mpeg;base64," + encoded;
    }

    // Usage example
    public static void main(String[] args) throws Exception {
        System.out.println(toDataUrl("input.mp3"));
    }
}

Qwen-LiveTranslate-Realtime:

Public URL of the reference audio.

prefix string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Voice name prefix. Allowed characters are digits and English letters, up to 10 characters. The generated voice name has the format {target_model}-{prefix}-{unique_identifier}.

language_hints array[string]

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

Auxiliary model to identify the language of the sample audio, enabling more accurate extraction of voice characteristics and improving cloning performance. If the specified language does not match the actual audio language (e.g., setting en for Chinese audio), the system will ignore this setting and automatically detect the language.

This parameter is an array, and its length must be 1.

NoteApplicable to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash, qwen-audio-3.0-tts-plus, qwen-audio-3.0-tts-flash, qwen-audio-3.1-realtime-plus, qwen-audio-3.1-realtime-flash, qwen-audio-3.0-realtime-plus, qwen-audio-3.0-realtime-flash, cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-plus, cosyvoice-v3-flash.

Click to view the languages supported by each model

  • qwen-audio-3.1-tts-plus、qwen-audio-3.1-tts-flash、qwen-audio-3.0-tts-plus、qwen-audio-3.0-tts-flash、qwen-audio-3.1-realtime-plus、qwen-audio-3.1-realtime-flash、qwen-audio-3.0-realtime-plus、qwen-audio-3.0-realtime-flash:

    • zh: Chinese
    • en: English
    • fr: French
    • de: German
    • ja: Japanese
    • ko: Korean
    • ru: Russian
    • pt: Portuguese
    • th: Thai
    • id: Indonesian
    • vi: Vietnamese
    • it: Italian
    • es: Spanish
    • ms: Malay
    • fil: Filipino
    • ar: Arabic
  • cosyvoice-v3-plus:

    • zh: Chinese
    • en: English
    • fr: French
    • de: German
    • ja: Japanese
    • ko: Korean
    • ru: Russian
  • cosyvoice-v3.5-plus、cosyvoice-v3.5-flash、cosyvoice-v3-flash:

    • zh: Chinese
    • en: English
    • fr: French
    • de: German
    • ja: Japanese
    • ko: Korean
    • ru: Russian
    • pt: Portuguese
    • th: Thai
    • id: Indonesian
    • vi: Vietnamese

Default value: ["zh"].

max_prompt_audio_length float

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

Maximum duration (in seconds) of the reference audio used for voice cloning after preprocessing. Value range: [3.0, 30.0].

Default value: 10.0.

NoteApplies to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash, qwen-audio-3.0-tts-plus, qwen-audio-3.0-tts-flash, qwen-audio-3.1-realtime-plus, qwen-audio-3.1-realtime-flash, qwen-audio-3.0-realtime-plus, qwen-audio-3.0-realtime-flash, cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-flash.

enable_preprocess boolean

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

Whether to enable audio preprocessing (noise reduction, audio enhancement, and volume normalization). Enable this for recordings with background noise. Disable it for recordings in quiet environments to preserve the original voice characteristics.

Default: false.

NoteApplies to qwen-audio-3.1-tts-plus, qwen-audio-3.1-tts-flash, qwen-audio-3.0-tts-plus, qwen-audio-3.0-tts-flash, qwen-audio-3.1-realtime-plus, qwen-audio-3.1-realtime-flash, qwen-audio-3.0-realtime-plus, qwen-audio-3.0-realtime-flash, cosyvoice-v3.5-plus, cosyvoice-v3.5-flash, cosyvoice-v3-flash.

enable_volume_normalization string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

Whether to normalize the volume of the sample audio used for voice cloning. Values:

  • "true": Enable volume normalization.
  • "false": Disable volume normalization.

When enabled, the synthesized audio using the created voice may have a different volume compared to when this parameter is disabled.

Default value: "false".

preferred_name string

Qwen-Omni, Qwen-Omni-Realtime (required):

Assign a recognizable name to the voice (only digits, uppercase and lowercase letters, and underscores are allowed; maximum 16 characters). It is recommended to use identifiers related to the character or scene.

This keyword will appear in the cloned voice name; for example, if the keyword is “guanyu,” the final voice name will be “qwen-omni-vc-guanyu-voice-20250812105009984-838b.”

Qwen-LiveTranslate-Realtime:

Identifier in the voice name.

text string

Qwen-Omni, Qwen-Omni-Realtime (optional):

Text that matches the audio content in the data field of the audio object.

When this parameter is provided, the server compares the audio with the text. If the difference is too large, it returns Audio.PreprocessError.

MiniMax (required):

The text to synthesize as demo audio for the cloned voice. Maximum: 1,000 characters.

NoteThe demo audio is billed at the standard TTS rate per character. For pricing details, see MiniMax model pricing.

  • Interjection tags: When using speech-2.8-hd or speech-2.8-turbo, you can insert interjection tags in the text. Supported interjections: (laughs) (laughter), (chuckle) (chuckle), (coughs) (cough), (clear-throat) (throat clearing), (groans) (groan), (breath) (normal breath), (pant) (panting), (inhale) (inhale), (exhale) (exhale), (gasps) (gasp), (sniffs) (sniff), (sighs) (sigh), (snorts) (snort), (burps) (burp), (lip-smacking) (lip smacking), (humming) (humming), (hissing) (hissing), (emm) (hesitation), (whistles) (whistle), (sneezes) (sneeze), (crying) (crying), (applause) (applause)

language string

Qwen-Omni, Qwen-Omni-Realtime (optional):

The language corresponding to the data audio in the audio object.

Supported languages include zh (Chinese), en (English), de (German), it (Italian), pt (Portuguese), es (Spanish), ja (Japanese), ko (Korean), fr (French), ru (Russian), th (Thai), id (Indonesian), ar (Arabic), cs (Czech), da (Danish), nl (Dutch), fi (Finnish), he (Hebrew), hi (Hindi), is (Icelandic), ms (Malay), no (Norwegian), fa (Persian), pl (Polish), sv (Swedish), tl (Tagalog), tr (Turkish), ur (Urdu), vi (Vietnamese).

Chinese dialects: Dongbei (Northeastern Mandarin), Shannxi (Shaanxi dialect), Sichuan (Sichuan dialect), Henan (Henan dialect), Changsha (Changsha dialect), Tianjin (Tianjin dialect), Hangzhou (Hangzhou dialect), Liaoning (Liaoning dialect), Shenyang (Shenyang dialect), Anshan (Anshan dialect).

If this parameter is used, the specified language must match the language of the audio actually used for cloning.

audio_url string

MiniMax (required):

The URL of the audio file to clone. The audio must meet the following requirements:

  • Format: mp3, m4a, or wav
  • Duration: at least 10 seconds and no more than 5 minutes
  • File size: no more than 20 MB

clone_prompt object

MiniMax (optional):

A sample audio clip for voice cloning. Providing this parameter improves voice similarity and stability during synthesis. If you use this parameter, prepare a short sample audio clip.

Properties

prompt_audio string

MiniMax (optional):

The URL of the sample audio file. The audio must meet the following requirements:

  • Format: mp3, m4a, or wav
  • Duration: less than 8 seconds
  • File size: no more than 20 MB

prompt_text string

MiniMax (optional):

The transcript of the sample audio. The text must match the audio content exactly and end with a punctuation mark.

voice_id string

MiniMax (required):

The ID of the cloned voice (for example, "MiniMax001"). The ID must follow these naming rules:

  • Length: 8 to 256 characters
  • Must start with a letter
  • Allowed characters: letters, digits, hyphens (-), and underscores (_)
  • Must not end with a hyphen (-) or underscore (_)
  • Must be unique across all existing voice IDs. Duplicate IDs return an error.

NoteThe voice ID must be globally unique across all voices in your account. Include a timestamp or other unique identifier in the ID to avoid conflicts.

language_boost enum<string>

MiniMax (optional):

Default value: null.

Whether to enhance recognition accuracy for a specific language or dialect. Set to auto to let the model detect the language automatically.

Available options

Chinese, Chinese,Yue, English, Arabic, Russian, Spanish, French, Portuguese, German, Turkish, Dutch, Ukrainian, Vietnamese, Indonesian, Japanese, Italian, Korean, Thai, Polish, Romanian, Greek, Czech, Finnish, Hindi, Bulgarian, Danish, Hebrew, Malay, Persian, Slovak, Swedish, Croatian, Filipino, Hungarian, Norwegian, Slovenian, Catalan, Nynorsk, Tamil, Afrikaans,auto

need_noise_reduction boolean

MiniMax (optional):

Default: false.

Whether to enable noise reduction for the audio used for cloning.

need_volume_normalization boolean

MiniMax (optional):

Default: false.

Whether to enable volume normalization.

aigc_watermark boolean

MiniMax (optional):

Default: false.

Whether to add an audio rhythm marker to the end of the synthesized demo audio.

parameters object

Qwen-Omni、Qwen-Omni-Realtime:

Configuration parameter object.

Properties

voice_clone_mode string

Qwen-Omni, Qwen-Omni-Realtime (required depending on conditions):

Voice cloning mode. Required when using the qwen3.8-omni series models; if not specified, it defaults to the qwen3.5-omni talker system instruct mode (backward compatible with legacy services).

Valid values:

  • normal: Normal mode
  • dialect: Dialect mode
  • crosslingual: Cross-language mode

This parameter must be included in parameters.

skip_audio_process boolean

Qwen-Omni, Qwen-Omni-Realtime (optional):

Default value: false.

Whether to skip audio preprocessing. Defaults to false. This parameter must be included in parameters.

Request examples

qwen-audio-3.1-tts-plus

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "create_voice",
        "target_model": "qwen-audio-3.1-tts-plus",
        "prefix": "myvoice",
        "audio": "https://your-audio-url.wav",
        "language_hints": ["zh"],
        "enable_volume_normalization": "false"
    }
}'

When using a local WAV audio file, you can generate a Base64 Data URI using the following code and set the value of audio in the audio field of the input object in the create or update request. Replace sample.wav with the path to your local audio file.

import base64
from pathlib import Path

audio = "data:audio/wav;base64," + base64.b64encode(
    Path("sample.wav").read_bytes()
).decode("ascii")

qwen-audio-3.1-realtime-plus

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "create_voice",
        "target_model": "qwen-audio-3.1-realtime-plus",
        "prefix": "myvoice",
        "audio": "https://your-audio-url.wav",
        "language_hints": ["zh"],
        "enable_volume_normalization": "false"
    }
}'

When using a local WAV audio file, you can generate a Base64 Data URI using the following code and set the value of audio in the audio field of the input object in the create or update request. Replace sample.wav with the path to your local audio file.

import base64
from pathlib import Path

audio = "data:audio/wav;base64," + base64.b64encode(
    Path("sample.wav").read_bytes()
).decode("ascii")

qwen3.8-omni-flash-realtime

The cURL example uses an audio URL. Replace https://xxx.wav with your actual address. The Python and Java examples read a local audio file. Replace input.mp3 with your actual file path.

# If the environment variable is not configured, replace $DASHSCOPE_API_KEY below with your API Key.
# ======= Important =======
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# === Remove this comment before running ===

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "qwen-voice-enrollment",
    "input": {
        "action": "create",
        "target_model": "qwen3.8-omni-flash-realtime",
        "preferred_name": "chinese",
        "audio": {
            "data": "https://xxx.wav"
        }
    },
    "parameters": {
        "skip_audio_process": false,
        "voice_clone_mode": "normal"
    }
}'
import os
import requests
import base64, pathlib

target_model = "qwen3.8-omni-flash-realtime"
preferred_name = "guanyu"
audio_mime_type = "audio/mpeg"

file_path = pathlib.Path("input.mp3")
base64_str = base64.b64encode(file_path.read_bytes()).decode()
data_uri = f"data:{audio_mime_type};base64,{base64_str}"

# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# If the environment variable is not configured, replace the following line with your Model Studio API Key: api_key = "sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
url = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization"

payload = {
    "model": "qwen-voice-enrollment", # Do not change this value.
    "parameters": {"voice_clone_mode": "normal"},
    "input": {
        "action": "create",
        "target_model": target_model,
        "preferred_name": preferred_name,
        "audio": {
            "data": data_uri
        }
    }
}

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

# Send the POST request.
resp = requests.post(url, json=payload, headers=headers)

if resp.status_code == 200:
    data = resp.json()
    voice = data["output"]["voice"]
    print(f"Generated voice parameter: {voice}")
else:
    print("Request failed:", resp.status_code, resp.text)
import com.google.gson.Gson;
import com.google.gson.JsonObject;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.*;
import java.util.Base64;

public class Main {
    private static final String TARGET_MODEL = "qwen3.8-omni-flash-realtime";
    private static final String PREFERRED_NAME = "guanyu";
    private static final String AUDIO_FILE = "input.mp3";
    private static final String AUDIO_MIME_TYPE = "audio/mpeg";

    public static String toDataUrl(String filePath) throws Exception {
        byte[] bytes = Files.readAllBytes(Paths.get(filePath));
        String encoded = Base64.getEncoder().encodeToString(bytes);
        return "data:" + AUDIO_MIME_TYPE + ";base64," + encoded;
    }

    public static void main(String[] args) {
        // API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
        // If the environment variable is not configured, replace the following line with your Model Studio API Key: String apiKey = "sk-xxx";
        String apiKey = System.getenv("DASHSCOPE_API_KEY");
        // The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. Configuration varies by region.
        String apiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization";

        try {
            // Build the JSON request body. Escape the inner quotation marks.
            String jsonPayload =
                    "{"
                            + "\"model\": \"qwen-voice-enrollment\"," // Do not change this value.
                            + "\"parameters\": {\"voice_clone_mode\": \"normal\"},"
                            + "\"input\": {"
                            +     "\"action\": \"create\","
                            +     "\"target_model\": \"" + TARGET_MODEL + "\","
                            +     "\"preferred_name\": \"" + PREFERRED_NAME + "\","
                            +     "\"audio\": {"
                            +         "\"data\": \"" + toDataUrl(AUDIO_FILE) + "\""
                            +     "}"
                            + "}"
                            + "}";

            HttpURLConnection con = (HttpURLConnection) new URL(apiUrl).openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Authorization", "Bearer " + apiKey);
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);

            // Send the request body.
            try (OutputStream os = con.getOutputStream()) {
                os.write(jsonPayload.getBytes("UTF-8"));
            }

            int status = con.getResponseCode();
            InputStream is = (status >= 200 && status < 300)
                    ? con.getInputStream()
                    : con.getErrorStream();

            StringBuilder response = new StringBuilder();
            try (BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"))) {
                String line;
                while ((line = br.readLine()) != null) {
                    response.append(line);
                }
            }

            System.out.println("HTTP status code: " + status);
            System.out.println("Response: " + response.toString());

            if (status == 200) {
                // Parse JSON.
                Gson gson = new Gson();
                JsonObject jsonObj = gson.fromJson(response.toString(), JsonObject.class);
                String voice = jsonObj.getAsJsonObject("output").get("voice").getAsString();
                System.out.println("Generated voice parameter: " + voice);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

qwen3.8-livetranslate-flash-realtime

POST https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization
Authorization: Bearer <your_api_key>
Content-Type: application/json
curl -X POST 'https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen-voice-enrollment",
    "input": {
      "action": "create",
      "target_model": "qwen3.8-livetranslate-flash-realtime",
      "preferred_name": "tmtest381103",
      "audio": {
        "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/cosyvoice/cosyvoice-zeroshot-sample.wav"
      }
    }
  }'

MiniMax/speech-2.8-turbo

NoteThird-party models (MiniMax) currently only support dashscope.aliyuncs.com

curl -X POST 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d '{
    "input": {
      "action": "voice_clone",
      "voice_id": "bailian-test-voice-22",
      "audio_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/cosyvoice/cosyvoice-zeroshot-sample.wav",
      "text": "今天天气怎么样?"
    },
    "model": "MiniMax/speech-2.8-turbo"
  }'

Response body

request_id string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The unique identifier of this request.

Qwen-Omni、Qwen-Omni-Realtime:

Request ID。

Qwen-LiveTranslate-Realtime:

Request ID.

MiniMax:

The unique identifier of this request.

output object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The data returned by the model.

Qwen-Omni、Qwen-Omni-Realtime:

Output parameter object.

Qwen-LiveTranslate-Realtime:

Output parameter object.

MiniMax:

Output parameter object.

Properties

voice_id string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Voice ID. For Qwen-Audio-TTS and CosyVoice, set this as the voice parameter in the text-to-speech API. For Qwen-Audio-Realtime, set voice in the session object of the session.update event; see Voice Configuration.

voice string

Qwen-Omni、Qwen-Omni-Realtime:

The voice name, which can be used as the voice parameter in subsequent Omni API calls.

Qwen-LiveTranslate-Realtime:

The created voice ID is used in the voice parameter of subsequent translation sessions.

target_model string

Qwen-Omni、Qwen-Omni-Realtime:

The omni model that drives the voice:

  • qwen3.8-omni-flash-realtime

  • qwen3.5-omni-plus-realtime

  • qwen3.5-omni-flash-realtime

  • qwen3.5-omni-plus

  • qwen3.5-omni-flash

It must match the model used in subsequent calls to the omni API. Otherwise, synthesis will fail.

Qwen-LiveTranslate-Realtime:

The target model specified during voice creation.

input_sensitive boolean

MiniMax:

Whether the input audio triggered content moderation.

input_sensitive_type integer

MiniMax:

The type of content moderation violation detected in the input audio:

  • 0: Normal (no violation)
  • 1: Severe violation
  • 2: Pornographic content
  • 3: Advertising
  • 4: Prohibited content
  • 5: Abusive language
  • 6: Violent or terrorist content
  • 7: Other

demo_audio string

MiniMax:

URL of the demo audio.

base_resp object

MiniMax:

Properties

status_code integer

MiniMax:

Status code:

  • 0: Success
  • 1000: Unknown error
  • 1001: Timeout
  • 1002: Rate limit exceeded
  • 1004: Authentication failed
  • 1013: Internal server error
  • 2013: Invalid input format
  • 2038: Insufficient permissions for voice cloning. Check your account authentication status.

status_msg string

MiniMax:

A description of the status.

usage object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Usage information for this request.

Qwen-Omni、Qwen-Omni-Realtime:

Usage information.

MiniMax:

Character usage for this request.

Properties

count integer

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The number of voices created. Always 1.

Qwen-Omni、Qwen-Omni-Realtime:

The number of "create voice" operations actually billed for this request. The cost of this request is count × 0.01CNY.

When creating a voice, count is always 1.

characters integer

MiniMax:

The number of characters in the input text.

Response examples

qwen-audio-3.1-tts-plus

{
    "output": {
        "voice_id": "qwen-audio-3.1-tts-plus-myvoice-xxxxxx"
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

qwen-audio-3.1-realtime-plus

{
    "output": {
        "voice_id": "qwen-audio-3.1-realtime-plus-myvoice-xxxxxx"
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

qwen3.8-omni-flash-realtime

Response structure

{
    "output": {
        "voice": "yourVoice",
        "target_model": "qwen3.8-omni-flash-realtime"
    },
    "usage": {
        "count": 1
    },
    "request_id": "yourRequestId"
}

Return example

{"output":{"target_model":"qwen3.8-omni-flash-realtime","voice":"qwen-omni-vc-chinese-voice-20260911161744020-3f9d"},"usage":{"count":1},"request_id":"7a36a3cb-be34-9be8-a127-df2449d51ab2"}

qwen3.8-livetranslate-flash-realtime

The following response examples are excerpts.

{
  "output": {
    "voice": "VOICE_ID",
    "target_model": "qwen3.8-livetranslate-flash-realtime"
  },
  "request_id": "REQUEST_ID"
}

MiniMax/speech-2.8-turbo

{
    "output": {
        "base_resp": {
            "status_code": 0,
            "status_msg": "success"
        },
        "demo_audio": "https://minimax-algeng-chat-tts.oss-cn-wulanchabu.aliyuncs.com/audio%2Feffect%2F05fdf023562aea84632d2a8c01c2366f_1773059375796_1311.mp3?Expires=1773232175&OSSAccessKeyId=YOUR_ACCESS_KEY_ID&Signature=YOUR_SIGNATURE",
        "input_sensitive": false,
        "input_sensitive_type": 0
    },
    "usage": {
        "characters": 18
    },
    "request_id": "b1160386-ebf1-913f-9275-ef176c5e1c91"
}

Query Voice List

The parameters and examples in this section correspond to the following models: Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice; Qwen-Omni, Qwen-Omni-Realtime.

NoteMiniMax does not support listing voices through this API. For available MiniMax voice IDs, including system and cloned voices, see Voice management.

Request Body

model string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Set to voice-enrollment.

Qwen-Omni, Qwen-Omni-Realtime (required):

The voice cloning model. Fixed to qwen-voice-enrollment.

input object

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

The input parameters.

Qwen-Omni, Qwen-Omni-Realtime (required):

The input parameters.

Properties

action string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Set to list_voice.

Qwen-Omni, Qwen-Omni-Realtime (required):

The action type. Fixed to list.

prefix string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

Filters voices by name prefix.

page_index integer

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

The page index.

Qwen-Omni, Qwen-Omni-Realtime (optional):

Default: 0.

Page index. Value range: [0, 1000000].

page_size integer

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (optional):

The number of entries per page.

Qwen-Omni, Qwen-Omni-Realtime (optional):

Default: 10.

Number of entries per page. Value range: [0, 1000000].

Importantmodel: The voice cloning model, fixed to qwen-voice-enrollment. Do not modify it.

Request examples

voice-enrollment (text-to-speech example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "list_voice",
        "prefix": "myvoice",
        "page_size": 10,
        "page_index": 0
    }
}'

voice-enrollment (real-time conversation example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "list_voice",
        "prefix": "myvoice",
        "page_size": 10,
        "page_index": 0
    }
}'

qwen-voice-enrollment (multimodal example)

# If the environment variable is not configured, replace $DASHSCOPE_API_KEY below with your API Key.
# ======= Important =======
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# === Remove this comment before running ===

curl --location --request POST 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model": "qwen-voice-enrollment",
    "input": {
        "action": "list",
        "page_size": 10,
        "page_index": 0
    }
}'
import os
import requests

# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# If the environment variable is not configured, replace the following line with your Model Studio API Key: api_key = "sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
url = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization"

payload = {
    "model": "qwen-voice-enrollment", # Do not change this value.
    "input": {
        "action": "list",
        "page_size": 10,
        "page_index": 0
    }
}

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print("HTTP status code:", response.status_code)

if response.status_code == 200:
    data = response.json()
    voice_list = data["output"]["voice_list"]

    print("Voice list:")
    for item in voice_list:
        print(f"- Voice: {item['voice']}  Created at: {item['gmt_create']}  Model: {item['target_model']}")
else:
    print("Request failed:", response.text)
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        // API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
        // If the environment variable is not configured, replace the following line with your Model Studio API Key: String apiKey = "sk-xxx";
        String apiKey = System.getenv("DASHSCOPE_API_KEY");
        // The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. Configuration varies by region.
        String apiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization";

        // JSON request body. Older Java versions do not support multiline """ strings.
        String jsonPayload =
                "{"
                        + "\"model\": \"qwen-voice-enrollment\"," // Do not change this value.
                        + "\"input\": {"
                        +     "\"action\": \"list\","
                        +     "\"page_size\": 10,"
                        +     "\"page_index\": 0"
                        + "}"
                        + "}";

        try {
            HttpURLConnection con = (HttpURLConnection) new URL(apiUrl).openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Authorization", "Bearer " + apiKey);
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);

            try (OutputStream os = con.getOutputStream()) {
                os.write(jsonPayload.getBytes("UTF-8"));
            }

            int status = con.getResponseCode();
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    status >= 200 && status < 300 ? con.getInputStream() : con.getErrorStream(), "UTF-8"));

            StringBuilder response = new StringBuilder();
            String line;
            while ((line = br.readLine()) != null) {
                response.append(line);
            }
            br.close();

            System.out.println("HTTP status code: " + status);
            System.out.println("Response JSON: " + response.toString());

            if (status == 200) {
                Gson gson = new Gson();
                JsonObject jsonObj = gson.fromJson(response.toString(), JsonObject.class);
                JsonArray voiceList = jsonObj.getAsJsonObject("output").getAsJsonArray("voice_list");

                System.out.println("\n Voice list:");
                for (int i = 0; i < voiceList.size(); i++) {
                    JsonObject voiceItem = voiceList.get(i).getAsJsonObject();
                    String voice = voiceItem.get("voice").getAsString();
                    String gmtCreate = voiceItem.get("gmt_create").getAsString();
                    String targetModel = voiceItem.get("target_model").getAsString();

                    System.out.printf("- Voice: %s  Created at: %s  Model: %s\n",
                            voice, gmtCreate, targetModel);
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Response Body

request_id string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The unique identifier of this request.

Qwen-Omni、Qwen-Omni-Realtime:

Request ID。

output object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The data returned by the model.

Qwen-Omni、Qwen-Omni-Realtime:

Output parameter object.

Properties

voice_list array[object]

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

List of voices found.

Qwen-Omni、Qwen-Omni-Realtime:

Properties

voice_id string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Voice ID. For Qwen-Audio-TTS and CosyVoice, set this as the voice parameter in the text-to-speech API. For Qwen-Audio-Realtime, set voice in the session object of the session.update event; see Voice Configuration.

gmt_create string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The creation time.

Qwen-Omni、Qwen-Omni-Realtime:

The time when the voice was created.

gmt_modified string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The last modification time.

status string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Voice status; see "Voice Status Description" for valid values.

voice string

Qwen-Omni、Qwen-Omni-Realtime:

The voice name, which can be used as the voice parameter in subsequent Omni API calls.

target_model string

Qwen-Omni、Qwen-Omni-Realtime:

The omni model that drives the voice:

  • qwen3.8-omni-flash-realtime

  • qwen3.5-omni-plus-realtime

  • qwen3.5-omni-flash-realtime

  • qwen3.5-omni-plus

  • qwen3.5-omni-flash

It must match the model used in subsequent calls to the omni API. Otherwise, synthesis will fail.

usage object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Usage information for this request.

Qwen-Omni、Qwen-Omni-Realtime:

Usage information.

Properties

count integer

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Always 1.

Qwen-Omni、Qwen-Omni-Realtime:

The number of "create voice" operations actually billed for this request. The cost of this request is count × 0.01CNY.

Listing voices is not billed, so count is always 0.

Response examples

voice-enrollment (text-to-speech example)

{
    "output": {
        "voice_list": [
            {
                "voice_id": "qwen-audio-3.0-tts-flash-myvoice-xxxxxx",
                "gmt_create": "2024-12-11 13:38:02",
                "gmt_modified": "2024-12-11 13:38:02",
                "status": "OK"
            }
        ]
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

voice-enrollment (real-time conversation example)

{
    "output": {
        "voice_list": [
            {
                "voice_id": "qwen-audio-3.1-realtime-plus-myvoice-xxxxxx",
                "gmt_create": "2024-12-11 13:38:02",
                "gmt_modified": "2024-12-11 13:38:02",
                "status": "OK"
            }
        ]
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

qwen-voice-enrollment (multimodal example)

{
    "output": {
        "voice_list": [
            {
                "voice": "yourVoice1",
                "gmt_create": "2025-08-11 17:59:32",
                "target_model": "qwen3.5-omni-plus-realtime"
            },
            {
                "voice": "yourVoice2",
                "gmt_create": "2025-08-11 17:38:10",
                "target_model": "qwen3.5-omni-plus-realtime"
            }
        ]
    },
    "usage": {
        "count": 0
    },
    "request_id": "yourRequestId"
}

Query voice details

The parameters and examples in this section correspond to the following models: Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice.

NoteMiniMax does not support querying voice details through this API.

Request Body

model string

(Required):

Set to voice-enrollment.

input object

(Required):

The input parameters.

Properties

action string

(Required):

Set to query_voice.

voice_id string

(Required):

The voice ID to query.

Request examples

voice-enrollment (text-to-speech example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

Query voice details

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "query_voice",
        "voice_id": "yourVoiceId"
    }
}'

voice-enrollment (real-time conversation example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

Query voice details

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "query_voice",
        "voice_id": "yourVoiceId"
    }
}'

Response Body

request_id string

The unique identifier of this request.

output object

The data returned by the model.

Properties

resource_link string

The URL of the audio file.

gmt_create string

The creation time.

gmt_modified string

The last modification time.

status string

Voice status; see "Voice Status Description" for valid values.

target_model string

The target model driving the voice (text-to-speech or real-time speech conversation).

usage object

Usage information for this request.

Properties

count integer

Always 1.

Response examples

voice-enrollment (text-to-speech example)

{
    "output": {
        "gmt_create": "2024-12-11 13:38:02",
        "resource_link": "https://yourAudioFileUrl",
        "target_model": "qwen-audio-3.1-tts-plus",
        "gmt_modified": "2024-12-11 13:38:02",
        "status": "OK"
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

voice-enrollment (real-time conversation example)

{
    "output": {
        "gmt_create": "2024-12-11 13:38:02",
        "resource_link": "https://yourAudioFileUrl",
        "target_model": "qwen-audio-3.1-realtime-plus",
        "gmt_modified": "2024-12-11 13:38:02",
        "status": "OK"
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

Update a voice

The parameters and examples in this section correspond to the following models: Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice.

NoteMiniMax does not support updating voices through this API.

Request Body

model string

(Required):

Set to voice-enrollment.

input object

(Required):

The input parameters.

Properties

action string

(Required):

Fixed to update_voice.

voice_id string

(Required):

The voice ID to update.

audio string

(Required):

New reference audio. Accepts a publicly accessible URL or a Base64 Data URI, such as data:audio/wav;base64,....

NoteCompatible with the legacy parameter url; when using url, audio may be omitted. url will be phased out; it is recommended to switch to audio.

Request examples

voice-enrollment (text-to-speech example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "update_voice",
        "voice_id": "yourVoiceId",
        "audio": "https://new-audio-url.wav"
    }
}'

voice-enrollment (real-time conversation example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "update_voice",
        "voice_id": "yourVoiceId",
        "audio": "https://new-audio-url.wav"
    }
}'

Response Body

request_id string

The unique identifier of this request.

output object

The data returned by the model. The update operation returns an empty object.

usage object

Usage information for this request.

Properties

count integer

Always 1.

Response examples

voice-enrollment (text-to-speech example)

{
    "output": {},
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

voice-enrollment (real-time conversation example)

{
    "output": {},
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

Delete Voice

The parameters and examples in this section correspond to the following models: Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice; Qwen-Omni, Qwen-Omni-Realtime; Qwen-LiveTranslate-Realtime.

After deleting a voice via Qwen-Omni or Qwen-Omni-Realtime, the corresponding voice quota will be released.

NoteMiniMax does not support deleting voices through this API. To delete MiniMax voices, see Voice management.

Request Body

model string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Set to voice-enrollment.

Qwen-Omni, Qwen-Omni-Realtime (required):

The voice cloning model. Fixed to qwen-voice-enrollment.

Qwen-LiveTranslate-Realtime:

Fixed to qwen-voice-enrollment.

input object

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

The input parameters.

Qwen-Omni, Qwen-Omni-Realtime (required):

The input parameters.

Qwen-LiveTranslate-Realtime:

The input parameters.

Properties

action string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

Set to delete_voice.

Qwen-Omni, Qwen-Omni-Realtime (required):

The action type. Fixed to delete.

Qwen-LiveTranslate-Realtime:

Use delete when deleting a pre-created voice.

voice_id string

Qwen-Audio-TTS, Qwen-Audio-Realtime, CosyVoice (Required):

The voice ID to delete.

voice string

Qwen-Omni, Qwen-Omni-Realtime (required):

The voice to delete.

Importantmodel: The voice cloning model, fixed to qwen-voice-enrollment. Do not modify it.

Qwen-LiveTranslate-Realtime:

The ID of the pre-created voice to be deleted.

Request examples

voice-enrollment (text-to-speech example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "delete_voice",
        "voice_id": "yourVoiceId"
    }
}'

voice-enrollment (real-time conversation example)

The following configuration is for the China (Beijing) region. Replace "{WorkspaceId}" with your actual workspace ID. The configuration varies by region.

curl -X POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
    "model": "voice-enrollment",
    "input": {
        "action": "delete_voice",
        "voice_id": "yourVoiceId"
    }
}'

qwen-voice-enrollment (multimodal example)

Replace yourVoice with the name of the voice to delete.

# If the environment variable is not configured, replace $DASHSCOPE_API_KEY below with your API Key.
# ======= Important =======
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# === Remove this comment before running ===

curl --location --request POST 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model": "qwen-voice-enrollment",
    "input": {
        "action": "delete",
        "voice": "yourVoice"
    }
}'
import os
import requests

# API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
# If the environment variable is not configured, replace the following line with your Model Studio API Key: api_key = "sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")
# The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
url = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization"

voice_to_delete = "yourVoice"  # Voice to delete. Replace with an actual voice ID.

payload = {
    "model": "qwen-voice-enrollment", # Do not change this value.
    "input": {
        "action": "delete",
        "voice": voice_to_delete
    }
}

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print("HTTP status code:", response.status_code)

if response.status_code == 200:
    data = response.json()
    request_id = data["request_id"]

    print(f"Deleted successfully")
    print(f"Request ID: {request_id}")
else:
    print("Request failed:", response.text)
import com.google.gson.Gson;
import com.google.gson.JsonObject;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        // API Keys differ between Singapore and China (Beijing). Obtain an API Key: https://help.aliyun.com/en/model-studio/get-api-key
        // If the environment variable is not configured, replace the following line with your Model Studio API Key: String apiKey = "sk-xxx";
        String apiKey = System.getenv("DASHSCOPE_API_KEY");
        // The following URL is for China (Beijing). Replace {WorkspaceId} with your Model Studio workspace ID. Configuration varies by region.
        String apiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization";
        String voiceToDelete = "yourVoice"; // Voice to delete. Replace with an actual voice ID.

        // Build the JSON request body using string concatenation for Java 8 compatibility.
        String jsonPayload =
                "{"
                        + "\"model\": \"qwen-voice-enrollment\"," // Do not change this value.
                        + "\"input\": {"
                        +     "\"action\": \"delete\","
                        +     "\"voice\": \"" + voiceToDelete + "\""
                        + "}"
                        + "}";

        try {
            // Establish the POST connection.
            HttpURLConnection con = (HttpURLConnection) new URL(apiUrl).openConnection();
            con.setRequestMethod("POST");
            con.setRequestProperty("Authorization", "Bearer " + apiKey);
            con.setRequestProperty("Content-Type", "application/json");
            con.setDoOutput(true);

            // Send the request body.
            try (OutputStream os = con.getOutputStream()) {
                os.write(jsonPayload.getBytes("UTF-8"));
            }

            int status = con.getResponseCode();
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    status >= 200 && status < 300 ? con.getInputStream() : con.getErrorStream(), "UTF-8"));

            StringBuilder response = new StringBuilder();
            String line;
            while ((line = br.readLine()) != null) {
                response.append(line);
            }
            br.close();

            System.out.println("HTTP status code: " + status);
            System.out.println("Response JSON: " + response.toString());

            if (status == 200) {
                Gson gson = new Gson();
                JsonObject jsonObj = gson.fromJson(response.toString(), JsonObject.class);
                String requestId = jsonObj.get("request_id").getAsString();

                System.out.println("Deleted successfully");
                System.out.println("Request ID: " + requestId);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

qwen-voice-enrollment (pre-created translation voice)

curl -X POST 'https://dashscope.aliyuncs.com/api/v1/services/audio/tts/customization' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen-voice-enrollment",
    "input": {"action": "delete", "voice": "VOICE_ID"}
  }'

Response Body

request_id string

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The unique identifier of this request.

Qwen-Omni、Qwen-Omni-Realtime:

Request ID。

output object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

The data returned by the model. This is an empty object.

usage object

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Usage information for this request.

Qwen-Omni、Qwen-Omni-Realtime:

Usage information.

Properties

count integer

Qwen-Audio-TTS、Qwen-Audio-Realtime、CosyVoice:

Always 1.

Qwen-Omni、Qwen-Omni-Realtime:

The number of "create voice" operations actually billed for this request. The cost of this request is count × 0.01CNY.

Deleting voices is not billed, so count is always 0.

Response examples

voice-enrollment (text-to-speech example)

{
    "output": {},
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

voice-enrollment (real-time conversation example)

{
    "output": {},
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

qwen-voice-enrollment (multimodal example)

{
    "usage": {
        "count": 0
    },
    "request_id": "yourRequestId"
}

Voice status descriptions

The following states correspond to the voice-enrollment interfaces of Qwen-Audio-TTS, Qwen-Audio-Realtime, and CosyVoice.

Created voices go through a review process. The following statuses apply to Qwen-Audio-TTS, Qwen-Audio-Realtime, and CosyVoice.

StatusDescription

DEPLOYING

Under review or processing.

OK

Review passed. The voice is ready to use.

UNDEPLOYED

Review rejected. The voice can't be used.

Error messages

If you encounter any errors, please refer to Error Codes for troubleshooting.

Using Voice Tones in Model Invocation

For definitions of SDK in Qwen-Audio-TTS, Qwen-Audio-Realtime, and CosyVoice, see also Java SDK and Python SDK.