Single-page API reference for the local VoxCPM launcher.
中文 API 文档 | README | 中文 README
This server exposes three groups of routes:
- OpenAI-compatible TTS routes
- native VoxCPM routes under
/api/voxcpm/... - TOML voice set / voice profile registry routes
The current FastAPI entrypoint is assembled in app/api/main.py, while request normalization and mode mapping are handled in app/services/synthesis_service.py.
This server is compatible with the baseline vllm-omni VoxCPM2 OpenAI example in these areas:
POST /v1/audio/speech- model aliases
voxcpm2andopenbmb/VoxCPM2 - placeholder
voice: "default" - voice cloning via
ref_audio
Additional compatibility behavior:
ref_audiois accepted as an alias ofreference_audioref_textis accepted as an alias ofprompt_text- audio references may be:
- local file path
file://URIhttp(s)URLdata:audio/...;base64,...
Default local API address:
http://127.0.0.1:8000
For the OpenAI-compatible route, model means voice set. The default mapping is:
model=default->configs/voice-sets/default.tomlvoice=voxcpm2-design->runtime/voices/voxcpm2-design/voice.tomlvoice=voxcpm2-clone->runtime/voices/voxcpm2-clone/voice.tomlvoice=voxcpm2-ultimate-clone->runtime/voices/voxcpm2-ultimate-clone/voice.toml- underlying VoxCPM2 weights ->
configs/model-presets/default.toml
Legacy model ids remain accepted for compatibility:
voxcpm2openbmb/VoxCPM2voxcpm-openai-ttstts-1tts-1-hd- the exact local model id used by the launcher, such as
models/OpenBMB__VoxCPM2
Query available ids:
GET /v1/models
GET /GET /healthGET /api/healthGET /v1/modelsGET /api/voxcpm/modelsGET /api/voxcpm/capabilitiesGET /api/voxcpm/metaGET /api/voxcpm/logsPOST /api/voxcpm/loadPOST /api/voxcpm/unloadPOST /api/voxcpm/reload
GET /v1/audio/voicesGET /v1/audio/speakersGET /speakersPOST /v1/audio/speech
POST /api/voxcpm/ttsPOST /api/voxcpm/tts/upload- aliases:
POST /voxcpm/speechPOST /voxcpm/generatePOST /voxcpm/speech/uploadPOST /api/v1/tts/voxcpmPOST /api/tts/voxcpmPOST /api/tts
GET /api/voxcpm/voicesPOST /api/voxcpm/voicesGET /api/voxcpm/voices/{voice_id}DELETE /api/voxcpm/voices/{voice_id}
Internally, requests are normalized into three execution modes:
design- text only
clone- reference audio or registered voice
ultimate_clone- prompt text plus prompt/reference audio
Accepted external aliases include:
preset_voicereferencereference_with_textcross_lingualinstructionvoice_designtts
After checking the upstream VoxCPM/ submodule, this project does not currently document a public list of text-side special tokens like [Surprise-ah] for client use.
What the upstream repo does document:
- for voice design, put a natural-language voice description in parentheses at the start of
text - for controllable cloning, use a natural-language style hint in parentheses at the start of
text - for ultimate cloning, provide
prompt_texttogether with prompt/reference audio
Examples from the upstream usage pattern:
(A young woman, gentle and sweet voice)Hello, welcome to VoxCPM2!
(slightly faster, cheerful tone)This is a cloned voice with style control.
Important clarification:
- there is no verified upstream public token table in this repo for tags like
[Surprise-ah] - do not rely on undocumented bracket tokens in client requests
- the phrase
ref_audio tokensappears in the upstream implementation, but that refers to internal model structure, not a public text prompt syntax
Recommended client behavior:
- use natural-language control text
- keep style hints short and front-loaded
- prefer explicit fields like
reference_audio,prompt_audio,prompt_text,voice, andvoice_id
curl -X POST http://localhost:8000/v1/audio/speech \
-H "Content-Type: application/json" \
-d "{\"model\": \"default\", \"input\": \"Hello, this is VoxCPM2.\", \"voice\": \"voxcpm2-design\"}" \
--output output.wav{
"model": "default",
"input": "This should sound like the reference speaker.",
"voice": "default",
"ref_audio": "data:audio/wav;base64,...",
"response_format": "wav"
}The OpenAI route also accepts local extension fields:
reference_audioprompt_audioprompt_textmodeinstructionauto_asrcfg_valueinference_timestepsnormalizedenoise
voicedoes not automatically create a persistent speakervoiceonly becomes a reusable registered speaker when it matches an existing voice profile id- a one-off
ref_audioorreference_audiorequest is just a temporary clone request
{
"model": "voxcpm2",
"text": "Text to synthesize",
"mode": "reference_with_text",
"reference_audio": "file:///D:/voices/ref.wav",
"prompt_text": "Reference transcript",
"response_format": "wav"
}POST /api/voxcpm/tts/upload accepts multipart form fields:
textmodevoice_idreference_audioprompt_audioprompt_textresponse_format
Uploaded files are temporary and are cleaned up after the request finishes. They are not automatically stored as reusable voices.
Voice profiles default to TOML:
runtime/voices/<voice_id>/voice.toml
{
"id": "taichi_cn_01",
"display_name": "Taichi CN",
"mode_hint": "reference_with_text",
"audio_path": "file:///D:/voices/taichi/ref.wav",
"prompt_text": "Reference transcript",
"copy_audio_to_registry": true
}curl http://localhost:8000/api/voxcpm/voicescurl -X DELETE http://localhost:8000/api/voxcpm/voices/taichi_cn_01OpenAI-compatible request:
{
"model": "default",
"input": "Read this with the registered voice.",
"voice": "taichi_cn_01"
}Native request:
{
"model": "voxcpm2",
"text": "Read this with the registered voice.",
"voice_id": "taichi_cn_01"
}- temporary uploaded audio is deleted automatically after the request
- registered voices must be deleted with
DELETE /api/voxcpm/voices/{voice_id} - on Windows, physical directory cleanup may be delayed by file locks, but the voice is logically deleted immediately
Current output format support:
wav
The server responds with:
Content-Type: audio/wav- raw audio bytes in the body
X-VoxCPM-Model: resolved local model idX-VoxCPM-Sample-Rate: output sample rateX-VoxCPM-Audio-Seconds: generated audio duration in secondsX-VoxCPM-Output-Bytes: final WAV payload size in bytesX-VoxCPM-Synthesis-Seconds: synthesis wall time in secondsX-VoxCPM-RTF: real-time factor, calculated assynthesis_seconds / audio_secondsX-Neiroha-Backend: backend slug, currentlyvoxcpmX-Neiroha-Model-Preset: active model preset idX-Neiroha-Voice: resolved voice idX-Neiroha-Sample-Rate: output sample rateX-Neiroha-Inference-Ms: synthesis wall time in millisecondsX-Neiroha-Output-Format: output formatX-Neiroha-Output-Path: header-safe path to the copy written underruntime/outputsX-Neiroha-Audio-SecondsX-Neiroha-Elapsed-SecondsX-Neiroha-RTF
Notes:
X-VoxCPM-Synthesis-Secondsmeasures only the synthesis step after the request has been normalized.- upload handling, remote
ref_audiodownload, and response streaming are not included in that metric.
Use the OpenAI route for Neiroha front-end integration and generic OpenAI-style clients.
Use the native routes when you need:
- multipart uploads
- explicit mode control
- voice registry management
- clearer local-only semantics
JSON errors use a stable Neiroha shape:
{
"error": {
"code": "unsupported_format",
"message": "Only response_format='wav' is currently supported by this launcher.",
"details": {},
"type": "invalid_request_error"
}
}