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

# VoxCPM2

> Design a voice, clone a speaker or continue a recording at 48 kHz.

VoxCPM2 generates 48 kHz speech from text. Supply a voice description for voice design, a clip to clone the speaker, or a clip and transcript to continue the recording.

## Install and start

A partial Hugging Face cache can contain the model weights but omit `audiovae.pth`. Download the full checkpoint before launching the server.

### `voxcpm2`

Text, audio → audio. The default `voxcpm2.yaml` uses 1 GPU. The [weights](https://huggingface.co/openbmb/VoxCPM2) use Apache-2.0.

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

[Send the request](#synthesize).

## Send a request

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

### Synthesize a sentence

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='A calm, low voice.',
)
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": "A calm, low voice."}' -o reply.wav
```

## Deployment configs

| File | GPUs | Layout | Use |
| - | - | - | - |
| `voxcpm2.yaml` | 1 | RefEncoder and Talker on one worker; the VAE decoder's windows on the worker's side lane (`side_stream: true`); cap 32 | Default |

## Settings and defaults

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

| Field | Default | Effect |
| - | - | - |
| `instructions` | none | Voice description (`instruct` on `/generate`). |
| `ref_audio`, `ref_text` | none | Clone, or continue, a clip of 0.5 to 60 s. |
| `cfg_value` | 2.0 | Guidance, a number from 0 to 10. |
| `min_len`, `max_new_tokens` | 2, 4096 | Length in 160 ms patches. A budget past `max_len` (4096) is refused. |
| `seed` | unset | Fixes the diffusion noise. |

Deployment `model_kwargs`:

| Knob | Default | Effect |
| - | - | - |
| `compile_talker` | `true` | `false` captures the eager decode step: fast startup, lower throughput. |
| `compile_vae` | `true` | `false` decodes the streaming VAE eagerly. |
| `max_text_tokens` | 1365 | Longest text per request; longer text is a 400. |
| `inference_timesteps` | 10 | Diffusion steps, at least 2. A request may only repeat this value. |

Each language model's KV cache defaults to 2,049 pages, enough for 32 requests at the full 8,192 positions and the sink page. Startup refuses a `max_concurrent_requests` the caches cannot hold, so raise `resources.base_kv.max_num_pages` and `resources.res_kv.max_num_pages` with it.

## Limits

* Nothing preempts a request once a KV cache is full, which is why the shipped cap is 32; the conductor queues the rest.
* One request with long text can stop early, as the official `voxcpm` package does. Split long text into several requests.
* `min_len`, `max_len` and `inference_timesteps` must be integers (a whole float such as `16.0` is accepted); `cfg_value` outside 0 to 10 is a 400.
* VoxCPM2 has no named voices: `voice` is dropped, and `speed` is logged as ignored.


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