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

# Qwen3-TTS

> Choose a built-in voice, design a voice from a description, or clone a speaker.

Choose a checkpoint by how you specify the speaker. `qwen3_tts` and `qwen3_tts_1p7b` use built-in voices. `qwen3_tts_voicedesign` requires a description of a voice. `qwen3_tts_base` clones a speaker from a recording.

## Install and start

Install `qwen-tts` with `--no-deps` to keep the serving environment’s Transformers version.

### `qwen3_tts`

Text → audio. The default `qwen3tts.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[qwen3_tts]"
uv pip install --torch-backend=auto --no-deps "qwen-tts==0.1.1"
mstar serve qwen3_tts
```

[Send the request](#custom-voice).

### `qwen3_tts_1p7b`

Text → audio. The default `qwen3tts_1p7b.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[qwen3_tts]"
uv pip install --torch-backend=auto --no-deps "qwen-tts==0.1.1"
mstar serve qwen3_tts_1p7b
```

[Send the request](#custom-voice).

### `qwen3_tts_voicedesign`

Text → audio. The default `qwen3tts_voicedesign.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[qwen3_tts]"
uv pip install --torch-backend=auto --no-deps "qwen-tts==0.1.1"
mstar serve qwen3_tts_voicedesign
```

[Send the request](#design-voice).

### `qwen3_tts_base`

Text, audio → audio. The default `qwen3tts_base.yaml` uses 1 GPU. The [weights](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-Base) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[qwen3_tts]"
uv pip install --torch-backend=auto --no-deps "qwen-tts==0.1.1"
mstar serve qwen3_tts_base
```

[Send the request](#clone-voice).

## Send a request

Run either client example in a second terminal after `/health` returns 200.

### Use a built-in speaker

Save the synthesized speech as `reply.wav`.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
reply = client.tts(
    'The next stop is Central.',
    voice='vivian',
    language='English',
)
reply.to_wav("reply.wav")
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/v1/audio/speech \
  -H 'Content-Type: application/json' \
  -d '{"input": "The next stop is Central.", "response_format": "wav", "voice": "vivian", "language": "English"}' -o reply.wav
```

### Describe a voice

Save the synthesized speech as `reply.wav`.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
reply = client.tts(
    'The next stop is Central.',
    instruct='Speak in a low, warm voice.',
    language='English',
)
reply.to_wav("reply.wav")
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/v1/audio/speech \
  -H 'Content-Type: application/json' \
  -d '{"input": "The next stop is Central.", "response_format": "wav", "instructions": "Speak in a low, warm voice.", "language": "English"}' -o reply.wav
```

### Clone a reference voice

Supply a clean reference in `speaker.wav`. The SDK writes a WAV file. The native HTTP example saves signed 16-bit PCM.

**Python SDK**

```python theme={null}
from mstar import MStarClient

client = MStarClient("http://localhost:8000")
reply = client.tts(
    'The next stop is Central.',
    reference_audio="speaker.wav",
    x_vector_only_mode=True,
)
reply.to_wav("reply.wav")
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/generate \
  --form-string 'text=The next stop is Central.' \
  -F files=@speaker.wav \
  --form-string input_modalities=audio,text \
  --form-string output_modalities=audio \
  --form-string streaming=false \
  --form-string 'model_kwargs={"x_vector_only_mode":true}' \
  | python3 -c '
import base64, json, sys

outputs = json.load(sys.stdin)["outputs"]
with open("reply.pcm", "wb") as file:
    for chunk in outputs["audio"]:
        file.write(base64.b64decode(chunk["data"]))
'
```

## Deployment configs

| File | GPUs | Layout | Use |
| - | - | - | - |
| `qwen3tts.yaml` | 1 | Talker and codec on one worker | 0.6B default |
| `qwen3tts_split.yaml` | 1 | Codec on a second worker on GPU 0, `mps: true` | 0.6B throughput at high concurrency; slower at concurrency 1 |
| `qwen3tts_1p7b.yaml` | 1 | One worker, bf16 codec, first chunk of 4 frames, 511 codec streams | 1.7B default |
| `qwen3tts_1p7b_split.yaml` | 1 | Codec on a second worker on GPU 0, no MPS | Lower first-audio latency at high concurrency |
| `qwen3tts_voicedesign.yaml` | 1 | One worker | VoiceDesign default |
| `qwen3tts_base.yaml` | 1 | RefEncoder, Talker and codec on one worker, 2304 KV pages for an 80 GB GPU | Base default, sized for an 80 GB GPU |
| `qwen3tts_base_split.yaml` | 1 | Talker, codec and RefEncoder on three workers on GPU 0, `mps: true` | Base throughput from concurrency 8 up |

Every shipped config pins `resources.talker_attn.flashinfer_backend: fa2`. `mps: true` is NVIDIA only and needs `nvidia-cuda-mps-control` on `PATH`.

To use an alternative, pass `--config configs/<file>` after the launcher name. From a wheel installation, [copy the shipped YAML](https://docs.m-star.org/serving.md#custom-configs) and pass its local path.

## Settings and defaults

Request fields (on `/v1/audio/speech`, all but `voice`, `instructions`, `temperature`, `top_p` and `seed` go in `extra_body`):

| Field | Default | Effect |
| - | - | - |
| `voice` | `vivian` | A CustomVoice speaker, case-insensitive; an unknown one is a 400 that lists them. Refused on VoiceDesign and Base. |
| `language` | automatic | For example `English`. |
| `instructions` | none | Style on the 1.7B CustomVoice, the voice description on VoiceDesign (required there). `instruct` on `/generate`. |
| `ref_audio`, `ref_text`, `x_vector_only_mode` | none | Base cloning takes one 1–30 s clip. On `/v1/audio/speech`, send a data URL, bare base64 audio or an HTTP(S) URL with `MSTAR_ALLOW_REMOTE=1`. The server refuses server-side paths. The SDK uploads a local file with `reference_audio="ref.wav"`. |
| `non_streaming_mode` | per variant | CustomVoice and VoiceDesign put the whole text in the prefill; Base feeds it one token per frame. |
| `temperature`, `top_p`, `top_k`, `repetition_penalty` | checkpoint | Talker sampling. `talker_<knob>` wins over a plain `<knob>`; `code_predictor_<knob>` sets the residual code predictor. |
| `max_output_tokens` | the checkpoint's default; clones also stop within a text-based budget | Codec frames. |
| `sentence_chunking` | on from 600 characters | Ordered sentence chunks of about 400 characters. |

Deployment settings:

| Knob | Default | Effect |
| - | - | - |
| `model_kwargs.codec_dtype` | `float32` | `bfloat16` runs the codec decoder in bf16 (RMSNorm and RoPE stay float32). `qwen3tts_1p7b.yaml` and the Base configs set it. Measure on B300 before switching. |
| `model_kwargs.codec_chunk_schedule`, `codec_chunk_frames` | `[1, 3, 8, 16]`, 25 | The ramp of first chunks and the steady chunk, in frames. |
| `model_kwargs.depth_kernel` | `false` | Runs the code predictor's loop as one persistent kernel on a Hopper GPU with 128 or more SMs and Triton 3.7 or later, outside MPS; otherwise startup logs the reason and runs the loop. Codes can differ from the loop's at near-ties. |
| `model_kwargs.audio_watermark` | off | `{enabled: true, message: 0xBEEF, alpha: 1.0}` marks the output with AudioSeal. Needs the `audioseal` extra; check files with `python -m mstar.model.audio_watermark detect --message 0xBEEF out.wav` (needs the `audio` extra). |
| `resources.talker_attn.decode_tensor_cores` | `false` | Decode rows use FlashInfer's CUDA-core kernel, since every checkpoint has two query heads per KV head. `true` selects the tensor-core kernel. |
| `resources.codec_state.max_slots` | 257 | Codec streams plus one sink slot. A new stream past it waits for a slot. |
| `resources.talker_kv.max_num_pages` | model default | Talker KV pool in pages of 128 tokens. |

Benchmark the OpenAI route with the shared streaming client, from the root of a checkout with the `eval` extra:

```bash theme={null}
python -m benchmark.tts_speech_bench --engine mstar --url http://127.0.0.1:8000 \
    --model qwen3_tts_1p7b --sentences benchmark/assets/t2s.txt --voice vivian \
    --language English --concurrency 8 --repeats 3 --out results/mstar_c8.json \
    --save-audio-dir results/mstar_c8_wav
```

## Limits

* `instructions` on the 0.6B CustomVoice are refused, since it was not trained with them. VoiceDesign without `instructions` is a 400.
* Base needs exactly one reference clip and `ref_text`, unless `x_vector_only_mode` is set.
* A live `/generate/ws` opening is a 400 in `non_streaming_mode` and for an in-context clone; send those one-shot.
* Every request reserves its prompt plus its length cap at admission. A request for the checkpoint's 8192 frames takes about 66 pages, so `qwen3tts_base.yaml` admits 34 of those at once; the rest wait.
* A clone without `max_output_tokens` stops within a budget set by its text length, so a runaway clone does not decode to the 8192-frame cap. Live text has no budget.
* `speed` is not a Qwen3-TTS control and is logged as ignored.
* The codec does not run on a side stream (`side_stream`); no Qwen3-TTS config sets it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.