tencent cloud

APIs

TextToSpeechAsync

下载
聚焦模式
字号
最后更新时间: 2026-09-18 16:50:59

1. API Description

Domain name for API request: vod.intl.tencentcloudapi.com.

Initiate a speech synthesis task to convert text to speech for long text scenarios (up to 200,000 characters). It supports specifying voice tone, speaking rate, volume, pitch, sampling rate, output format, and other synthesis parameters. Speech synthesis is an asynchronous task, and audio results are generated upon completion.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: TextToSpeechAsync.
Version Yes String Common Params. The value used for this API: 2018-07-17.
Region No String Common Params. This parameter is not required.
Text Yes String

Text to convert to speech.

VoiceId Yes String

Voice ID.

SubAppId No String

VOD application ID. For customers who activate on-demand services after December 25, 2023, this field must be set to the application ID when accessing resources in on-demand applications, whether in the default application or a newly created application.

LanguageBoost No String

Language enhancement, such as "zh" "en" "auto", default "auto"

ExtParam No String

Extended parameters for text-to-synthesized speech (async). Fields supported by ExtParam:

  • model (string): Synthesis model. Selectable values: minimax-speech-2.8-hd, minimax-speech-2.8-turbo, minimax-speech-2.6-hd, minimax-speech-2.6-turbo, minimax-speech-02-hd, minimax-speech-02-turbo. Default: minimax-speech-2.8-hd.
  • text_lang (string): Text language, for example zh / en. Synonymous with the input parameter LanguageBoost. If both are passed, ExtParam takes precedence.
  • audio_setting (object): Audio output and voice type fine-tuning parameters. Note: For the async API, speaking rate, volume, pitch, and emotion are all under audio_setting, different from voice_setting in the Synchronous Interface. Optional fields:
    • speed (float): Speaking rate, [0.5, 2.0]. Default: 1.0.
    • vol (float): Volume, (0, 10]. Default: 1.0.
    • pitch (int): Pitch, [-12, 12]. Default: 0.
    • emotion (string): Emotion. Selectable values: happy / sad / angry / fearful / disgusted / surprised / calm / fluent / whisper.
    • sample_rate (int): Sampling rate. Selectable values: 8000 / 16000 / 22050 / 24000 / 32000 / 44100. Default: 16000.
    • format (string): Audio format. Selectable values: mp3 / wav. Default: wav.
    • duration (float): Target duration in seconds.
    • cut_silence (bool): Whether to trim silence segments.
Output No TextToSpeechAsyncOutputOption

Output parameters.

Specifies the output format, etc. The default output audio format is url.

SessionContext No String

Identifies source context. This is used to pass user request information. The callback and task flow status change callback return the value of this field. The maximum length is 1000 characters.

SessionId No String

Identification Code for Task Deduplication. If a request with the same identification code has been made within the past 3 days, an error will be returned for the current request. The maximum length is 50 characters. If this is not specified or left empty, it indicates no deduplication.

3. Output Parameters

Parameter Name Type Description
TaskId String

Task ID. Use this ID to query the result.

RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Text to Speech

Text to speech

Input Example

POST / HTTP/1.1
Host: vod.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: TextToSpeechAsync
<Common request parameters>

{
"Text": "Text to Speech Test"
    "VoiceId": "ttv-voice-20************26-qaFeULIp",
    "SubAppId": "260***028",
    "SessionId": "6bb56a09278***********6dab783eff"
}

Output Example

{
    "Response": {
        "TaskId": "260085028-TextToSpeec********************5b37f06c0e0b890c60ct",
        "RequestId": "e6dd5ca8-43f2-4bcd-9f4a-4e58e4cb4e19"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

There is no error code related to the API business logic. For other error codes, please see Common Error Codes.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈