> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwencloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Non-real-time speech synthesis

> Convert complete text to speech over HTTP. Explore model features, make your first request, and improve synthesis quality.

<meta property="og:title" content="Non-real-time speech synthesis" />

<a id="a5e9de808eli8" />

<a id="f9ec7be148l9g" />

## Features

Non-real-time speech synthesis accepts complete text in one HTTP request and supports non-streaming and SSE streaming output. Non-streaming output returns the complete audio after synthesis finishes. Streaming output returns audio in chunks.

<a id="37914114aaidw" />

<a id="df054d5bdazem" />

<a id="783e508579rco" />

<a id="85be1a1a9fylb" />

- **Languages and dialects**: Select a model and voice for the target language, or use an instruction to specify a dialect. See [Dialects](/developer-guides/speech/tts#8a7604d333kut).
- **Expressive speech**: Adjust delivery with natural-language instructions, or insert emotion and nonverbal tags into the text. See [Instruction control](/developer-guides/speech/tts#nrt_instruct_h3) and [Emotion and nonverbal tags](/developer-guides/speech/tts#nrt_emtag_h3).
- **Custom voices**: Create a voice from an audio sample with [voice cloning](/developer-guides/speech/voice-cloning), or from a text description with [voice design](/developer-guides/speech/voice-design).
- **Fine-grained control and formulas**: Use [SSML and LaTeX](/developer-guides/speech/ssml) to control pauses and pronunciation, or convert formulas to speech.
- **Markdown filtering**: Convert Markdown text with tables and other structures into content suitable for reading aloud. See [Markdown filtering](/developer-guides/speech/tts#tts_markdown_filter).

<Note>
  * Supported features vary by model and voice. Check the scope in the corresponding feature documentation.
  * To submit text incrementally, use [real-time speech synthesis](/developer-guides/speech/realtime-streaming).
</Note>

<a id="e79cb56cfdbbp" />

<a id="a77dbbb536qli" />

## Get started

<a id="nrt00_prereq_h2" />

<a id="nrt00_prereq_sec" />

- [Obtain an API key](/api-reference/preparation/api-key) and [set the environment variable](/api-reference/preparation/api-key#use-an-api-key) `DASHSCOPE_API_KEY`. Use a key for the region in the example.
- The Qwen-Audio-TTS examples use the Singapore endpoint. For another region, replace `ap-southeast-1` in the URL. The CosyVoice examples use China North 2 (Beijing), the only region where CosyVoice is available through this API. See [Regions](/developer-guides/getting-started/regions).
- Install the example dependency:

```bash
pip install requests
```

<Tabs>
  <Tab title="Qwen-Audio-TTS (Recommended)">
    The following examples use `qwen-audio-3.1-tts-flash` and the `longanhuan_v3.1` system voice in Singapore to demonstrate non-streaming and streaming output.

    <Tabs>
      <Tab title="Non-streaming output">
        ```python height="400" expandable
        import os
        import requests

        response = requests.post(
          # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
          # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
          'https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/audio/tts/SpeechSynthesizer',
          headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}"},
          json={
            "model": "qwen-audio-3.1-tts-flash",
            "input": {
              "text": "Hello, welcome to QwenCloud.",
              "voice": "longanhuan_v3.1",
              "format": "wav",
              "sample_rate": 24000
            }
          },
          timeout=60,
        )
        response.raise_for_status()
        audio_url = response.json()["output"]["audio"]["url"]
        audio_response = requests.get(audio_url, timeout=60)
        audio_response.raise_for_status()
        with open("output.wav", "wb") as f:
          f.write(audio_response.content)
        ```

        The audio is saved as `output.wav` in the current directory.
      </Tab>

      <Tab title="Streaming output">
        This example prints the returned SSE events line by line. The `output.audio.data` field contains a Base64-encoded audio chunk.

        ```python height="400" expandable
        import os
        import requests

        response = requests.post(
          # Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
          # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
          'https://ap-southeast-1.maas.qwencloudapi.com/api/v1/services/audio/tts/SpeechSynthesizer',
          headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}", "X-DashScope-SSE": "enable"},
          json={
            "model": "qwen-audio-3.1-tts-flash",
            "input": {
              "text": "Hello, welcome to QwenCloud.",
              "voice": "longanhuan_v3.1",
              "format": "wav",
              "sample_rate": 24000
            }
          },
          stream=True,
          timeout=60,
        )
        response.raise_for_status()
        for line in response.iter_lines():
          print(line.decode("utf-8"))
        response.close()
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="CosyVoice">
    The following examples use `cosyvoice-v3-flash` and the `longanyang` system voice in China North 2 (Beijing) to demonstrate non-streaming and streaming output.

    <Tabs>
      <Tab title="Non-streaming output">
        ```python height="400" expandable
        import os
        import requests

        response = requests.post(
          # China North 2 (Beijing). This model is available only in this region.
          # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
          'https://cn-beijing.maas.qwencloudapi.com/api/v1/services/audio/tts/SpeechSynthesizer',
          headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}"},
          json={
            "model": "cosyvoice-v3-flash",
            "input": {
              "text": "Hello, welcome to QwenCloud.",
              "voice": "longanyang",
              "format": "wav",
              "sample_rate": 24000
            }
          },
          timeout=60,
        )
        response.raise_for_status()
        audio_url = response.json()["output"]["audio"]["url"]
        audio_response = requests.get(audio_url, timeout=60)
        audio_response.raise_for_status()
        with open("output.wav", "wb") as f:
          f.write(audio_response.content)
        ```

        The audio is saved as `output.wav` in the current directory.
      </Tab>

      <Tab title="Streaming output">
        This example prints the returned SSE events line by line. The `output.audio.data` field contains a Base64-encoded audio chunk.

        ```python height="400" expandable
        import os
        import requests

        response = requests.post(
          # China North 2 (Beijing). This model is available only in this region.
          # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
          'https://cn-beijing.maas.qwencloudapi.com/api/v1/services/audio/tts/SpeechSynthesizer',
          headers={"Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}", "X-DashScope-SSE": "enable"},
          json={
            "model": "cosyvoice-v3-flash",
            "input": {
              "text": "Hello, welcome to QwenCloud.",
              "voice": "longanyang",
              "format": "wav",
              "sample_rate": 24000
            }
          },
          stream=True,
          timeout=60,
        )
        response.raise_for_status()
        for line in response.iter_lines():
          print(line.decode("utf-8"))
        response.close()
        ```
      </Tab>
    </Tabs>
  </Tab>
</Tabs>

<a id="12884a10929p9" />

<a id="d815caea76zx8" />

## Improve synthesis quality

### Languages and pronunciation

If numbers, abbreviations, or symbols are pronounced incorrectly, use `language_hints` to specify the target language. For configuration details, see the [Qwen-Audio-TTS API](/api-reference/speech-synthesis/qwen-audio-tts/http-api) or [CosyVoice API](/api-reference/speech-synthesis/cosyvoice/http-api). With Qwen-Audio-TTS, you can also use `hot_fix` to specify how a word is pronounced or replace it before synthesis.

Use SSML to control pauses, the reading of numbers, or word pronunciation. For supported Qwen-Audio-TTS and CosyVoice models, voices, interfaces, and tags, see [SSML and LaTeX](/developer-guides/speech/ssml).

### Markdown filtering <span id="tts_markdown_filter" />

When synthesizing content that contains Markdown such as tables and links, set `enable_markdown_filter` to `true` so the service converts Markdown into text suitable for reading aloud before synthesis. Qwen-Audio-TTS and CosyVoice support this feature, except cosyvoice-v2. For configuration, see the [Qwen-Audio-TTS API](/api-reference/speech-synthesis/qwen-audio-tts/http-api) and [CosyVoice API](/api-reference/speech-synthesis/cosyvoice/http-api).

<a id="nrt_instruct_h3" />

<a id="nrt_instruct_sec" />

### Instruction control

Add `instruction` to the request’s `input` object to specify the synthesis language and describe the speech rate, emotion, or speaking style in natural language.

<Note>
  To create a new voice with a specific gender, age, or vocal character, or for guidance and examples on writing voice descriptions, see [voice design](/developer-guides/speech/voice-design).
</Note>

<Tabs>
  <Tab title="Qwen-Audio-TTS">
    System, cloned, and designed voices for `qwen-audio-3.1-tts-plus`, `qwen-audio-3.1-tts-flash`, `qwen-audio-3.0-tts-plus`, and `qwen-audio-3.0-tts-flash` all support natural-language instructions through `instruction` in synthesis requests.

    We recommend specifying the synthesis language and desired effect in `instruction` to improve synthesis quality. The language specified in the instruction must match the language of the text to be synthesized. For example, when synthesizing Dutch text, set:

    ```json
    {"instruction": "请用荷兰话说，每个字都慢慢说"}
    ```
  </Tab>

  <Tab title="CosyVoice">
    <Note>
      For CosyVoice, `instruction` must not exceed 100 characters. Chinese characters, including simplified and traditional characters and Chinese characters used in Japanese and Korean, count as two characters each. Other characters, including punctuation, letters, digits, kana, and Hangul, count as one each.
    </Note>

    <table style={{ display: "table", tableLayout: "fixed", width: "100%", overflowWrap: "anywhere" }}>
      <colgroup>
        <col style={{ width: "27%" }} />

        <col style={{ width: "18%" }} />

        <col style={{ width: "29%" }} />

        <col style={{ width: "26%" }} />
      </colgroup>

      <thead>
        <tr>
          <th style={{ verticalAlign: "top" }}>**Model**</th>
          <th style={{ verticalAlign: "top" }}>**Applicable voices**</th>
          <th style={{ verticalAlign: "top" }}>**Instruction requirements**</th>
          <th style={{ verticalAlign: "top" }}>**Instruction text languages**</th>
        </tr>
      </thead>

      <tbody>
        <tr>
          <td style={{ verticalAlign: "top" }}>
            `cosyvoice-v3.5-plus`, `cosyvoice-v3.5-flash`
          </td>

          <td style={{ verticalAlign: "top" }}>
            Cloned and designed voices

            No system voices.
          </td>

          <td style={{ verticalAlign: "top" }}>
            Natural-language instructions.
          </td>

          <td style={{ verticalAlign: "top" }}>
            Chinese, English, French, German, Japanese, Korean, Russian, Portuguese, Thai, Indonesian, and Vietnamese.
          </td>
        </tr>

        <tr>
          <td style={{ verticalAlign: "top" }}>
            `cosyvoice-v3-plus`
          </td>

          <td style={{ verticalAlign: "top" }}>
            System voices
          </td>

          <td style={{ verticalAlign: "top" }}>
            Use the fixed format and content in the [voice list](/developer-guides/speech/voice-list/cosyvoice).

            Cloned and designed voices do not support instruction control.
          </td>

          <td style={{ verticalAlign: "top" }}>
            Use the language specified in the [voice list](/developer-guides/speech/voice-list/cosyvoice).
          </td>
        </tr>

        <tr>
          <td rowSpan={2} style={{ verticalAlign: "top" }}>
            `cosyvoice-v3-flash`
          </td>

          <td style={{ verticalAlign: "top" }}>
            System voices
          </td>

          <td style={{ verticalAlign: "top" }}>
            Use the fixed format and content in the [voice list](/developer-guides/speech/voice-list/cosyvoice).
          </td>

          <td style={{ verticalAlign: "top" }}>
            Chinese.
          </td>
        </tr>

        <tr>
          <td style={{ verticalAlign: "top" }}>
            Cloned and designed voices
          </td>

          <td style={{ verticalAlign: "top" }}>
            Natural-language instructions.
          </td>

          <td style={{ verticalAlign: "top" }}>
            Chinese, English, French, German, Japanese, Korean, and Russian.
          </td>
        </tr>
      </tbody>
    </table>
  </Tab>
</Tabs>

<a id="8a7604d333kut" />

<a id="de110724854ez" />

### Dialects

Use dialect synthesis to generate speech in Chinese dialects such as Henan or Sichuan dialect. How you select a dialect depends on the model and voice type.

<Tabs>
  <Tab title="Qwen-Audio-TTS">
    - **System voices**: Select a voice from the [Qwen-Audio-TTS voice list](/developer-guides/speech/voice-list/qwen-audio-tts) that supports the dialect. A voice that directly supports the dialect requires no additional setting. For voices that support dialect instructions, use `instruction`.

      <Note>
        For the multilingual and dialect voices of qwen-audio-3.1-tts-flash, you can also use `language_hints` to specify a dialect. See [the multilingual and dialect voice settings](/developer-guides/speech/voice-list/qwen-audio-tts#qwen-tts31-language-hints).
      </Note>

    - **Cloned voices**: Specify a dialect with `instruction`, such as `请用河南话表达。`.

    - **Designed voices**: Dialects are not supported.

    For voices that support dialect instructions, set `instruction="请讲上海话。"` in the request's `input` object to synthesize Chinese text in Shanghainese.
  </Tab>

  <Tab title="CosyVoice">
    - **System voices**: Select a voice that directly supports the dialect, such as `longshange_v3`, or a voice that supports dialect instructions, such as `longanhuan_v3`. Follow the format in the [voice list](/developer-guides/speech/voice-list/cosyvoice).
    - **Cloned voices**: Use `instruction` with a model that supports instruction control to specify a dialect.
    - **Designed voices**: Dialects are not supported.

    <Note>
      Cloned voices for `cosyvoice-v3-plus` do not support specifying a dialect through instructions.
    </Note>

    In the CosyVoice getting started example, replace `input` with the following content to generate the Henan dialect with `longanhuan_v3`:

    ```json
    {
      "text": "叫你去买盐，你买回来一袋面，这不是弄啥嘞吗！",
      "voice": "longanhuan_v3",
      "format": "wav",
      "sample_rate": 24000,
      "instruction": "请用河南话表达。"
    }
    ```
  </Tab>
</Tabs>

Qwen3-TTS uses system voices that support the target dialect. See the [Qwen3-TTS voice list](/developer-guides/speech/voice-list/qwen-tts).

<a id="nrt_emtag_h3" />

### Emotion and nonverbal tags

<Note>
  Applies to `qwen-audio-3.1-tts-plus`, `qwen-audio-3.1-tts-flash`, `qwen-audio-3.0-tts-plus`, and `qwen-audio-3.0-tts-flash`.
</Note>

Emotion and paralinguistic tags control the emotion and style of speech and insert sounds such as laughter or sighs at specific positions. Write the tags directly in the text to synthesize, `text`, without additional parameters.

#### Usage examples

This text starts with an excited delivery, inserts laughter, and then continues speaking:

```text
[excited]今天的天气真不错！[laughing]我们一起出去玩吧！
```

This text switches to an excited delivery in the second sentence:

```text
[serious]请注意安全事项。[excited]好了，现在让我们开始吧！
```

#### Supported tags

<Tabs>
  <Tab title="Control tags">
    A control tag sets the emotion or style of the following text until the next control tag. When long sentences are automatically segmented, the effect is bounded by the resulting text segment.

| **Tag**                    | **Description**       |
| -------------------------- | --------------------- |
| `[sad]`                    | Sad                   |
| `[amazed]`                 | Amazed                |
| `[deep and loud shouting]` | Deep, loud shouting   |
| `[trembling]`              | Trembling             |
| `[angry]`                  | Angry                 |
| `[excited]`                | Excited               |
| `[sarcastic]`              | Sarcastic             |
| `[curious]`                | Curious               |
| `[like dracula]`           | Dracula-like delivery |
| `[bored]`                  | Bored                 |
| `[tired]`                  | Tired                 |
| `[scornful]`               | Scornful              |
| `[shouting]`               | Shouting              |
| `[asmr]`                   | Soft ASMR delivery    |
| `[panicked]`               | Panicked              |
| `[mischievously]`          | Mischievous           |
| `[empathetic]`             | Empathetic            |
| `[whispers]`               | Whispering            |
| `[reluctantly]`            | Reluctant             |
| `[crying]`                 | Crying                |
| `[serious]`                | Serious               |
| `[very slowly]`            | Very slow             |
| `[very fast]`              | Very fast             |
  </Tab>

  <Tab title="Nonverbal tags">
    A nonverbal tag inserts a sound at its position without changing the emotional style of the surrounding text.

| **Tag**           | **Description**  |
| ----------------- | ---------------- |
| `[gasp]`          | Gasp             |
| `[sighing]`       | Sigh             |
| `[clears throat]` | Clear the throat |
| `[giggles]`       | Giggle           |
| `[laughing]`      | Laugh            |
| `[cough]`         | Cough            |
| `[snorts]`        | Snort            |
  </Tab>
</Tabs>

<a id="nrt_production_h2" />

## Apply in production

For audio downloads and storage, format and player compatibility, concurrency management, and troubleshooting, see [Speech synthesis best practices](/developer-guides/speech/tts-high-concurrency-best-practices). Keep request frequency and concurrency within the model's [rate limits](/developer-guides/administration/rate-limits).

<a id="4a43cc1bb7kxg" />

<a id="d2ad2470a394c" />

## Supported models

<Tabs>
  <Tab title="Singapore">
    - **Qwen-Audio-TTS**: `qwen-audio-3.1-tts-plus`, `qwen-audio-3.1-tts-flash`, `qwen-audio-3.0-tts-plus`, `qwen-audio-3.0-tts-flash`
    - **Qwen3-TTS**: `qwen3-tts-flash`
  </Tab>

  <Tab title="China North 2 (Beijing)">
    - **Qwen-Audio-TTS**: `qwen-audio-3.1-tts-plus`, `qwen-audio-3.1-tts-flash`, `qwen-audio-3.0-tts-plus`, `qwen-audio-3.0-tts-flash`
    - **CosyVoice**: `cosyvoice-v3.5-plus`, `cosyvoice-v3.5-flash`, `cosyvoice-v3-plus`, `cosyvoice-v3-flash`, `cosyvoice-v2`
    - **Qwen3-TTS**: `qwen3-tts-flash`
  </Tab>
</Tabs>

<a id="bac280ddf5a1u" />

<a id="184aea6f4399s" />

For system voices and audio samples, see the [Qwen-Audio-TTS](/developer-guides/speech/voice-list/qwen-audio-tts), [CosyVoice](/developer-guides/speech/voice-list/cosyvoice), and [Qwen3-TTS](/developer-guides/speech/voice-list/qwen-tts#261bc7f209ri2) voice lists. A cloned or designed voice must be used with the target model specified when the voice was created.

<a id="bb4dbbdb74em4" />

<a id="d774348f5dboq" />

## API reference

- [Qwen-Audio-TTS HTTP API](/api-reference/speech-synthesis/qwen-audio-tts/http-api)
- [CosyVoice HTTP API](/api-reference/speech-synthesis/cosyvoice/http-api)
- [Qwen3-TTS API](/api-reference/speech-synthesis/qwen-tts)
