> ## 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-Omni

> Request a transcript and a spoken answer from the same chat turn.

Use Qwen3-Omni for a conversation that returns text and optionally a spoken reply. It accepts text, images, audio and video. To have written words read verbatim, choose a [speech synthesis model](https://docs.m-star.org/models.md#speech-generation-and-conversation).

## Install and start

The default uses two GPUs. For two 80 GB GPUs choose `qwen3omni_2gpu_h100.yaml`, which moves both encoders off the Thinker’s GPU. On one 80 GB device use `qwen3omni_colocated.yaml` and budget for its smaller shared context pool.

### `qwen3_omni`

Text, image, audio, video → text, audio. The default `qwen3omni_2gpu.yaml` uses 2 GPUs. The [weights](https://huggingface.co/Qwen/Qwen3-Omni-30B-A3B-Instruct) use Apache-2.0.

```bash theme={null}
uv pip install --torch-backend=auto "mstar-ai[qwen3_omni]"
mstar serve qwen3_omni
```

[Send the request](#spoken-reply).

## Send a request

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

### Ask for a spoken reply

Save a picture as `scene.png`. The SDK prints the transcript and writes a WAV. curl saves the accompanying PCM.

**Python SDK**

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

client = MStarClient("http://localhost:8000")
reply = client.generate(
    text='Describe this picture in one sentence.',
    images='scene.png',
    input_modalities=('image', 'text'),
    output_modalities=('text', 'audio'),
)
reply.audio.to_wav("reply.wav")
print(reply.text)
```

**curl**

```bash theme={null}
curl -fsS http://localhost:8000/generate \
  --form-string 'text=Describe this picture in one sentence.' \
  -F files=@scene.png \
  --form-string input_modalities=image,text \
  --form-string output_modalities=text,audio \
  --form-string streaming=false \
  | 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 | Parallelism | When to use |
| - | - | - | - |
| `configs/qwen3omni_colocated.yaml` | 1 | every node on one GPU | One 80 GB GPU. Its 176-page Thinker pool holds about 22K tokens of prompt and output, shared by all requests. |
| `configs/qwen3omni_2gpu.yaml` | 2 | Thinker and encoders on GPU 1, Talker and Code2Wav on GPU 0 | The default. 1,024 Thinker KV pages (128k tokens) plus 1,024 host pages. |
| `configs/qwen3omni_2gpu_h100.yaml` | 2 | the encoders move to the Talker's GPU | 80 GB GPUs such as the H100. 512 Thinker pages (64k tokens) plus 1,024 host pages. |
| `configs/qwen3omni_2gpu_large_kv.yaml` | 2 | as the default | H200-class GPUs whose concurrent requests hold more than 128k tokens of Thinker KV. 2,048 pages (256k tokens), no host pages. |
| `configs/qwen3omni_pd_2gpu.yaml` | 2 | Thinker prefill on GPU 0 with the other nodes, decode on GPU 1 | Prefill and decode apart, on two GPUs. |
| `configs/qwen3omni.yaml` | 3 | encoders and Code2Wav, Thinker and Talker each on a GPU | One stage per GPU. |
| `configs/qwen3omni_pd_disaggregated.yaml` | 3 | Thinker prefill on GPU 0, decode on GPU 1, Talker on GPU 2 | Prefill and decode apart, with the Talker alone. |
| `configs/qwen3omni_thinker_tp2.yaml` | 3 | Thinker at TP2 | The Thinker over two GPUs. |
| `configs/qwen3omni_thinker_ep2.yaml` | 3 | Thinker at TP2 with expert-parallel MoE | Each rank holds 64 of the 128 experts at full width; attention stays TP. |
| `configs/qwen3omni_full_tp2.yaml` | 4 | Thinker at TP2, Talker at TP2 | Both LLMs over two GPUs each. |
| `configs/qwen3omni_thinker_tp4_sp2.yaml` | 8 | Thinker at TP4 x SP2 | Long prompts, up to the model's 65536 positions. A prefill of at least 16384 tokens splits over each SP pair. |

The others serve 32768 tokens a request.

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 knobs go in `model_kwargs` on `/generate` and in `extra_body` on the OpenAI routes.

| Knob | Default | Effect |
| - | - | - |
| `voice` | `Ethan` | The Talker's speaker, from the checkpoint. An unknown name is refused with the supported list. |
| `temperature`, `top_p`, `top_k`, `min_p`, `repetition_penalty`, `penalize_prompt` | the checkpoint's | Plain keys set the Thinker, except on `/v1/audio/speech`, where `temperature` and `top_p` set the Talker. |
| `thinker_*`, `talker_*`, `code_predictor_*` | the checkpoint's, else built-in | The same knobs for one stage on every route, such as `talker_top_k`. A stage key wins over a plain one. |
| `max_output_tokens` | the checkpoint's | The Thinker's output budget. |
| `talker_max_output_tokens` | the checkpoint's | The Talker's output budget, 4096 on the released checkpoint. |
| `ignore_eos` | `false` | Decode past the Thinker's stop token. |
| `seed` | | Seeds the request's sampling. |

Deployment keys in the YAML:

| Key | Default | Effect |
| - | - | - |
| `model_kwargs.codec_chunk_schedule` | `[12, 13]` | Streamed audio starts after 12 codec frames (0.96 s), then 13, then `codec_chunk_frames` (25) behind `codec_left_context_frames` (25). `[]` starts with a 25-frame chunk: first audio comes later, and the Talker needs less headroom over real time. |
| `resources.thinker_kv.max_num_pages`, `cpu_offload_pages` | per config | Thinker KV pool in 128-token pages, and host pages a full pool moves a request to. |
| `max_concurrent_requests` | unset | A full GPU pool moves a running request to the host pages. Where that can free nothing (no host pages, as in `large_kv`, or full ones), requests wait until they time out, so set the cap to the GPU pages over the pages of the longest request. At the full 32k context: 8 for `large_kv`, 4 for the default, 2 for the H100 config. |
| `prefill_token_buckets` | `{Thinker: {prefill_text: [128 ... 2048]}}` | The Thinker's captured text and audio prefill ladder; a longer step runs eagerly. See [Config reference](https://docs.m-star.org/reference/config.md). |
| `resources.vision_attn.flashinfer_backend`, `resources.audio_attn.flashinfer_backend` | unset | The encoders' FlashInfer kernel, such as `cutlass`. Unset, the GPU's kernel table or FlashInfer's own `auto` picks. |

## Limits

* `/v1/audio/speech` returns the audio of the model's spoken reply to `input`, not `input` read aloud. Use a TTS model to read text.
* The Talker batches at most 32 requests. Past that, requests queue, and a request's playback can pause when the Talker falls below real time.
* An encoder step past its largest captured bucket (8192 vision patches, about one 1920x1080 image, or 4096 audio tokens) runs eagerly.
* A clip under 1 s is zero-padded to a full chunk before the encoder's convolutions, so its embeddings differ from Hugging Face's for a clip encoded alone.
* The Thinker's fused q/k norm and RoPE run in fp32 and round once, so outputs are close to Hugging Face's but not bit-exact.
* The chat route refuses tool calls, `n` above 1, stop sequences and OpenAI `logprobs`.


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