Skip to main content

Qwen-Audio, CosyVoice Voice Cloning HTTP API Reference

Create, query, update, and delete Qwen-Audio and CosyVoice voices.

This document applies to Qwen-Audio-TTS, Qwen-Audio-Realtime, and CosyVoice. First obtain an API Key and configure environment variables. The request examples read DASHSCOPE_API_KEY. When using different APIs to manage the same voice, use the same account. For SDK definitions, see also Java SDK and Python SDK.

API Endpoint

  • China (Beijing)
  • Singapore
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/tts/customization
Replace {WorkspaceId} with your actual Workspace ID, which you can view on the Workspace Details page in the Bailian console. API Keys differ between Beijing and Singapore.
Alibaba Cloud Bailian has launched workspace-specific domains for the China (Beijing) and Singapore regions, delivering superior performance and higher stability for inference requests. Migrating to the new domains is recommended:
  • China (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 domains continue to work as usual.

Request Headers

AuthorizationstringRequired: Yes
The authentication token, in the format Bearer <your_api_key>. When using it, replace "<your_api_key>" with your actual API Key.
Content-TypestringRequired: Yes
Fixed to application/json.

Audio Requirements and Billing

For reference audio requirements, see the Voice Cloning User Guide. For the Qwen-Audio-Realtime cloning workflow, see Realtime Voice Chat voice cloning. Creating voices for Qwen-Audio-Realtime is free; model calls are billed according to the target model. For details, see Billing Details, and for quantity limits, see Quota description.

Request Body

modelstring(Required)
Fixed to voice-enrollment.
inputobject(Required)
actionstring(required)
Operation type:
  • create_voice: Create a voice.
  • list_voice: Query the voice list.
  • query_voice: Query voice details.
  • update_voice: Update a voice.
  • delete_voice: Delete a voice.
target_modelstring(required when creating)
The target model that will use the voice later. It must be consistent with the model used in subsequent calls; otherwise, the call fails.The target model can be a Qwen-Audio-TTS, Qwen-Audio-Realtime, or CosyVoice model that supports Voice Cloning. For the specific models and regions, see Supported models.
audiostring(required when creating or updating if url is not specified)
Provide the reference audio when creating, or the new reference audio when updating. Supports a publicly accessible URL or a Base64 Data URI, such as data:audio/wav;base64,....
Compatible with the legacy parameter url; when using url, you can omit audio. url will be gradually deprecated; we recommend switching to audio.
prefixstring(Required when creating, optional when querying the list)
When creating: the prefix of the voice name. Only digits and English letters are allowed, up to 10 characters. The generated voice name format: {target_model}-{prefix}-{unique identifier}.When listing: filters voices by prefix.
language_hintsarray[string](optional when creating)
Helps the model identify the language of the sample audio, so it can extract voice features more accurately and improve the cloning quality. If the specified language does not match the actual audio language (for example, setting en for Chinese audio), the system ignores this setting and automatically detects the language.This parameter is an array, and its length must be 1.
Applies 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.
  • 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_lengthfloat(optional when creating)
The maximum duration (in seconds) of the reference audio used for Voice Cloning after audio preprocessing. Value range: [3.0, 30.0].Default value: 10.0.
Applies 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_preprocessboolean(optional when creating)
Whether to enable audio preprocessing (noise reduction, audio enhancement, and volume leveling). We recommend enabling it when there is background noise, and disabling it in quiet environments to preserve the voice as much as possible.Default value: false.
Applies 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_normalizationstring(optional when creating)
Whether to normalize the volume of the sample audio used for Voice Cloning. Values:
  • "true": Enable volume normalization.
  • "false": Disable volume normalization.
When enabled, audio synthesized using the created voice may have a different volume than a voice created with this parameter disabled.Default value: "false".
page_indexinteger(Optional when querying the list)
Page index.
page_sizeinteger(Optional when querying the list)
Number of records per page.
voice_idstring(Required when querying details, updating, or deleting)
The ID of the voice to query, update, or delete.

Request example

  • Create
  • Query list
  • Query details
  • Update
  • Delete
The example uses qwen-audio-3.1-tts-plus. Replace target_model in input with your actual target model ID.The following is the configuration for the Singapore region. Replace "{WorkspaceId}" with your actual workspace ID when calling. Configurations differ across regions.
curl -X POST https://{WorkspaceId}.ap-southeast-1.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 with the following code and fill the value of audio into 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")

Response body

request_idstring
The unique identifier of this call.
outputobject
Returns the corresponding fields when creating, querying the list, or querying details; returns an empty object when updating or deleting.
voice_idstring(Returned when creating)
Voice ID.
voice_listarray[object](Returned when querying the list)
The list of queried voices.
voice_idstring
Voice ID.
target_modelstring
The target model that drives the voice (speech synthesis or realtime voice chat).
gmt_createstring
Created At.
gmt_modifiedstring
Updated At.
statusstring
Voice status. For valid values, see "Voice status description".
resource_linkstring(Returned when querying details)
The URL address of the audio file.
gmt_createstring(Returned when querying details)
Created At.
gmt_modifiedstring(Returned when querying details)
Updated At.
statusstring(Returned when querying details)
Voice status. For valid values, see "Voice status description".
target_modelstring(Returned when querying details)
The target model that drives the voice (speech synthesis or realtime voice chat).
usageobject
Usage information for this request.
countinteger
Fixed at 1. When creating a voice, it indicates the number of voices created.

Response Example

  • Create
  • Query list
  • Query details
  • Update
  • Delete
{
    "output": {
        "voice_id": "qwen-audio-3.1-tts-plus-myvoice-xxxxxx"
    },
    "usage": {
        "count": 1
    },
    "request_id": "xxxx-xxxx-xxxx"
}

Voice Status

After a voice is created, it goes through a review process.
StatusDescription
DEPLOYINGIn Review/Processing.
OKThe review is passed, and the voice can be used normally.
UNDEPLOYEDThe review is not passed, and the voice cannot be used.

Error Messages

If you encounter errors, see Error codes for troubleshooting.