Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Crie uma voz projetada
OpenAPI
openapi: 3.1.0
info:
title: CosyVoice Voice Design API — Create voice
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/services/audio/tts/customization:
post:
operationId: createVoiceDesignCosyVoice
summary: Create a designed voice
description: Design a voice from a text description for CosyVoice TTS models. Returns a `voice_id` and Base64-encoded preview audio.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateRequest"
responses:
"200":
description: Voice created successfully
content:
application/json:
schema:
$ref: "#/components/schemas/CreateResponse"
x-codeSamples:
- lang: bash
label: cURL
source: |-
curl -X POST https://maas.qwencloudapi.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": "cosyvoice-v3.5-plus",
"voice_prompt": "A composed middle-aged male announcer with a deep, rich voice",
"preview_text": "Dear listeners, hello everyone",
"prefix": "announcer",
"language_hints": ["en"]
},
"parameters": {
"sample_rate": 24000,
"response_format": "wav"
}
}'
components:
schemas:
CreateRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: Fixed to `voice-enrollment` (shared with voice cloning).
enum:
- voice-enrollment
example: voice-enrollment
input:
type: object
required:
- action
- target_model
- voice_prompt
- preview_text
- prefix
properties:
action:
type: string
description: Fixed to `create_voice` (same as voice cloning).
enum:
- create_voice
example: create_voice
target_model:
type: string
description: Speech synthesis model for the designed voice. Must match the model in subsequent synthesis calls.
enum:
- cosyvoice-v3.5-plus
- cosyvoice-v3.5-flash
- cosyvoice-v3-plus
- cosyvoice-v3-flash
example: cosyvoice-v3.5-plus
voice_prompt:
type: string
description: Voice description. Chinese and English only. Max 500 characters.
maxLength: 500
example: A composed middle-aged male announcer with a deep, rich voice
preview_text:
type: string
description: Text for the preview audio. Chinese and English only. Min 15 characters, max 200 characters.
minLength: 15
maxLength: 200
example: Dear listeners, hello everyone
prefix:
type: string
description: "Voice name prefix. Alphanumeric only, max 10 characters. Generated voice name format: `{target_model}-vd-{prefix}-{unique_id}`."
maxLength: 10
pattern: ^[a-zA-Z0-9]+$
example: announcer
language_hints:
type: array
items:
type: string
description: "Specifies the language tendency of the generated voice. Must match the `preview_text` language. Only the first element is used. Supported: `zh`, `en`."
default:
- zh
example:
- en
parameters:
type: object
description: Preview audio settings.
properties:
sample_rate:
type: integer
description: Sample rate in Hz for the preview audio.
enum:
- 16000
- 24000
- 48000
default: 24000
example: 24000
response_format:
type: string
description: Audio format for the preview.
enum:
- pcm
- wav
- mp3
default: wav
example: wav
CreateResponse:
type: object
properties:
output:
type: object
properties:
voice_id:
type: string
description: Generated voice ID. Pass as the `voice` parameter in CosyVoice synthesis calls.
example: cosyvoice-v3.5-plus-vd-announcer-xxxxxx
preview_audio:
type: object
description: Preview audio data.
properties:
data:
type: string
description: Base64-encoded preview audio.
example: "{base64_encoded_audio}"
sample_rate:
type: integer
description: Sample rate of the preview audio in Hz.
example: 24000
response_format:
type: string
description: Format of the preview audio.
example: wav
target_model:
type: string
description: Speech synthesis model bound to this voice.
example: cosyvoice-v3.5-plus
usage:
type: object
properties:
count:
type: integer
description: Billed voice creation operations. Always `1`.
example: 1
request_id:
type: string
description: Request ID for troubleshooting.
example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API key. Get one at [API key](/api-reference/preparation/api-key).