# audio.cpp Server `audiocpp_server` exposes audio.cpp models through HTTP and an optional WebUI. The default runtime reuses each loaded model and its configured task session across requests. You can register several models in one config; this does not require the experimental parallel runtime. ## Contents - [Quick start: full WebUI](#full-webui-no-config-file) - [Quick start: first API request](#configured-api-first-request) - [Build and choose a server mode](#build) - [Configure models](#config) - [Map CLI options to server config](#cli-options-to-server-configuration) - [Control model loading and memory](#loading-and-memory) - [Configure offline and streaming sessions](#offline-and-streaming-sessions) - [Start and inspect the server](#start) - [Voice presets and reference recordings](#voices) - [API endpoints](#endpoints) - [Troubleshooting](#troubleshooting) - [Optional frontend modules and listeners](#optional-frontend-modules-and-listeners) - [Experimental features](#experimental-features) ## Quick start Choose **one** path below. Use an existing server binary, or [build one](#build). Commands use `build/debug/bin/audiocpp_server` from a source checkout. For a downloaded release, substitute its executable path, such as `./audiocpp_server` on Linux/macOS or `.\audiocpp_server.exe` in PowerShell. Run source-checkout commands from the repository root. ### Full WebUI (no config file) To download models and run them in your browser: ```bash build/debug/bin/audiocpp_server --ui --ui-management --backend cuda --log --log-file server.log ``` Open `http://127.0.0.1:8080`, install a model package from the model library, then select it in the matching studio tab. Replace `cuda` with a backend your binary and selected model support, such as `cpu`, `vulkan`, or `metal`. Use **Lib → Speakers → New speaker preset** to save a model, voice, and generation settings together, then select that speaker in **Apps → Text to speech**. **Lib → Voices** manages reference recordings and their transcripts. These libraries are stored in this browser, not in the server config. Existing projects keep their own speaker settings when a library preset is edited or deleted. The **Apps** tab, after Studio, is an early release. Workflows and saved project formats may change; export audio you want to keep. It contains a project-based **Text to speech** app: - Import TXT/Markdown and preview text splitting before applying it. - In **Speakers**, create or reuse named speakers and assign them to passages. Set a project default or apply a speaker to all passages. Search and filter passages; the browser remembers the last selected passage for each project. - Edit each chosen take with **Edit audio**: zoom/pan its waveform, place a playhead, insert silence, drag-select and delete existing gaps or audio ranges, remove inserted regions, and undo/redo. Edits stay with that take and persist with the project; original recordings are retained. Boundary previews and exports use the edited audio. - Generate chunks individually or in a batch, compare takes, and choose the audio to keep. Optional reference transcription uses a separately selected ASR model. - In **Arrange**, inspect joins with actual waveforms and boundary playback. Adjust pauses with + / − or enter an exact duration; choose **Use default** to reset a join. Custom pauses are saved with the project. - Combine the selected takes, then use **Export** for optional model enhancement, gain or peak normalization, and WAV PCM16 or WebM Opus download. Projects, references and generated takes persist in this browser. Regeneration preserves chosen takes; splitting/merging archives the original chunks. Changing text/settings marks affected audio out of date instead of silently reusing it. An app applies the saved load/session options when UI management owns the model. For a server-configured model, its configuration must already match the saved settings; apps do not rewrite the server config. App modules are maintained independently; see the [app contribution guide](../../webui/native/src/lib/apps/README.md). This requires a binary built with `AUDIOCPP_BUILD_NATIVE_MODEL_MANAGER=ON`. If the server reports that UI management is unavailable, use the configured API path below or [rebuild with that option](#choose-a-server-mode). The plain `--ui` flag does not enable downloads or register models by itself. ### Configured API (first request) **1. Get a model.** Download the complete [Kokoro package and its dependencies](../../docs/models/kokoro_tts.md). This example uses its built-in `af_heart` voice: no reference WAV or `voice_dir` is needed. It uses CPU inference and works with a CPU-only server build. **2. Create the config.** Save this as `server.json`, replacing the GGUF path with your actual file. A config does not download model weights. ```json { "host": "127.0.0.1", "port": 8080, "backend": "cpu", "lazy_load": true, "max_loaded_models": 1, "models": [ { "id": "kokoro", "family": "kokoro_tts", "path": "/absolute/path/Kokoro-82M-GGUF/kokoro-82m-q8_0.gguf", "task": "tts", "mode": "offline", "default_voice_preset": { "voice_id": "af_heart" } } ] } ``` **3. Start the server.** Keep this terminal open: ```bash build/debug/bin/audiocpp_server --config server.json --log --log-file server.log ``` **4. Send a request.** In another terminal: ```bash curl --fail-with-body http://127.0.0.1:8080/health curl --fail-with-body http://127.0.0.1:8080/v1/models curl --fail-with-body http://127.0.0.1:8080/v1/audio/speech \ -H 'Content-Type: application/json' \ -d '{"model":"kokoro","input":"Welcome. This speech is generated locally with audio.cpp."}' \ -o speech.wav ``` Open `http://127.0.0.1:8080` for the configured-model WebUI. `/health` confirms the server is running, not that a lazy model has loaded. The first generation loads the model and is slower than later requests. Check curl's exit status and `server.log` before playing the output; an unsuccessful request may save an error body instead of a WAV. The commands use a POSIX shell. On Windows, use `curl.exe` and put JSON in a request file, for example `--data-binary @request.json`. Use forward slashes or escaped backslashes in JSON paths, such as `C:/models/model.gguf`. For other models, start with the [ready-to-edit configs and complete requests](../../examples/server/README.md). The request's `"model": "kokoro"` matches the config's `id`, not its `family: "kokoro_tts"` or GGUF filename. To use the GPU later, restart with `--backend cuda` (or another supported backend); the config otherwise stays the same. ## Build ```bash cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug -DENGINE_ENABLE_CUDA=ON cmake --build build/debug --parallel 8 --target audiocpp_server ``` Enable the backend you plan to run: `ENGINE_ENABLE_CUDA=ON`, `ENGINE_ENABLE_VULKAN=ON`, `ENGINE_ENABLE_HIP=ON`, or `ENGINE_ENABLE_METAL=ON`. CPU support is included by default. Build flags decide which backends exist; `--backend` selects one when starting the server. See the [Linux](../../docs/build/linux.md), [Windows](../../docs/build/windows.md), and [HIP](../../docs/build/HIP.md) build guides for dependencies. Commands here use `build/debug/bin/`. For a downloaded release, substitute the path to its `audiocpp_server` executable; it does not need rebuilding. ### Choose a server mode Pick the mode that matches the behavior you want: | If you want... | Build with... | Run with... | Behavior | |---|---|---|---| | API/config-driven server, no UI | default build | `audiocpp_server --config server.json --no-ui` | Uses models declared in the config; does not serve the UI. | | UI for configured models | default build | `audiocpp_server --config server.json --ui` | Browser UI can run configured models, without downloads, deletes, or dynamic package management. | | Full UI with downloads and model switching | `-DAUDIOCPP_BUILD_NATIVE_MODEL_MANAGER=ON` | `audiocpp_server --ui --ui-management --backend ` | UI can browse packages, download models, load/unload models, delete packages, and use temporary uploads. Models from a `--config` stay available as configured ([details](#configured-models-with-ui-management)). | | Standalone deployed binary without local `model_specs/` | `-DAUDIOCPP_DEPLOYMENT_BUILD=ON` | `audiocpp_server --config server.json` | Binary carries compiled package specs for fallback model-spec lookup. | Native model management uses bundled BoringSSL by default. Normal server builds do not build or link that HTTP/TLS dependency. These build choices can be combined: deployment mode supplies specs, while native management supplies the download/install functionality. Neither enables experimental parallel execution. Optional frontend modules are described [later](#optional-frontend-modules-and-listeners). For native-manager builds, these TLS alternatives do not change the API: | Need | Additional CMake setting | |---|---| | Use a local BoringSSL archive instead of downloading it during configure | `-DAUDIOCPP_BORINGSSL_ARCHIVE=/path/to/boringssl.tar.gz` | | Use system OpenSSL instead of bundled BoringSSL | `-DAUDIOCPP_USE_SYSTEM_OPENSSL=ON` | Both require `-DAUDIOCPP_BUILD_NATIVE_MODEL_MANAGER=ON`. They do not enable an HTTPS listener; that is a separate frontend extension. ## Config For ready-to-edit configs with explained paths, voice-library setup, and complete requests, see [server examples](../../examples/server/README.md). They cover Qwen3-TTS, BreezeTTS, Kokoro, PocketTTS, YuE2, MiniMax Music3, and Parakeet ASR. The following example registers TTS and ASR in one process. Replace both paths; keep PocketTTS's downloaded `embeddings/` directory beside its GGUF. Use only entries for packages you installed. The defaults for optional server settings are listed in [loading and memory](#loading-and-memory), [logging](#logging-and-request-limits), and [busy timeouts](#busy-requests-and-timeouts). ```bash cat > server.json <<'JSON' { "host": "127.0.0.1", "port": 8080, "backend": "cuda", "device": 0, "threads": 4, "lazy_load": true, "max_loaded_models": 1, "log_request_body": false, "max_request_body_bytes": 2147483648, "models": [ { "id": "pocket-tts", "family": "pocket_tts", "path": "/absolute/path/PocketTTS-GGUF/english/pocket-tts-english-q8_0.gguf", "task": "tts", "mode": "offline", "load_options": { "language": "english" }, "default_voice_preset": { "voice_id": "alba" }, "voice_presets": { "cosette": { "voice_id": "cosette" } } }, { "id": "qwen3-asr", "family": "qwen3_asr", "path": "/absolute/path/Qwen3-ASR-0.6B-GGUF/qwen3-asr-0.6b-f16.gguf", "task": "asr", "mode": "offline" } ] } JSON ``` ### Model entries | Field | Meaning | |---|---| | `id` | Your server-side name. Send this exact string as the request's `model`, not the family or GGUF filename. | | `family` | The implementation to load, such as `pocket_tts` or `qwen3_asr`. Use the model's documented family. | | `path` | An existing GGUF file or the complete package directory required by that family. Multi-component models may need additional package files. | | `task` | The model's documented route, such as `tts`, `clon`, `vdes`, `asr`, or `align`. Capabilities such as voice cloning do not imply an identically named route. | | `mode` | `offline` or `streaming`, supported by that model. It selects the session created by the server. | | `device` | Optional backend device index for this model. When omitted, the top-level `device` is used. | | `load_options` | Options consumed while loading weights/assets. | | `session_options` | Options consumed when creating the reusable session. | | `default_request_options` | Defaults for the model's inference requests; request values with the same key override them. | Always set `family`, `task`, and `mode` explicitly rather than relying on inferred names or defaults. Several entries can use the same family with different GGUFs, tasks, or modes, provided each entry has a unique `id`. For instruction-conditioned models, per-model `"instruct": "..."` is a shortcut for `"default_request_options": {"instruct": "..."}`. Use one form or the other; setting the shortcut together with `instruct` or `instruction` in `default_request_options` is rejected as ambiguous. ### Per-model devices Servers with more than one accelerator can keep different models resident on different devices. Set the top-level `device` as the default and override it on individual model entries: ```json { "backend": "cuda", "device": 0, "max_loaded_models": 0, "models": [ {"id":"speech","family":"kokoro_tts","path":"models/kokoro.gguf","device":0}, {"id":"music","family":"stable_audio","path":"models/stable-audio","device":1} ] } ``` The indices use audio.cpp's backend device order; run the server with `--list-devices` to inspect it, or `--list-devices --json` for PCI ids and free/total memory in [JSON](../../docs/usage.md#listing-devices). Each model remains wholly on one device: this setting assigns models independently and does not split one model across GPUs. `GET /v1/models` reports the effective `device` for every entry. Dynamic loads may also send `device`; when a registered model is reloaded and the field is omitted, its existing assignment is retained. Set `max_loaded_models` high enough for the number of models that should remain resident, or use `0` for no global residency limit. ### Default session options Top-level `"default_session_options"` sets session options for every model of a family, keyed `.