Skip to content

API

This is the supported integrator contract for AbstractVoice.

Start with README.md and docs/getting-started.md for setup. Use docs/faq.md for cache/history reset and troubleshooting, docs/repl_guide.md for the interactive REPL, and docs/architecture.md for implementation details.

Implementation map: - abstractvoice/voice_manager.py → abstractvoice/vm/manager.py (constructor + wiring) - abstractvoice/vm/tts_mixin.py (TTS + cloning methods) - abstractvoice/vm/stt_mixin.py (STT + listening methods) - abstractvoice/vm/core.py (voice-mode behavior during playback)

Primary entry point

  • abstractvoice.VoiceManager
  • abstractvoice.VoiceProfile (data type; used by the voice-profile APIs)
from abstractvoice import VoiceManager

vm = VoiceManager(language="en", remote_api_key="sk-...", allow_downloads=True)

Constructor (most-used knobs)

The source of truth is abstractvoice/vm/manager.py:

VoiceManager(
    language: str = "en",
    tts_model: str | None = None,
    whisper_model: str = "base",
    debug_mode: bool = False,
    tts_engine: str = "openai",
    stt_engine: str = "openai",
    allow_downloads: bool = True,
    cloned_tts_streaming: bool = True,
    cloning_engine: str = "omnivoice",
    tts_delivery_mode: str | None = None,  # buffered|streamed (override)
    stt_model: str | None = None,
    remote_base_url: str | None = None,
    remote_api_key: str | None = None,
    remote_timeout_s: float | None = None,
    cloning_model: str | None = None,  # Qwen3-TTS Base checkpoint for new clones
)

Notes: - VoiceManager() and library auto are remote-first. Hosted OpenAI audio requires OPENAI_API_KEY or remote_api_key=.... - The CLI and web examples deliberately wrap this with an interactive TTS resolver: installed Supertonic, installed Piper, then OpenAI remote. Plain abstractvoice starts on OpenAI; abstractvoice[all-apple] and abstractvoice[all-gpu] start on Supertonic. That behavior lives in abstractvoice/examples/tts_defaults.py and does not change the library constructor. - allow_downloads gates implicit local model downloads in adapters. The REPL sets False (offline-first). - whisper_model controls the faster-whisper model size used by local listen() / transcribe_*() paths. - tts_engine selects the TTS provider and supports: - openai (default; remote OpenAI /v1/audio/speech; requires OPENAI_API_KEY) - auto (deterministic default: resolves to openai) - piper (local TTS; requires abstractvoice[piper], abstractvoice[apple], or abstractvoice[gpu]) - supertonic (local fixed-profile ONNX TTS; requires abstractvoice[supertonic], abstractvoice[apple], or abstractvoice[gpu]) - openai-compatible (remote compatible /v1/audio/speech; configure remote_base_url or OPENAI_BASE_URL) - audiodit (LongCat-AudioDiT; requires abstractvoice[audiodit]; upstream focuses on EN/ZH; direct/base TTS has a known quality caveat in 0.8.1) - omnivoice (OmniVoice; requires abstractvoice[omnivoice]; upstream supports 600+ languages) - none (speech-to-text only: no TTS adapter is built, so the manager needs no TTS runtime or credentials) - qwen3-tts (Qwen3-TTS 12Hz; requires abstractvoice[qwen3-tts], Python 3.10+; tts_model selects the checkpoint — the default Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice exposes 9 preset speakers as profiles, the 1.7B VoiceDesign checkpoint builds voices from the instructions selector and refuses an empty description; Base checkpoints are cloning-only and are not offered as TTS models) - stt_engine selects the STT provider and supports openai|auto|faster_whisper|mlx-whisper|openai-compatible|transformers-asr. auto resolves to openai. - faster_whisper requires abstractvoice[stt], abstractvoice[apple], or abstractvoice[gpu], and uses whisper_model/--whisper for tiny|base|small|medium|large-v2|large-v3|large-v3-turbo|large|turbo. It runs on CUDA when CTranslate2 can (see resolve_faster_whisper_device below), otherwise on the CPU. - mlx-whisper (Apple Silicon) requires abstractvoice[apple] or abstractvoice[stt-mlx], takes the same model ids (stt_model, else whisper_model), and runs them on the Apple GPU from the mlx-community Hugging Face repos (MLXWhisperAdapter.MODEL_REPOS). - transformers-asr requires abstractvoice[stt-hf], abstractvoice[apple], or abstractvoice[gpu], and uses stt_model as the Hugging Face model id (for example openai/whisper-large-v3, openai/whisper-large-v3-turbo, or Qwen/Qwen3-ASR-1.7B). Missing credentials or missing explicit local dependencies raise actionable errors; the legacy OpenAI Whisper fallback was removed. - tts_model is reserved/back-compat for local Piper (selection is language-driven today); for remote TTS it maps to the request model. - For remote STT, stt_model maps to the transcription request model. - For stt_engine="transformers-asr", stt_model is the Hugging Face model id to load. - Remote configuration can be passed in the constructor or via env vars: - OpenAI: OPENAI_API_KEY, optional ABSTRACTVOICE_OPENAI_TTS_MODEL, ABSTRACTVOICE_OPENAI_STT_MODEL - Compatible endpoints: OPENAI_BASE_URL, optional OPENAI_API_KEY, ABSTRACTVOICE_REMOTE_TTS_MODEL, ABSTRACTVOICE_REMOTE_STT_MODEL - OpenAI-compatible profile discovery: GET /audio/voices is tried by default for compatible endpoints; override with ABSTRACTVOICE_REMOTE_VOICE_PROFILE_PATH or ABSTRACTVOICE_REMOTE_VOICE_PROFILE_PATHS. Static voice/profile ids can also be supplied with ABSTRACTVOICE_REMOTE_TTS_VOICES. - tts_delivery_mode is an optional override that applies consistently to both base TTS and cloned voices: - buffered: synthesize full audio first (one payload) - streamed: deliver audio in chunks when available (lower time-to-first-audio) - cloning_engine defaults to omnivoice for new local clones. Install abstractvoice[omnivoice] or a platform/full profile for that default, or pass f5_tts, chroma, audiodit, qwen3-tts, openai, or openai-compatible explicitly. Qwen3-TTS cloning uses the Base checkpoints and the stored reference transcript (auto-filled once via STT when missing). cloning_model selects the default Qwen Base checkpoint; model=... on clone_voice(...) / clone_voice_from_wav_bytes(...) overrides it per clone. The checkpoint is persisted in the voice metadata and restored on replay. Existing Qwen clones without checkpoint metadata use the original 0.6B Base.

Supported language codes for the Piper mapping: en, fr, de, es, ru, zh (see abstractvoice/config/voice_catalog.py and abstractvoice/adapters/tts_piper.py). Supertonic supports fixed-style local TTS for ar, bg, cs, da, de, el, en, es, et, fi, fr, hi, hr, hu, id, it, ja, ko, lt, lv, nl, pl, pt, ro, ru, sk, sl, sv, tr, uk, vi. For other non-Piper providers (e.g. OmniVoice or remote OpenAI-compatible providers), language is treated as a pass-through hint and the provider decides what it supports.

TTS (text → audio)

CLI one-shot TTS uses the same VoiceManager synthesis path and exits without starting the REPL:

abstractvoice --provider openai --model tts-1 --voice alloy --prompt "Hello" --output hello.wav

Use --provider openai-compatible --api <base-url> for compatible remote audio servers, or --tts-engine <local-provider> for installed local engines.

  • speak(text: str, speed: float = 1.0, callback=None, voice: str | None = None, *, sanitize_syntax: bool = True) -> bool
  • Plays audio locally (non-blocking playback; synthesis time depends on backend).
  • If voice is provided, it is treated as a cloned voice_id (requires a cloning backend extra such as abstractvoice[omnivoice]; abstractvoice[cloning] is the explicit OpenF5 backend).
  • By default, Markdown is spoken as its words (abstractvoice.text_sanitize): fenced code blocks are not read, inline code is read without its backticks, headings and list items are sentences, list/quote/table markers are dropped, links read as their text, arrows are a pause. One line of plain text is spoken as written. Set sanitize_syntax=False to speak raw text.

  • set_speed(speed: float) -> bool, get_speed() -> float

  • Adjusts the default speaking speed used by speak_to_*() and the REPL (0.5 to 2.0). It is kept when some path can apply it (the TTS engine on playback or on speak_to_bytes, or the cloning engine for cloned speech) and returns False otherwise.
  • Supertonic and OmniVoice apply speed natively; Piper, Qwen3-TTS (preset speakers and clones) and Chroma apply a pitch-preserving time-stretch after generation (librosa when installed, else WSOLA). Qwen3-TTS live playback does not apply it. get_capability_support(kind=..., feature="speed", provider=..., surface=...) reports native, emulated or unsupported per path.

  • set_tts_quality_preset(preset: str) -> bool, get_tts_quality_preset() -> str | None

  • Provider-agnostic speed/quality knob (low|standard|high). Back-compat aliases: fast→low, balanced→standard.
  • Providers that don’t support quality tuning may return False / None (Piper is typically a no-op).
  • For AudioDiT this primarily maps to diffusion steps (and a small guidance-strength tweak).
  • For Supertonic this maps to ONNX vector-estimator steps: low 5, standard 8, high 12.

  • get_profiles(*, kind: str = "tts") -> list[VoiceProfile]

  • set_profile(profile_id: str, *, kind: str = "tts") -> bool
  • get_active_profile(*, kind: str = "tts") -> VoiceProfile | None
  • set_tts_engine(engine: str, *, tts_model: str | None = None) -> str
  • Cross-provider voice profile abstraction (preset packs).
  • Profiles are provider-local: select tts_engine (provider) first, then apply a profile id for that provider.
  • Runtime provider switching should use set_tts_engine(...); it rebuilds the base TTS adapter, rewires playback callbacks, and resets the active profile to the provider/language default (for example Piper en -> amy, Supertonic -> M1, OpenAI -> alloy).
  • Providers without profiles return an empty list / False / None.
  • Concurrency note: profile selection mutates provider state. For servers, prefer one VoiceManager per session (or guard profile changes with a lock).
  • Remote OpenAI note: hosted built-in voices are always exposed as profiles (for example vm.set_profile("alloy")), and the adapter also tries OpenAI voice discovery for account/org-specific voices such as voice_.... tts_engine="openai" defaults to https://api.openai.com/v1 and reads OPENAI_API_KEY.
  • Remote compatible note: compatible endpoints may expose GET /v1/audio/voices (adapter path: GET /audio/voices) returning profiles, voices, cloned_voices, or OpenAI-style data. Returned ids are exposed as VoiceProfiles and used as the request voice for /audio/speech.
  • The voice= argument on speak_to_bytes(...) remains the cloned-voice handle path for backward compatibility; select base-provider voices with set_profile(...).
  • Supertonic note: tts_engine="supertonic" exposes fixed local profiles M1-M5 and F1-F5. Listing or selecting profiles does not download the model; synthesis requires cached artifacts or allow_downloads=True. Supertonic requests ONNX Runtime's CUDA provider first and the CPU provider second when a usable CUDA device exists (torch.cuda.is_available(), or the CUDA runtime's device count without torch; a CUDA build with no device runs on the CPU and says so, and nothing is ever printed to standard output): on an NVIDIA host with abstractvoice[onnx-cuda] installed after the profile (see Installation) it runs on the card (Quadro RTX 5000: 8 s of speech in 0.85 s, 0.09 s warm), otherwise on the CPU with 4 intra-op threads (fewer on smaller machines), which keeps a busy host responsive; on Apple Silicon the CoreML provider measured slower than the CPU for this model. The CUDA libraries pip installed are preloaded before a session opens. SupertonicRuntime(providers=[...], intra_op_num_threads=...) chooses otherwise, and the adapter's execution_device() (also in get_info()) reports device, reason (including the repair when the CPU build of ONNX Runtime replaced the CUDA one), execution_providers the sessions actually run on, and threads. Piper does the same: CUDA when the provider exists, get_info()["execution_providers"] from its session.
  • OmniVoice notes:

    • Some profiles may enable persistent prompt caching (a tokenized voice_clone_prompt). The first set_profile(...) can pay a one-time build cost; later synthesis reuses cached tokens for stable voice identity. Prompt-conditioned synthesis can be heavier than pure voice design; use /tts quality low|standard|high (or VoiceManager.set_tts_quality_preset(...)) to tune the trade-off.
    • On macOS / Apple Silicon, OmniVoice uses MPS (Metal) by default when device="auto".
  • pause_speaking() -> bool, resume_speaking() -> bool, stop_speaking() -> bool

  • Playback control.

  • is_speaking() -> bool, is_paused() -> bool

  • Playback state helpers.

  • set_tts_delivery_mode(mode: str | None) -> bool, get_tts_delivery_mode() -> str, get_tts_delivery_modes() -> dict

  • Toggle buffered vs streamed delivery (applies to both base TTS and cloned voices).
  • Behavior note: streamed delivery is implemented as a pipeline:

    • text is split into whole sentences: the first segment is the first sentence (merged with the next one when shorter than 30 characters), so the first audio arrives quickly; later segments group whole sentences, each sized to be synthesized before the previous one has played, up to 240 characters (or the engine's own limit when smaller); only a single sentence longer than that is cut, at a clause pause,
    • engines that take a language per call (Supertonic) speak the whole reply in one language: the caller's language, else the reply's language identified once on the whole text (kept at 80% confidence or more), else the configured language,
    • the silence an engine leaves around each streamed segment is trimmed to 0.05 s before and 0.25 s after, so segments play back to back with a short natural pause,
    • then each segment is synthesized and enqueued as soon as possible, so later segments are synthesized while the first one plays.
    • Engines that can stream audio natively may further reduce TTFB by yielding multiple audio chunks per segment.
  • speak_to_bytes(text: str, format: str = "wav", voice: str | None = None, *, instructions: str | None = None, sanitize_syntax: bool = True, one_shot: bool = False) -> bytes

  • one_shot=True synthesizes the whole text as one generation: no sentence segmentation, no truncation, so one voice from the first word to the last. Use it for voice references, designed voices and any take that must sound like one person throughout. Available for qwen3-tts (preset speakers, VoiceDesign and Qwen clones) up to 1000 characters; a longer text, or another engine, raises ValueError instead of being cut. The default (one_shot=False) splits long text at sentence boundaries (200 characters per generation on the PyTorch backend, 800 on MLX), and each generation samples the voice afresh.
  • Qwen3-TTS clones: every generation is checked against the clone before it is delivered (the 0.6B Base checkpoint occasionally samples a whole generation in a stock-sounding voice), so a reply stays in the cloned voice: an opening under the clone bar is regenerated once and, if the second take still scores a little under it, that take is spoken anyway (a small difference beats another voice or an unspoken reply); nothing stops a reply after its opening. The reply's opening is held back (released at 2 s when clearly the clone, else decided at 4 s; first audio waits for it). After that, delivery is continuous: each chunk is released once the 4 s window starting at it scores as the clone (a delay line at the generation's cadence), and the next segment's opening is checked while the previous one plays. A generation that opens in another voice is run again once; a second miss is spoken anyway (segment status kept_below_threshold), and a later 4 s window that scores under the block bar (0.93, or a kept take's own bar) is recorded in the segment's low_windows (time, score, limit) while playback continues. ClonedVoiceNotAppliedError (abstractvoice.cloning.engine_qwen3_tts) stays importable for callers that catch it; the Qwen3 clone engine no longer raises it. When synthesis is slower than playback and the listener has less than 1.5 s of audio in hand, a chunk is released before its score (provisional_s in the segment record) and still scored for the record. The check is a setting, never an environment variable: VoiceManager(qwen3_tts_speaker_check=False) disables it and VoiceManager(qwen3_tts_min_speaker_similarity=0.9) retunes the opening bar (default 0.95, must be in (0, 1]); the AbstractCore plugin settings are voice_qwen3_tts_speaker_check and voice_qwen3_tts_min_speaker_similarity; VoiceCloner(qwen3_tts_speaker_check=, qwen3_tts_min_speaker_similarity=) and Qwen3TTSVoiceCloningEngine(speaker_check=, min_speaker_similarity=) take the same. A generation that misses its end of speech is ended where it went quiet: once 90 % of its last 4 s are quiet (-40 dBFS frames) it stops as its EOS would have and the reply goes on with its next segment, instead of running to its length cap; the segment record reports ended (eos | quiet_runaway | cap) and quiet_from_s. Each text segment leaves a record (model, backend, reference, attempts, speaker scores, audio seconds, status, ended) in the streamed-speech metrics as segments; cloned-voice records carry reference_seconds (length of the reference recording; tags.reference_seconds in plugin listings).
  • Headless/server‑friendly: returns encoded audio bytes.

  • speak_to_audio_chunks(text: str, *, voice: str | None = None, instructions: str | None = None, sanitize_syntax: bool = True, language: str | None = None) -> Iterator[tuple[np.ndarray, int]]

  • language: the language of the whole reply for engines that take a language per call (Supertonic); when omitted, the reply's own language is identified once on the whole text.
  • Headless/server‑friendly: yields (audio_chunk, sample_rate) tuples for incremental delivery.
  • Qwen3-TTS 1.7B CustomVoice and VoiceDesign accept per-call instructions without changing session state. Unsupported models and cloned speech reject streaming instructions explicitly.

  • speak_to_audio_segments(text: str, *, voice: str | None = None, instructions: str | None = None, sanitize_syntax: bool = True, language: str | None = None) -> Iterator (since 0.20.0)

  • The same synthesis as speak_to_audio_chunks, with each text segment marked (ADR 0009): it yields SegmentStart, that segment's (audio_chunk, sample_rate) tuples, then SegmentEnd, segment after segment (abstractvoice.tts.segments; audio_only(...) drops the markers).
  • SegmentStart carries index (from 0), text (what the engine speaks) and text_start / text_end: the segment's span [start, end) of text as you passed it, in code points (Python str indexes, Swift unicodeScalars, JavaScript Array.from(text)). What the sanitizer removes or inserts (Markdown syntax, code blocks, a sentence's full stop) and collapsed whitespace are mapped back, so text[text_end:] is exactly the text not yet spoken.
  • A segment is one independent synthesis: a base engine's sentence group, one Qwen3-TTS clone generation (a take regenerated by the speaker check is still that segment, and only the accepted take is delivered). A native-streaming engine and clone engines other than Qwen3-TTS speak the whole text as segment 0.
  • A segment cancelled part-way has no SegmentEnd.

  • open_tts_text_stream(*, voice: str | None = None, callback=None, sanitize_syntax: bool = True, max_chars: int | None = None, min_chars: int | None = None) -> TextToSpeechStream

  • Push-based streaming bridge for LLM streaming → TTS streaming pipelining.
  • Returned object supports: .push(delta), .close(), .cancel(), .join(timeout=...).

  • speak_to_file(text: str, output_path: str, format: str | None = None, voice: str | None = None, *, instructions: str | None = None, sanitize_syntax: bool = True, one_shot: bool = False) -> str

  • one_shot as for speak_to_bytes. CLI: abstractvoice --prompt "..." --output out.wav --one-shot.
  • Writes an audio file and returns the path.

Qwen3-TTS checkpoints

Install abstractvoice[qwen3-tts] (Python 3.10+) and explicitly download each checkpoint you intend to use. Discovery lists cached checkpoints without loading their weights. Selecting the engine loads the chosen checkpoint from the local cache right away, like every other local engine, so the first synthesis does not pay the load (on MLX this includes the priming generation); a checkpoint that is not cached yet is downloaded by abstractvoice-prefetch or by the first synthesis when downloads are allowed. On Apple silicon the checkpoints run on the Apple GPU through MLX; elsewhere they run on PyTorch and Transformers 5.9 or newer (the extra's floor): with an older Transformers, loading refuses with a plain error before any download or weight load. See Qwen backends.

Checkpoint suffix Sizes Selection
CustomVoice 0.6B, 1.7B tts_model=..., preset via set_profile("aiden"); 1.7B also accepts instructions
VoiceDesign 1.7B tts_model=..., required natural-language instructions
Base 0.6B, 1.7B cloning_engine="qwen3-tts", cloning_model=... or per-clone model=...

Full ids follow Qwen/Qwen3-TTS-12Hz-<size>-<suffix>. TTS defaults to Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice, cloning to the corresponding Base. Supported language codes are en, zh, ja, ko, de, fr, ru, pt, es, and it. Long input is split into bounded segments in both buffered and streamed delivery, including text without spaces. On the MLX backend a reply up to 800 characters is one generation streamed as codec frames; on the PyTorch backend streamed output is sentence-segmented (one generation per segment).

python -m abstractvoice download --qwen3-tts Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign
abstractvoice --tts-engine qwen3-tts --tts-model Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign \
  --instructions "A warm, clear narrator." --prompt "Hello from Qwen." --output hello.wav
abstractvoice web --tts-engine qwen3-tts --cloning-engine qwen3-tts \
  --cloning-model Qwen/Qwen3-TTS-12Hz-1.7B-Base

The web example exposes the TTS model, speech instructions, and Qwen cloning model beside their provider selectors. The REPL supports /tts engine qwen3-tts, /tts_download qwen3-tts <model-id> and /cloning_download qwen3-tts <Base-model-id>; use startup --tts-model and --cloning-model to select checkpoints. Switching providers resets the model to the target provider's default; switching within a provider retains its configured model unless an override is supplied.

Through AbstractCore, use core.voice.tts(...), core.voice.tts_stream(...) or core.voice.clone(...) with provider="qwen3-tts" and model=<checkpoint>. core.voice.voice_catalog(provider="qwen3-tts", model=<checkpoint>) filters profiles and stored clones by checkpoint. Plugin defaults can be configured with the voice_cloning_model setting, separately from voice_tts_model, and the codebook predictor/sampler with voice_qwen3_tts_predictor / voice_qwen3_tts_sampler (see below).

Qwen backends: MLX on Apple silicon, PyTorch elsewhere

Qwen3-TTS has two compute backends behind the same runtime, adapter, cloning engine and settings (ADR 0008). The policy is small and explicit:

Situation Backend
macOS on Apple silicon with mlx importable (the qwen3-tts, apple, all-apple, gpu and all-gpu extras install it there) mlx
anything else (CUDA, CPU, Intel Mac, mlx not installed) torch (the shared ADR 0005 device/dtype policy)
VoiceManager(qwen3_tts_backend="torch" \| "mlx"), the AbstractCore plugin setting voice_qwen3_tts_backend, ABSTRACTVOICE_QWEN3_TTS_BACKEND=torch\|mlx, or Qwen3TTSSettings(backend=...) / Qwen3TTSRuntime(backend=...) that backend (an explicit setting wins over the environment variable; auto defers to the policy); asking for mlx where it cannot run is a plain error, not a fallback, and is_available() is False with that sentence as get_unavailable_reason()

runtime_info()["backend"] (also under get_info()["runtime"] and the stream metrics' device, metal for MLX) says which backend is active. Both backends load the ORIGINAL Qwen bf16 safetensors from the same Hugging Face snapshot; nothing else is downloaded.

The MLX backend:

  • quantizes the talker to 8-bit when it loads (the codec and speaker encoder stay float32). VoiceManager(qwen3_tts_mlx_quantization="bf16" | "8bit" | "4bit"), the AbstractCore plugin setting voice_qwen3_tts_mlx_quantization, Qwen3TTSSettings(mlx_quantization=...) or ABSTRACTVOICE_QWEN3_TTS_MLX_QUANTIZATION choose otherwise; the environment variable is read only when the MLX backend loads, and the choice is reported as runtime_info()["mlx_quantization"] (with per-component weight sizes under runtime_info()["mlx_weight_bytes"]). 8-bit is the recommended default: bf16 is slower at the same transcription accuracy, and a 4-bit talker can run away into long babble;
  • needs mlx 0.31.2 or newer; an older mlx (for example one left by another package) is refused at load with a plain error naming the upgrade command;
  • holds the model for the whole of one generation, because the codec decoder keeps streaming state: a streamed reply owns it until its chunk iterator is exhausted or closed. Another synthesis waits for it (up to 600 s) and unload() up to 10 s, then raises an error saying a stream holds the model. Call .close() on a chunk iterator you stop reading;
  • streams codec frames of one generation per reply: stream_custom_voice, stream_voice_design and stream_clone yield contiguous 24 kHz chunks (the first after stream_first_chunk_frames 80 ms frames, default 6, then every stream_chunk_frames, default 12), faded only at the utterance edges. The adapter's native_frame_streaming is True, speak_to_audio_chunks and the streamed speak() pass the whole reply (up to 800 characters, then sentence boundaries) as one segment, and the stream metrics carry "streaming_unit": "frames". synthesize_* is the same single generation collected. Text that arrives incrementally (open_tts_text_stream, an LLM reply) is still synthesized per text segment as it arrives;
  • runs a short priming generation at load so Metal kernels are compiled in the loading phase; runtime_info() reports load_seconds and prime_seconds;
  • accepts the PyTorch-only predictor / sampler switches and reports them as not applied: runtime_info()["pytorch_switches"] == {"predictor": ..., "sampler": ..., "applied": False, "note": ...}. MLX runs its own fixed-depth codebook loop with categorical (multinomial) sampling.

Sampling semantics are the same on both backends (temperature, top-k, top-p, repetition penalty over the generated frames, the quality presets), so a voice, language or instruction behaves the same; exact samples differ, as they do between any two devices.

Qwen performance controls

On the PyTorch backend Qwen uses the shared automatic GPU/device policy and a specialized codebook predictor by default, retaining PyTorch's multinomial sampler. No additional vendor SDK is required. Unsupported generation settings use the original Transformers path with a #FALLBACK warning. The MLX backend accepts these two settings and ignores them (see above).

Dtype on CUDA follows the card: bfloat16 on GPUs that compute it natively (compute capability 8.0, Ampere, and newer), float32 before that, where bfloat16 is emulated and slower (a Turing Quadro RTX 5000: 0.6B custom voice at 0.94 of real time in bfloat16 against 0.81 in float32). runtime_info()["dtype"] and ["dtype_reason"] say what was chosen and why; ABSTRACTVOICE_TORCH_DTYPE or an explicit dtype_name= override it.

On CUDA the specialized predictor captures its fixed-depth frame (the 15-step codebook loop) as a CUDA graph once per input shape and sampling setting and replays it for every frame. The replay records the eager loop's own kernels, so logits, IDs and random-number consumption are unchanged and the audio is bitwise identical to the eager loop with the same seed; probabilities are still validated once per frame before any ID is used. Measured on a Quadro RTX 5000 in float32, 9 s of speech, model warm: 0.8 of real time (1.6 before), the predictor at 26 ms per frame (89 before). The first utterance after a load pays the capture (0.2-0.4 s). The graph is skipped, with one #FALLBACK line, when hooks are registered on the model, when the weights move or change dtype (then recaptured), inside another capture, or when the capture fails; CPU and MPS keep the eager loop; reference is untouched. runtime_info()["cuda_graphs"] reads captured, failed: <reason> or unused (None off PyTorch), and ["sampler"] names the effective sampler while a graph replays.

Every surface can choose both settings; the runtime reads them when it loads the model:

Surface How to set them
CLI, REPL, web example --qwen3-tts-predictor auto\|reference, --qwen3-tts-sampler multinomial\|exponential
Web example (running) Qwen3-TTS predictor / sampler selects, or POST /api/qwen3-tts/codebook with {"predictor": ..., "sampler": ...}
VoiceManager VoiceManager(qwen3_tts_predictor=..., qwen3_tts_sampler=...); change later with vm.set_qwen3_tts_codebook_generation(predictor=..., sampler=...)
AbstractCore plugin settings voice_qwen3_tts_predictor, voice_qwen3_tts_sampler
Runtime Qwen3TTSSettings(predictor=..., sampler=...)

The VoiceManager choice applies to Qwen3-TTS synthesis and to Qwen3-TTS voice cloning. Changing it at runtime unloads a resident Qwen3-TTS model; the next synthesis reloads it with the new choice.

Setting Default Options
predictor auto auto: guarded specialized loop; reference: original Transformers generation
sampler multinomial multinomial: standard sampler; exponential: opt-in exponential-race sampler with frame-level validation
from abstractvoice.adapters.tts_qwen3_tts import Qwen3TTSAdapter
from abstractvoice.qwen3_tts.runtime import Qwen3TTSRuntime, Qwen3TTSSettings

runtime = Qwen3TTSRuntime(
    "Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice",
    settings=Qwen3TTSSettings(sampler="exponential"),  # or predictor="reference"
)
adapter = Qwen3TTSAdapter(runtime=runtime)

An invalid value is rejected before any weights load: the launch flags refuse it, the Python surfaces and plugin settings raise ValueError, and the web endpoint answers 400.

reference takes precedence over the sampler choice. Automatic fallback also uses the original sampler. Exponential sampling validates all distributions before returning a complete codebook frame; invalid probabilities raise without emitting that frame. Failed requests may consume more random numbers than the standard sampler because validation happens at the frame boundary. Reproducibility across different hardware or PyTorch versions is not guaranteed.

Model loading adds cold-start latency; keep the model resident for repeated requests. PyTorch version also matters on Apple Silicon: M5 Max measurements with Torch 2.12.0 / Transformers 5.8.1 were substantially faster than Torch 2.8.0 / Transformers 5.8.0. Compare warm generation time against audio duration in the Python environment running your CLI or plugin; an optimized sampler alone does not guarantee realtime throughput.

Faster inference on PyTorch does not imply native audio streaming there: /tts delivery buffered waits for complete synthesis, while streamed delivers independently synthesized text segments progressively. Native codec-frame streaming of one generation per reply is the MLX backend's behaviour (Apple silicon), whatever the delivery mode.

Language & voice selection

  • set_language(language: str) -> bool
  • Switches the active language.
  • For explicit Piper, validation uses the curated Piper mapping in abstractvoice/config/voice_catalog.py.
  • For Supertonic, validation uses the adapter's 31-language ONNX text frontend list.
  • For non-Piper providers such as OmniVoice, the language code is passed through to the adapter and the provider decides what it supports.
  • If microphone listening is active, the recognizer is recreated on the next listen(...) call so STT receives the updated language.

  • get_language() -> str, get_language_name(language_code: str | None = None) -> str

  • get_supported_languages() -> list[str]

  • Languages of every engine, without loading any model or framework: abstractvoice.languages.language_catalog(kind=None, provider=None) -> {kind: {provider: entry}}

  • kind is tts, stt or cloning; each entry is {provider, languages, open, declared}.
  • open=True for openai and openai-compatible: the remote service decides, and languages is empty.
  • declared=False when the engine publishes no language list (Chroma cloning).
  • An unknown provider raises KeyError naming the known ones; an unknown kind raises ValueError.
from abstractvoice.languages import language_catalog

language_catalog(kind="tts", provider="qwen3-tts")["tts"]["qwen3-tts"]["languages"]
# ['en', 'zh', 'ja', 'ko', 'de', 'fr', 'ru', 'pt', 'es', 'it']
  • list_available_models(language: str | None = None) -> dict
  • Lists voice/model catalog entries for CLI/web display (see abstractvoice/vm/tts_mixin.py).
  • Piper returns local voice cache status by language.
  • Supertonic returns the 10 fixed styles for the active language plus shared cache status.
  • OpenAI/OpenAI-compatible TTS returns remote voice profiles plus configured/discovered TTS model ids when the active adapter supports model listing.
  • Back-compat alias: list_voices().

  • set_voice(language: str, voice_id: str) -> bool

  • Backward-compatible method; Piper voice selection is currently best-effort.

Residency (local engine preload/unload)

AbstractVoice is remote-first by default, but local engines benefit from explicit process-startup warmup. These methods are best-effort and are meaningful only for local providers (remote OpenAI/OpenAI-compatible are treated as configured, not resident).

  • preload_tts_engine(*, warmup: bool = True, warmup_text: str | None = None, warmup_format: str = "wav") -> dict
  • Forces the active local base TTS runtime to load weights into memory.
  • When warmup=True, also synthesizes a short sample to prime kernels/caches.

  • unload_tts_engine() -> dict

  • Best-effort release of loaded local base TTS weights/sessions.

  • preload_stt_engine(*, warmup: bool = False, warmup_audio_path: str | None = None, language: str | None = None) -> dict

  • Forces the configured local STT runtime to load weights into memory.
  • When warmup=True, also runs one transcription on warmup_audio_path when provided.

  • unload_stt_engine() -> dict

  • Best-effort release of loaded local STT weights/pipelines (drops adapter refs so next use reloads cleanly).

  • list_resident_components() -> list[dict]

  • Process-local introspection used by the AbstractCore plugin residency surface.
  • Returns clone engines plus base TTS/STT residency (when determinable).

STT (audio → text)

  • transcribe_file(audio_path: str, language: str | None = None) -> str
  • Transcribes audio from a file.

  • transcribe_from_bytes(audio_bytes: bytes, language: str | None = None) -> str

  • Transcribes audio sent over the network.

language=None means auto on every engine: the engine detects the spoken language. Only an explicit code ("fr") fixes it, which skips detection — short phrases and speech mixing two languages transcribe reliably and a little faster. The manager's own language is the voice's (TTS) and never stands in for a missing STT language.

Spoken languages and the engine's report

  • abstractvoice.stt.languages is the one list of spoken languages the local engines support: SUPPORTED_LANGUAGES (ISO 639-1 codes: en, fr, de, es, ru, zh, it, pt, ja, ko, ar, hi, nl, pl, vi, el), LANGUAGE_LABELS (display names), normalize_language(value) (None/""/"auto" → None; a supported code, any case, fr-FR accepted → "fr"; anything else raises ValueError with one user-readable sentence), choices() ([{"value": "auto", "label": "Auto (detected)"}, {"value": "en", "label": "English"}, …]) and language_label(code). Every local adapter's get_supported_languages() returns this list; remote OpenAI-compatible engines pass the code through.
  • STTAdapter.transcribe_detailed(audio_path, language=None) -> Transcription and transcribe_from_bytes_detailed(audio_bytes, language=None) -> Transcription (abstractvoice.adapters.base.Transcription: text, language — what the engine was told, None = auto — and detected_language, the code the engine reported, or None when it reports none). faster-whisper reports it from its segment info, mlx-whisper from its result, an OpenAI-compatible endpoint only when its answer carries language (verbose formats); the Transformers ASR pipeline reports none. The AbstractCore audio plugin's transcribe_detailed answers the same three facts as a dict, which is how AbstractCore and AbstractGateway show "Detected: fr" and let an account choose its spoken language once, server-side.

Qwen3-ASR (Transformers ASR)

stt_engine="transformers-asr" with a Qwen3-ASR checkpoint (for example Qwen/Qwen3-ASR-0.6B or Qwen/Qwen3-ASR-1.7B) runs AbstractVoice's bundled Qwen3-ASR model code, without trust_remote_code. It needs abstractvoice[stt-hf] and runs on Transformers 5.4 or newer, so Python 3.10+ (tested in CI on the extra's floor and the latest release). With an older Transformers (what the extra resolves on Python 3.9) loading refuses with a plain error, which is also the adapter's unavailable reason. Prefetch with abstractvoice-prefetch --stt-hf Qwen/Qwen3-ASR-0.6B.

STT configuration

  • set_whisper(model_name: str) -> None | bool
  • Updates the faster‑whisper model size used for subsequent operations.

  • get_whisper() -> str

Microphone capture (local assistant mode)

  • listen(on_transcription, on_stop=None) -> bool
  • Starts microphone capture + VAD + STT in-process (abstractvoice/recognition.py).
  • Stop phrase(s): "ok stop", "okay stop", and (conservatively) "stop"; see abstractvoice/recognition.py and abstractvoice/stop_phrase.py.

  • stop_listening() -> bool

  • Stops microphone capture.

  • pause_listening() -> bool, resume_listening() -> bool

  • Pauses/resumes audio processing while keeping the listening thread alive.

  • is_listening() -> bool

  • Whether the background recognizer thread is running.

  • cleanup() -> bool

  • Best-effort cleanup for long-lived apps (stop listening, stop speaking, release audio resources).

Advanced tuning (best-effort)

  • change_vad_aggressiveness(aggressiveness: int) -> bool
  • For advanced mic/VAD tuning; see abstractvoice/recognition.py.

Voice modes (behavior while speaking)

Voice modes control what the microphone loop does while TTS is playing. Set via:

  • set_voice_mode(mode: str) -> bool where mode ∈ {"full","wait","stop","ptt"}

Mode semantics (implemented in abstractvoice/vm/core.py):

  • full: keep listening and allow barge‑in (interrupt TTS on detected speech). Best with AEC or headset; speakers can cause self-interruption (mitigations exist; see echo gating in abstractvoice/recognition.py).
  • wait: pause microphone processing while speaking. No barge‑in and no stop‑phrase detection during TTS. Good for strict turn‑taking.
  • stop: keep listening, but suppress normal transcriptions during TTS and disable “interrupt on any speech”; a rolling stop‑phrase detector stays active so users can say “ok stop” to cut playback.
  • ptt: push‑to‑talk profile (thresholds tuned for short utterances). During TTS it behaves like stop mode; the integrator controls when to start/stop capture.

The REPL defaults to mic input off, and recommends --voice-mode stop for hands‑free usage; see docs/repl_guide.md.

Acoustic echo cancellation (optional)

  • enable_aec(enabled: bool = True, stream_delay_ms: int = 0) -> bool
  • Opt‑in AEC support for true barge‑in (requires abstractvoice[aec]).
  • Playback audio chunks are fed to the recognizer via abstractvoice/vm/core.py → VoiceRecognizer.feed_far_end_audio() in abstractvoice/recognition.py.

Voice cloning (optional; heavy)

Built-in voices: the clone store also lists 70 read-only Qwen3-TTS voices shipped with the package (ids such as fr-female-camille, en-gb-male-oliver; meta.builtin is True). Use them with voice=<id> anywhere a cloned voice is accepted; they need abstractvoice[qwen3-tts] and the Qwen/Qwen3-TTS-12Hz-1.7B-Base checkpoint. Renaming, editing, exporting or deleting one raises ValueError. VoiceCloneStore(base_dir=None) (the user store) lists them after your own voices; a store at an explicit directory lists them only with builtin_voices=True. See Built-in voices.

Qwen3TTSRuntime.export_clone_prompt(prompt) returns a clone prompt as plain arrays (ref_codes int16 (frames, 16), speaker_embedding float32, x_vector_only, ref_text), and Qwen3TTSRuntime.clone_prompt_from_arrays(...) rebuilds it on either backend; the embedding must come from the same Base checkpoint (its size is checked).

Requires installing at least one cloning backend extra (and explicit artifact downloads; see docs/installation.md). The recommended/default local backend is OmniVoice:

  • abstractvoice[omnivoice] → omnivoice (default for new clones)
  • abstractvoice[cloning] → f5_tts
  • abstractvoice[chroma] → chroma
  • abstractvoice[audiodit] → audiodit
  • abstractvoice[qwen3-tts] → qwen3-tts (Base checkpoints)

Supertonic is not listed here because it is fixed-profile base TTS, not a voice-cloning provider.

Remote clone-compatible endpoints can also be used without local cloning model weights by selecting cloning_engine="openai-compatible" (or engine="openai-compatible" per call). Configure remote_base_url or OPENAI_BASE_URL; the default clone endpoint is POST /voice/clone and must return a remote voice id (voice_id or id). The local clone store keeps a handle and routes later speak_to_bytes(..., voice=<local_id>) calls to remote /audio/speech with that remote voice id.

cloning_engine="openai" targets OpenAI's hosted API by default. Custom voice creation is provider/org gated and requires explicit consent configuration such as ABSTRACTVOICE_OPENAI_VOICE_CONSENT_ID; otherwise the adapter raises an actionable error instead of silently pretending cloning is standardized.

Core cloning calls:

  • clone_voice(reference_audio_path: str, name: str | None = None, *, reference_text: str | None = None, engine: str | None = None, model: str | None = None, language: str | None = None) -> str
  • clone_voice_from_wav_bytes(wav_bytes: bytes, name: str | None = None, *, reference_text: str | None = None, engine: str | None = None, model: str | None = None, language: str | None = None) -> str

language is the language the recording is in (ISO 639-1). The voice stores it as meta.language_code with meta.language_source = "request". When you omit it, the language of reference_text (yours, or the transcript Whisper writes the first time the voice is used) is identified among the languages the engine speaks and stored with language_source = "text"; a text that is too short or ambiguous leaves the language unknown rather than guessed (identification uses py3langid, installed with the engine extras). The language puts the voice among the native speakers in language-filtered listings.

Personal voices and a shared library

By default every VoiceManager of a machine user reads and writes one store (the user's data folder, with the built-in voices). A host that serves several people can give each person their own store instead:

vm = VoiceManager(
    tts_engine="qwen3-tts",
    voice_store_dir="/data/users/alice/voices",       # alice's voices: hers only
    voice_library_dirs=["/data/voice-library"],        # everyone's voices: read-only here
)
  • Voices cloned or designed through this manager go to voice_store_dir; listing, speaking, renaming and deleting see that store first, then the libraries.
  • Library voices (and the built-in voices, listed with the first library) are read-only: renaming, editing or deleting one raises ValueError (LibraryVoiceError).
  • Without voice_library_dirs, the machine user's store is the library: the voices you already have, built-in ones included, stay visible to everyone, unchanged.
  • vm.deploy_voice_to_library(voice_id) -> str copies one of the personal voices into the first library (the personal voice is kept) and returns the library voice's id. Who may deploy is the host's decision.
  • Every listed record carries meta.scope: personal or library.
  • abstractvoice.cloning.store.open_voice_store(store_dir, library_dirs) returns the store a configuration names, for tools that manage voices without a VoiceManager.
  • design_voice(description: str, *, name: str | None = None, language: str | None = None, text: str | None = None) -> str (see below)
  • speak(..., voice="<voice_id>") / speak_to_bytes(..., voice="<voice_id>") / speak_to_file(..., voice="<voice_id>")
  • list_cloned_voices(), get_cloned_voice(voice_id: str) -> dict

Designing a voice from a description

design_voice(...) creates a reusable voice from words alone, with no reference recording. Qwen3-TTS 1.7B VoiceDesign renders a reference from the description in one generation. The warm-up it needs to settle into the voice is cut off at the silence where Whisper hears the reference text begin, so the stored transcript matches the stored audio, and the reference is cloned with Qwen3-TTS 1.7B Base. The result is a stored Qwen3-TTS clone: it is listed with the cloned voices, keeps one identity on every call, and is used with voice="<voice_id>". A description passed as per-call instructions to the VoiceDesign checkpoint, by contrast, samples a new voice each time.

  • language is the language the reference is read in: en, fr, es, de, it, pt, ru, zh, ja or ko. It defaults to the manager's language when it is one of these, else en.
  • text replaces the built-in reference text for that language.
  • The record's meta carries designed: true, the description, language_code and design_model.
  • The design run uses the manager's Qwen3-TTS backend and precision settings (qwen3_tts_backend, qwen3_tts_mlx_quantization). Design runs are serialized per process; each loads its own VoiceDesign model and Whisper and unloads them when done.
  • Needs abstractvoice[qwen3-tts] and abstractvoice[stt] (faster-whisper base for the alignment), plus the Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign and Qwen/Qwen3-TTS-12Hz-1.7B-Base checkpoints, downloaded on first use when downloads are allowed.
  • An empty description, an unsupported language, or a text too long for one generation or too short for a 4-second reference raises ValueError. Without the qwen3-tts extra it raises RuntimeError with the install command.
  • It runs in two halves you can also call yourself: render_designed_voice(description, language=, text=) -> {wav_bytes, reference_text, meta} renders and stores nothing; store_designed_voice(rendered, name=) -> voice_id clones it.

State the voice's sex explicitly in the description, in the reference language when it is not English ("une voix féminine", "eine weibliche Stimme"): without it, VoiceDesign may pick the other one.

vm = VoiceManager(language="fr")
voice_id = vm.design_voice(
    "Une voix féminine, chaleureuse et posée, d'une femme d'une quarantaine d'années.",
    name="Claire",
)
vm.speak_to_file("Bonjour et bienvenue.", "bonjour.wav", voice=voice_id)

Clone management helpers:

  • set_cloned_voice_reference_text(voice_id: str, reference_text: str) -> bool
  • rename_cloned_voice(voice_id: str, new_name: str) -> bool
  • delete_cloned_voice(voice_id: str) -> bool
  • export_voice(voice_id: str, path: str) -> str, import_voice(path: str) -> str
  • set_cloned_tts_quality(preset: str) -> bool (low|standard|high; aliases: fast, balanced)
  • get_cloning_runtime_info() -> dict
  • unload_cloning_engines(*, keep_engine: str | None = None) -> int (best-effort memory relief)
  • unload_piper_voice() -> bool (best-effort memory relief)

For the user-facing workflow and commands, see docs/repl_guide.md.

Provider caveats that affect release choice are tracked in docs/known-issues.md.

Metrics (optional)

  • pop_last_tts_metrics() -> dict | None
  • Best-effort last-utterance stats used by the REPL verbose mode.
  • Streamed synthesis (speak_to_audio_chunks(...)) records engine, ttfb_s, synth_s, audio_s, rtf, chunks, segments, segment_max_chars, segment_chars (each segment's length), language with language_source (request, reply or configured) and, for engines that report it, device (cpu or coreml for Supertonic) with device_reason when synthesis runs on the CPU.

Callbacks & hooks

  • Per-utterance callback: speak(..., callback=...) (invoked after playback drains).
  • TTS lifecycle callbacks: vm.tts_engine.on_playback_start / vm.tts_engine.on_playback_end (synthesis/queue lifecycle).
  • Audio lifecycle callbacks (actual output): vm.on_audio_start / vm.on_audio_end / vm.on_audio_pause / vm.on_audio_resume (wired in abstractvoice/vm/core.py). on_audio_start fires when the first samples of an utterance reach the output, once per utterance, including the first utterance after a stop (stop_stream() resets the started state since 0.19.3).

Explicit downloads (offline-first)

For offline deployments, prefetch explicitly (cross-platform):

python -m abstractvoice download --stt small
python -m abstractvoice download --stt-hf openai/whisper-large-v3
python -m abstractvoice download --piper en
python -m abstractvoice download --supertonic # optional; requires abstractvoice[supertonic]
python -m abstractvoice download --openf5   # optional; requires abstractvoice[cloning]
python -m abstractvoice download --chroma   # optional; requires abstractvoice[chroma] (GPU-heavy)
python -m abstractvoice download --audiodit # optional; requires abstractvoice[audiodit]
python -m abstractvoice download --omnivoice # optional; requires abstractvoice[omnivoice]

Or use the convenience entrypoint:

abstractvoice-prefetch --stt small
abstractvoice-prefetch --stt-hf openai/whisper-large-v3
abstractvoice-prefetch --piper en
abstractvoice-prefetch --supertonic         # optional; requires abstractvoice[supertonic]
abstractvoice-prefetch --openf5            # optional; requires abstractvoice[cloning]
abstractvoice-prefetch --chroma            # optional; requires abstractvoice[chroma] (GPU-heavy)
abstractvoice-prefetch --audiodit          # optional; requires abstractvoice[audiodit]
abstractvoice-prefetch --omnivoice         # optional; requires abstractvoice[omnivoice]

Notes: - --chroma artifacts may require Hugging Face access to download.

See also: docs/installation.md, docs/model-management.md, and docs/voices-and-licenses.md.

Performance note: prefetch vs preload (important for servers)

  • Prefetch (download to disk): python -m abstractvoice download ... / abstractvoice-prefetch ...
  • Preload (load into memory): create a long-lived VoiceManager (or adapter) and reuse it, optionally calling preload_tts_engine() / preload_stt_engine() once at process startup.

If you construct a new VoiceManager for every request, heavy engines (AudioDiT/OmniVoice) will pay a large one-time cost repeatedly (imports + weight load + accelerator kernel compilation).

Recommended pattern (server/process startup):

from abstractvoice import VoiceManager

# Load once, reuse for all requests.
vm = VoiceManager(
    language="en",
    tts_engine="omnivoice",
    stt_engine="openai",
    remote_api_key="sk-...",
    allow_downloads=False,
)

# Optional explicit warmup for local providers.
vm.preload_tts_engine(warmup=True, warmup_text="Hello.")
# vm.preload_stt_engine(warmup=True, warmup_audio_path="hello.wav", language="en")

Integrations (AbstractFramework ecosystem)

AbstractVoice is designed to work standalone, and also integrate cleanly into the AbstractFramework ecosystem (AbstractCore + AbstractRuntime). Overview and links: README.md.

Boundary note: - AbstractVoice owns the in-process voice backend (VoiceManager, adapters, model/cache policy). - AbstractCore owns agent orchestration, provider routing, capability selection, and OpenAI-compatible HTTP endpoints. - When both are installed, AbstractCore can expose AbstractVoice-backed audio endpoints such as POST /v1/audio/speech and POST /v1/audio/transcriptions.

AbstractCore capability plugin (auto-discovery)

AbstractVoice exposes an AbstractCore capability plugin entry point:

  • Entry point declaration: pyproject.toml → [project.entry-points."abstractcore.capabilities_plugins"]
  • Implementation: abstractvoice/integrations/abstractcore_plugin.py

The plugin registers: - a voice backend (backend_id="abstractvoice:default") for TTS+STT - an audio backend (backend_id="abstractvoice:stt") for STT-only

Audio outputs can optionally be stored into an AbstractRuntime-like artifact_store via the duck-typed adapter in abstractvoice/artifacts.py.

Discovery note (generic capability discovery): - The voice backend exposes rich discovery helpers (available_providers(), list_models(kind=...), voice_catalog(), etc). - The audio backend implements the minimal generic discovery contract used by llm.capabilities.* for STT-only routing: - available_providers(task=None) - list_models(task=None, provider=...|provider_id=...)

The voice backend also exposes thin catalog discovery methods for Core/Gateway integration code: - list_profiles(kind="tts") -> list[dict] - list_models(kind="tts"|"stt"|"cloning", provider: str | None = None) -> list[str] - list_tts_models(provider: str | None = None) -> list[str] (includes the cloning checkpoints, Qwen3-TTS …-Base, since 0.19.2) - list_models_detailed(kind="tts", provider: str | None = None) -> list[dict] — {id, role, label}; for TTS role is "cloning" for a checkpoint that speaks cloned voices only (label " (clones)"; preset synthesis on it is refused), else "tts". The catalogs carry the same records as tts_model_details_by_provider. - list_stt_models(provider: str | None = None) -> list[str] - list_cloning_models(provider: str | None = None) -> list[str] - list_tts_voices(provider: str | None = None, model: str | None = None, include_clones: bool = True, language: str | None = None) -> list[dict] - list_cloned_voices(provider: str | None = None, model: str | None = None, language: str | None = None) -> list[dict] - Every voice record, profile or clone, has the same navigation fields:

Field Meaning
voice_id The value to pass as tts(voice=...)
name Display name
kind profile (an engine voice) or clone (stored: yours, designed or built-in)
provider The engine that speaks it
model The checkpoint it belongs to; a Qwen3-TTS preset is listed once per installed checkpoint
languages Languages the voice can speak; empty when the provider does not restrict them (remote)
language The voice's native language when known (Piper voices, Qwen3-TTS presets, built-in and designed voices), else null

language="fr" keeps the voices that can speak French and lists native French voices first. - list_voices(...) -> list[dict] (alias of list_tts_voices(...)) - list_languages(kind=None, provider=None) -> {kind: {provider: {provider, languages, open, declared}}} (static per-engine language lists for tts, stt and cloning; no engine is built; see "Language & voice selection" above) - available_providers() -> {tts, stt, cloning, providers, details, unavailable} - compatibility_catalog() -> {version, providers} - get_capability_support(kind, feature, provider, model=None, surface="default") -> dict | None - find_compatible_models(kind, feature, surface="default", support_in=("native","emulated","conditional")) -> list[dict] - surface="default" resolves to the kind's primary surface (tts→bytes, stt→transcribe, cloning→create); surface names are case-insensitive. Surfaces can genuinely differ — for example qwen3-tts reports instructions support on bytes but not playback — so live-playback consumers should query surface="playback" explicitly. - clone(audio, *, name=None, reference_text=None, provider=None, model=None, artifact_store=None, metadata=None, language=None, **kwargs) -> voice_id | dict - language (or metadata["language"]): the recording's language, recorded for every input form (bytes, path, artifact reference); see clone_voice above. - Creating a voice with a local cloning engine needs only that engine: the configured TTS and STT engines (OpenAI by default) are not built, so no OpenAI key is required. An engine this install cannot run is refused with its install command (RuntimeError) before anything is stored. - clone_voice(...) -> ... (compatibility alias of clone(...)) - Cloned-voice management (the clone registry is shared by every manager of the user): - get_cloned_voice(voice_id) -> dict (stored record: voice_id, name, engine, reference_text, reference_files, meta) - rename_cloned_voice(voice_id, new_name) -> dict (the id is unchanged; returns the updated record with ok) - set_cloned_voice_reference_text(voice_id, reference_text) -> dict (a wrong transcript degrades cloned speech; returns the updated record) - delete_cloned_voice(voice_id) -> {ok, deleted, voice_id, name, engine} (removes the record and its reference audio) - delete_voice(...) / rename_voice(...) are aliases. An unknown id raises KeyError; an empty id, name or transcript raises ValueError; a library voice raises ValueError (read-only). None of these builds a VoiceManager or loads an engine. - deploy_voice_to_library(voice_id) -> dict: copies one of this capability's personal voices into its first library (needs voice_store_dir) and returns the library voice's record. - design_voice(description, *, name=None, language=None, text=None) -> dict: creates a voice from a written description (see Designing a voice from a description) and returns its stored record with ok. Catalog entries of designed voices carry tags.designed = true and the description. - voice_catalog(provider=None, model=None, providers_only=False, language=None) -> {kind, provider_id (alias engine_id), active_profile, active_model, voices (profiles + clones), tts_models, stt_models, tts_models_by_provider, stt_models_by_provider, tts_model_variants, stt_engine_variants, tts_catalog_by_provider, stt_catalog_by_provider, tts_languages_by_provider, stt_languages_by_provider, available_providers, catalog} - tts_languages_by_provider / stt_languages_by_provider map each listed provider to its language codes (empty for remote providers, which decide their own); a third-party provider without a known list is left out. - voice_catalog() also includes additive capability metadata: - controls: legacy control map kept backward-compatible for existing clients - tts_capabilities: richer per-field support truth (native|emulated|conditional|unsupported) for newer clients - speech_request_contract: current request contract id (currently "speech_request_v1") - compatibility_catalog: package-owned provider/model feature matrix across tts, stt, and cloning - Residency / warmup (local engines only; remote providers remain “configured”): - load_resident_model(request: dict) -> dict - voice backend: clone engines (provider="cloned") and local base TTS (provider="piper"|"supertonic"|"omnivoice"|"audiodit"|...) - {"task": "tts", "provider": "cloned", "model": "<engine>", "options": {"voice": "<voice_id>"}} loads the cloning engine and prepares and warms that voice (details.voice_prepared, details.voice_warmed), so the first tts(voice=...) does not pay the engine load. model may be omitted when options.voice is given; the engine is read from the stored voice. - audio backend: local STT (provider="faster-whisper"|"transformers-asr"|...) - list_resident_models(filters: dict | None = None) -> list[dict] - unload_resident_model(request: dict) -> dict - tts(text, *, provider=None, model=None, voice=None, format="wav", ...) -> bytes | artifact_ref - one_shot=True is forwarded to speak_to_bytes(one_shot=True): the whole text as one generation (qwen3-tts presets, designs and clones). - tts_stream(...) raises ValueError for one_shot=True: a stream is delivered in parts. - tts_stream(text, *, provider=None, model=None, voice=None, format="wav", cancel_event=None, ...) -> Iterator[dict] - Yields audio events (schema: "abstractvoice.tts_stream.audio.v1"), each a standalone mono 16-bit WAV segment in audio (content_type: "audio/wav", sample_rate, size_bytes, sequence from 0), then one final event: done or, when cancel_event was set, cancelled (schema: "abstractvoice.tts_stream.done.v1", ok, chunks, single_chunk, metrics). Only format="wav" is streamed; any other format raises ValueError. - Each audio event carries at most 2 s of audio (STREAM_LINE_MAX_SECONDS in abstractvoice.integrations.abstractcore_plugin): a longer engine segment (base engines hand over a whole sentence group) is sent as consecutive slices that concatenate to the segment's exact PCM, so a client can start playing before the whole segment has downloaded. Qwen3-TTS clone chunks (about 1 s) pass unchanged. chunks counts the audio events sent; metrics carries the engine's own counts (chunks, segments, per-segment clone records). - Text segments (ADR 0009, since 0.20.0): every audio event carries segment (its text segment, from 0) and that segment's text_start / text_end (code-point offsets [start, end) into the request text, as for speak_to_audio_segments); all slices of one segment share them. After a segment's last slice comes {"type": "segment_end", "schema": "abstractvoice.tts_stream.segment_end.v1", "segment", "text_start", "text_end"}. done.segments counts the segments ended. Skip event types you do not know. - Resuming a broken stream: play audio as it arrives and keep all of it. After a break, request the text again from text_end of the last segment_end you received (from the start when there is none); the retried stream's offsets index the retried text (add the resume offset to map them back to yours). When the break fell inside a segment, also skip the first seconds of the new stream's audio, as many as you already received of that unfinished segment. At a segment boundary the seam is exact: each segment is one synthesis of exactly its text, so no word is repeated or missed, whatever the engine samples. Inside a segment the seam is approximate: a sampling engine (Qwen3-TTS, cloned voices above all) speaks the same text with different timing on the retry, so the seam can land a few words early or late. Nothing is ever replayed whole. The skip matters because one segment can be long: a Qwen3-TTS clone reply of up to 800 characters is one generation on MLX (one voice per reply, ADR 0008). Offsets are exact. Resumed Markdown speaks the same words as the segments not yet spoken (an emphasis split by the resume point loses its unpaired marker; a remaining text that starts with 3. reads it as a list number, 3:).

resume_at = 0         # text_end of the last segment received whole
partial_s = 0.0       # seconds received of the segment in progress
for event in core.voice.tts_stream(text):
    if event["type"] == "audio":
        play(event["audio"])
        partial_s += seconds_of(event["audio"])
    elif event["type"] == "segment_end":
        resume_at, partial_s = event["text_end"], 0.0
# after a break: core.voice.tts_stream(text[resume_at:]), skipping its first partial_s seconds of audio
- stt(audio, *, provider=None, model=None, language=None, ...) -> str - transcribe(audio, *, provider=None, model=None, language=None, ...) -> str

These methods delegate to the active VoiceManager and keep voice/profile/model semantics in AbstractVoice. AbstractCore still owns HTTP routing, auth, and browser/security policy.

available_providers() is intentionally lightweight: it lists currently usable provider ids without constructing local model runtimes. Remote OpenAI appears when OPENAI_API_KEY is configured or an active/injected manager is already using it; OpenAI-compatible appears when a compatible base URL is configured. Local providers appear when their runtime dependency is installed and any required cached model artifacts are present. The same payload also includes known_tts_providers, known_stt_providers, and known_cloning_providers so UI/provider selectors can distinguish installed availability from the broader capability catalog.

A provider left out of those lists is explained, never silently missing. available_providers()["unavailable"] maps each kind (tts, stt, cloning) to one record per known provider that is not available:

code Meaning
runtime_missing The engine's Python packages are not installed; runtime carries the engine_runtime_status record (missing modules, extra, install command).
model_not_downloaded The runtime is installed but no model for it is on this machine (TTS).
not_configured A remote provider without its API key (openai) or base URL (openai-compatible).

Each record has a plain-words reason. voice_catalog() carries the same map as unavailable_providers (without providers the listing does include) plus unavailable_reason: None when the listing has something to offer, otherwise one sentence saying why — for a provider filter, that provider's reason; unfiltered, the configured provider's reason first. A provider that cannot answer — the configured one or a filter such as provider="openai" without a key — and an unknown provider id never raise: the listing comes back empty with the reason ("'bogus' is not a known text-to-speech provider (known: openai, ...)" for an unknown id), without building an engine. list_tts_models(provider) and list_models(kind="tts", provider=...) return [] for the same providers, also engine-free; a list cannot carry the reason, so read it from voice_catalog.

catalog = core.voice.voice_catalog(provider="supertonic")
catalog["unavailable_reason"]
# 'Supertonic is not installed: the Python package onnxruntime is missing.
#  Install it with: pip install "abstractvoice[supertonic]"'

Engine runtime status

abstractvoice.engine_runtime answers whether an engine's Python runtime is installed, for any known engine, without importing the engine or any ML framework (it uses importlib.util.find_spec only):

from abstractvoice.engine_runtime import engine_runtime_status, engine_runtime_installed, known_engines

status = engine_runtime_status("supertonic")        # or "faster-whisper", "qwen3-tts", ...
status.installed          # bool
status.missing_modules    # ("onnxruntime",) when missing; groups read "piper or piper_phonemize"
status.extra              # "supertonic"
status.install_command    # 'pip install "abstractvoice[supertonic]"'
status.reason             # plain-words sentence, None when installed
status.to_dict()          # JSON-safe record
engine_runtime_installed("faster-whisper", kind="stt")
known_engines("tts")      # engine ids this module answers for

Engine ids: openai, openai-compatible, supertonic, piper, audiodit, qwen3-tts, omnivoice, f5_tts, chroma, faster-whisper, mlx-whisper, transformers-asr (aliases such as faster_whisper or F5-TTS are accepted).

Where Whisper runs

from abstractvoice.compute import resolve_faster_whisper_device

choice = resolve_faster_whisper_device()   # or ("cpu" | "cuda")
choice.device         # "cuda" or "cpu"
choice.compute_type   # the best type the device supports: "int8_float16" on most NVIDIA GPUs, "int8" on the CPU
choice.reason         # why Whisper is NOT on a GPU (None on CUDA)
choice.refused        # True when an explicit "cuda" could not be honoured

faster-whisper runs on CUDA when CTranslate2 sees a CUDA GPU and the CUDA 12 cuBLAS and cuDNN 9 libraries it loads at the first GPU run are loadable; the compute type follows ctranslate2.get_supported_compute_types("cuda") (int8_float16, then float16, int8, float32). ABSTRACTVOICE_WHISPER_DEVICE=cpu|cuda is a request: cuda without a usable GPU is refused with a sentence and the CPU runs. If CUDA fails while loading or at the first transcription, the adapter reloads on the CPU and records why. FasterWhisperAdapter.execution_device() returns {device, compute_type, reason, refused}; get_info() carries device_reason, and the resident STT component (list_resident_components()) carries device, compute_type and device_reason. MLXWhisperAdapter.execution_device() reports the Apple GPU (metal). An unknown id, or a kind the engine does not serve, raises ValueError. Remote engines always report installed=True; whether they are configured is a separate question answered by available_providers()["unavailable"].

Discovery has a cost model, and it is worth knowing which side of it you are on:

  • Local providers cost a stat(). "Is this model here?" is answered from the model cache by abstractvoice.local_models — never by importing an engine or building an adapter. available_providers(), list_models(), and voice_catalog(providers_only=True) or voice_catalog(provider=<local>) never load torch, transformers, or ONNX Runtime. Selecting an engine that has nothing downloaded still works and still downloads on demand; it just is not listed until its weights are on the machine.
  • Remote providers share one 5 second budget. Every provider is probed at once, one task each. A provider that does not answer inside the budget gets tts_catalog_by_provider[provider]["unreachable"] = True and no entry in catalogs, because "we could not reach it in time" and "it has no models" are different facts and its empty models/voices are ours, not its. The key is only ever set when a probe was attempted and failed — its absence is no claim. Override the budget with ABSTRACTVOICE_DISCOVERY_TIMEOUT_S; the per-request socket timeout is the smaller of the budget and ABSTRACTVOICE_REMOTE_TIMEOUT_S. A list-returning helper such as list_tts_models(provider) cannot express "unknown", so read the flag when the difference matters. voice_catalog() also carries unreachable_tts_providers. It is absent on paths that contacted nobody (providers_only=True, a local provider filter), because an empty list there would assert that every provider listed — including remote ones never asked — is reachable. Absent means "not checked"; empty means "checked, all reachable".
  • Remote discovery answers age out after five minutes. A remote model or voice list is remembered so repeated listings do not re-probe the provider, and re-probed once the answer is older than the TTL — so a model loaded into a local server, or a machine that regains internet access, appears without a restart. refresh_profiles() is the immediate override. ABSTRACTVOICE_REMOTE_DISCOVERY_TTL_S sets the window; values below the 300-second floor, non-numeric values, and non-finite values are clamped back to 300, since a never-expiring memo would freeze the first probe's answer (including an empty one from a failed probe) for the life of the process.
  • Engine-free: available_providers(), list_models() for every kind and filter, list_tts_voices(provider=...), compatibility_catalog(), capability_support(), find_compatible_models(), and voice_catalog(providers_only=True) / voice_catalog(provider=<local>).
  • Builds the active engine: the unfiltered voice_catalog() and voice_catalog(provider=<remote>) when that provider is available, list_tts_voices(), list_cloned_voices(), and list_profiles(). These report the active engine's live state — its profiles, its cloned voices, its STT side — and for a local engine that loads its weights. It is deliberate: the light path reads cloned voices from the clone store while the full one also accepts clones the manager reports, so switching would silently drop the latter. Prefer the engine-free calls above for discovery.

The provider/model/voice abstraction used by the plugin is: - provider: backend/engine id such as openai, openai-compatible, piper, supertonic, audiodit, omnivoice, qwen3-tts, faster-whisper, or transformers-asr - model: provider-specific selectable model id - voice: base voice/profile id or cloned voice id available for the selected provider + model

voice_catalog() is meant to be the single rich discovery payload for AbstractCore/Gateway: - tts_catalog_by_provider[provider] contains models, model_variants, voices, profiles, cloned_voices, voices_by_model, and formats - stt_catalog_by_provider[provider] contains models, model_variants, and formats - controls remains the legacy compatibility surface for control discovery and still uses simple supported booleans for fields such as speed, quality_preset, instructions, profile, and voice_clone - tts_capabilities is the newer truthful capability map for engine-aware clients and reports support plus optional reason per field - support values may be native, emulated, conditional, or unsupported - conditional means AbstractVoice forwards or orchestrates the feature, but actual backend support can still vary by provider or endpoint - speech_request_contract versions the richer package-owned request shape without forcing older clients to understand it - compatibility_catalog is the central matrix for provider/model capability queries across tts, stt, and cloning - tts features include one_shot (native on Qwen3-TTS bytes for the speaking checkpoints, with metadata.max_chars; unsupported on playback and elsewhere) - cloning features include design on the create surface (native only for Qwen3-TTS, with the design and cloning models and the languages in metadata) and one_shot on speak_bytes; for example find_compatible_models(kind="cloning", feature="design", surface="create") lists the engines that can create a voice from a description - clone(...) accepts a local file path, raw audio bytes, an artifact-ref dict, or a direct audio payload dict with content/bytes plus optional filename / content_type. File-path and filename-bearing payloads preserve the original audio suffix for remote cloning providers. - each provider entry can define provider-wide defaults plus explicit model records - feature support is surface-specific, for example tts.bytes vs tts.playback

The lighter helper methods are convenience views over that same abstraction: - available_providers() for provider selectors - list_models(...) / list_tts_models(...) / list_stt_models(...) / list_cloning_models(...) for model selectors - list_tts_voices(...) / list_cloned_voices(...) for voice selectors - get_capability_support(...) / find_compatible_models(...) for provider-model-surface capability filtering across tts, stt, and cloning

For both TTS and STT, the plugin accepts either split fields or combined provider:model selectors. AbstractCore callers may pass separate arguments such as provider="openai", model="tts-1" or provider="transformers-asr", model="Qwen/Qwen3-ASR-1.7B", or a single combined provider value such as provider="openai:tts-1", provider="faster-whisper:large", or provider="transformers-asr:Qwen/Qwen3-ASR-1.7B".

For TTS execution, the plugin accepts either a simple voice="alloy" string or the selected voice/cloned-voice record from the catalog. When a voice dict is passed, the plugin derives provider and model from that record when needed.

Plugin configuration (owner config dict, best-effort). In AbstractCore integrations, the env/default path uses OpenAI remote TTS/STT (OPENAI_API_KEY, optional ABSTRACTVOICE_OPENAI_* overrides) unless owner config or ABSTRACTVOICE_TTS_ENGINE / ABSTRACTVOICE_STT_ENGINE selects a different provider: - voice_language: default language (e.g. "en") - voice_allow_downloads: allow on-demand downloads (bool) - voice_tts_engine: base TTS provider ("auto"|"piper"|"supertonic"|"openai"|"openai-compatible"|"audiodit"|"omnivoice") - voice_stt_engine: STT provider ("auto"|"faster_whisper"|"transformers-asr"|"openai"|"openai-compatible") - voice_tts_model: model id for remote TTS providers - voice_stt_model: model id for remote STT providers, or a Hugging Face model id when voice_stt_engine="transformers-asr" - voice_remote_base_url: base URL for OpenAI-compatible remote audio endpoints - voice_remote_api_key: optional bearer key for remote audio endpoints - voice_remote_timeout_s: request timeout for remote audio endpoints - voice_openai_api_key: OpenAI API key handed over by the host (for example a key saved in a gateway's Providers screen). Used for provider openai only (TTS, STT, cloning) and never sent to voice_remote_base_url; it also makes openai available in discovery. - voice_openai_base_url: optional OpenAI base URL used with voice_openai_api_key (default: the OpenAI API, https://api.openai.com/v1; OPENAI_BASE_URL is not used for this key, because it names the OpenAI-compatible server) - voice_store_dir: this capability's personal voice store (see Personal voices and a shared library); capabilities with the same engine settings share one VoiceManager (one copy of the weights) and each speaks, lists and changes voices in its own store - voice_library_dirs: read-only voice libraries in front of which the personal store sits (a list, or a string separated by os.pathsep); default: the machine user's store - voice_qwen3_tts_predictor / voice_qwen3_tts_sampler: Qwen3-TTS codebook predictor and sampler (see Qwen performance controls) - voice_qwen3_tts_backend: auto (default) | mlx | torch — Qwen3-TTS backend (see Qwen3-TTS checkpoints); a typo is a ValueError - voice_qwen3_tts_mlx_quantization: auto (default, 8-bit) | bf16 | 8bit | 4bit — talker precision on the MLX backend - voice_qwen3_tts_speaker_check: true (default) | false — the per-generation speaker check on Qwen3-TTS clones (see speak_to_bytes); voice_qwen3_tts_min_speaker_similarity: the opening bar, default 0.95, in (0, 1]; a value out of range is a ValueError - voice_whisper_model: faster-whisper model size (e.g. "base", "small") - voice_cloning_engine: default cloning provider ("omnivoice" by default; also "f5_tts"|"chroma"|"audiodit"|"openai"|"openai-compatible") - voice_cloned_tts_streaming: stream cloned-voice chunks for faster time-to-first-audio (bool). Used when voice_tts_delivery_mode is unset. - voice_tts_delivery_mode: unified audio delivery mode for base + cloned voices ("buffered"|"streamed"). Takes precedence over voice_cloned_tts_streaming. - voice_tts_streaming: bool alias for voice_tts_delivery_mode (true → "streamed", false → "buffered"). - voice_debug_mode: enable debug prints (bool)

Hosts pass provider credentials through this config dict, per plugin instance: AbstractCore puts create_llm(...) keyword arguments there, so create_llm(provider, model=..., voice_openai_api_key=key) is enough in-process. Without voice_openai_api_key, provider openai uses voice_remote_api_key / voice_remote_base_url as before, then OPENAI_API_KEY. The same credentials are available on the library API as VoiceManager(openai_api_key=..., openai_base_url=...).

Boolean owner config/env values accept common strings such as true, false, on, off, 1, and 0; string values like "false" are not treated as truthy.

Performance note: - The capability plugin caches VoiceManager instances in-process (keyed by the config above) so provider runtimes are not reloaded per request.

TTS metrics: - After synthesis, the plugin stores best-effort stats in artifact metadata under abstractvoice_tts (when artifact_store is used).

AbstractCore OpenAI-compatible audio endpoints

The production OpenAI-compatible HTTP server lives in AbstractCore. AbstractVoice also ships a local FastAPI web example (abstractvoice web) for package-level smoke testing, but the supported API server path is AbstractCore Server.

With abstractcore[server] and abstractvoice installed in the same environment, AbstractCore delegates its audio endpoints to the discovered capability plugin:

  • POST /v1/audio/speech -> core.voice.tts(...) -> VoiceManager.speak_to_bytes(...)
  • POST /v1/audio/transcriptions -> core.audio.transcribe(...) -> VoiceManager.transcribe_*()
  • GET /v1/audio/voices -> core.voice.voice_catalog() / list_tts_voices(...) for provider, model, profile, and cloned-voice discovery
  • GET /v1/audio/speech/models -> core.voice.list_tts_models(...) or voice_catalog()["tts_catalog_by_provider"]
  • GET /v1/audio/transcriptions/models -> core.voice.list_stt_models(...) or voice_catalog()["stt_catalog_by_provider"]

Recommended AbstractCore mapping:

providers = core.voice.available_providers()
catalog = core.voice.voice_catalog()

tts_audio = core.voice.tts(
    "Hello.",
    provider="openai",
    model="tts-1",
    voice="alloy",
    format="wav",
)

text = core.audio.transcribe(
    wav_bytes,
    provider="faster-whisper",
    model="large",
    language="en",
)

That same shape also supports local or remote cloned voices: the selected catalog item from tts_catalog_by_provider[provider]["cloned_voices"] can be passed back as the TTS voice, or its voice_id can be passed directly.

Example:

OPENAI_API_KEY=... python -m abstractcore.server.app

curl -X POST http://localhost:8000/v1/audio/speech \
  -H "Content-Type: application/json" \
  -d '{"input":"Hello.","format":"wav"}' \
  --output hello.wav

curl -X POST http://localhost:8000/v1/audio/transcriptions \
  -F "file=@hello.wav" \
  -F "language=en"

If AbstractCore Server is configured with ABSTRACTCORE_API_KEY, include the standard Authorization: Bearer <key> header. ABSTRACTCORE_API_KEY is AbstractCore’s master key: when set, AbstractCore can use any preconfigured provider API keys, while provider-specific env vars (for example OPENAI_API_KEY) can still override.

If the plugin is unavailable, AbstractCore returns 501 with install/config guidance instead of silently falling back.

For openai-compatible plugin configuration, do not set voice_remote_base_url to the same AbstractCore Server instance that is currently routing the /v1/audio/* request. That configuration recurses through the plugin path; use an upstream compatible provider/gateway, or select local providers explicitly.

The local abstractvoice web example exposes these smoke-test routes. They are example routes, not a replacement for AbstractCore Server, and they do not inherit AbstractCore/Gateway authentication or browser-origin policy:

abstractvoice web
abstractvoice web --tts-engine openai --stt-engine openai
abstractvoice web --tts-engine openai-compatible --stt-engine openai-compatible --remote-base-url http://localhost:8000/v1
  • GET /api/status -> lightweight server/config status
  • GET /api/voices -> VoiceManager.get_profiles(), list_available_models(), list_cloned_voices()
  • GET /v1/audio/voices -> compatible extension for remote profile/voice discovery (VoiceManager.get_profiles() + list_cloned_voices())
  • POST /api/tts/provider (alias: /api/tts/engine) -> switch the browser example's base TTS provider through VoiceManager.set_tts_engine(...); resets the base profile/voice to the provider/language default and clears local role clone selections
  • POST /api/voices/select -> select base TTS, a cloned voice, or a TTS profile; optional local role="assistant"|"user" stores browser-example defaults; optional preload=true warms a cloned voice by calling a tiny VoiceManager.speak_to_bytes(...)
  • POST /api/voices/clone -> example-only multipart upload for browser voice cloning; stores the uploaded/recorded reference with VoiceManager.clone_voice(...) (optional language) and validates by synthesizing a short sample by default (validate=false skips validation)
  • POST /v1/voice/clone -> compatible extension for remote clone creation; returns voice_id/id for later /v1/audio/speech voice
  • POST /api/tts -> VoiceManager.speak_to_bytes(...); accepts input/text, voice, role, language, speed, format/response_format, and sanitize_syntax
  • POST /api/stt/transcriptions -> VoiceManager.transcribe_file(...)
  • POST /api/stt/transcribe -> compatibility alias for /api/stt/transcriptions
  • GET /api/llm/models -> example-only model listing for an OpenAI-compatible local provider such as Ollama; embedding models are listed apart (embedding_models)
  • GET /api/llm/providers -> example-only detection of local Ollama and LM Studio servers (and an optional custom URL) with their chat models; the page picks a server that has models and fills the model list
  • POST /api/voices/design -> VoiceManager.design_voice(...): a voice from a written description (description, optional name, language, text)
  • POST /api/chat -> example-only non-streaming chat completion proxy; the browser owns history and sends the full short message list
  • POST /v1/audio/speech and POST /v1/audio/transcriptions -> local aliases for quick AbstractCore-compatible smoke tests. In the web example, voice may be either a cloned voice id/name or an active-provider profile id.

Local web example payload sketches:

# Browser-example role default; still resolves to a cloned voice_id.
curl -X POST http://127.0.0.1:5000/api/voices/select \
  -H "Content-Type: application/json" \
  -d '{"role":"assistant","kind":"clone","voice":"my_voice","preload":true}'

# Browser-example cloned voice creation.
curl -X POST http://127.0.0.1:5000/api/voices/clone \
  -F "name=my_voice" \
  -F "provider=omnivoice" \
  -F "reference_text=Exact transcript of the reference audio." \
  -F "file=@reference.wav"

# TTS still maps to VoiceManager.speak_to_bytes(...).
curl -X POST http://127.0.0.1:5000/api/tts \
  -H "Content-Type: application/json" \
  -d '{"input":"Hello.","role":"assistant","response_format":"wav"}' \
  --output hello.wav

# Switch the browser example to Supertonic and its default profile.
curl -X POST http://127.0.0.1:5000/api/tts/provider \
  -H "Content-Type: application/json" \
  -d '{"provider":"supertonic"}'

# Compatible extension: discover profiles/cloned voices from another
# AbstractVoice client configured with remote_base_url=http://127.0.0.1:5000/v1.
curl http://127.0.0.1:5000/v1/audio/voices

# Compatible extension: create a remote cloned voice handle.
curl -X POST http://127.0.0.1:5000/v1/voice/clone \
  -F "name=my_remote_voice" \
  -F "reference_text=Exact transcript of the reference audio." \
  -F "file=@reference.wav"

# Example dialogue call via a local OpenAI-compatible provider.
curl -X POST http://127.0.0.1:5000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"provider":"ollama","model":"gemma3:1b","messages":[{"role":"user","content":"Say hi in one sentence."}]}'

The local role field is only a convenience for the example UI. AbstractCore compatibility remains the capability/plugin contract: clients may pass a voice cloned-voice id to TTS, and AbstractCore routes that to VoiceManager.speak_to_bytes(..., voice=...).

AbstractCore tool helpers (manual wiring)

If you prefer to wire tools explicitly, abstractvoice/integrations/abstractcore.py provides:

  • make_voice_tools(voice_manager, store) -> list[callable]
  • Requires abstractcore at runtime (it imports abstractcore.tool).
  • store can be a MediaStore-like object, or an AbstractRuntime-like ArtifactStore (adapted via RuntimeArtifactStoreAdapter in abstractvoice/artifacts.py).

Tools exposed by make_voice_tools(...) (current): - voice_tts(text, voice=None, format="wav", run_id=None) -> artifact_ref - voice_profile_list(kind="tts") -> {profiles, active_profile} - voice_profile_set(profile_id, kind="tts") -> {ok, active_profile} - audio_transcribe(audio_artifact|audio_b64, ...) -> {text, transcript_artifact}

Minimal sketch:

from abstractvoice import VoiceManager
from abstractvoice.integrations.abstractcore import make_voice_tools

vm = VoiceManager(remote_api_key="sk-...")
tools = make_voice_tools(voice_manager=vm, store=artifact_store)

Example (provider-agnostic profile selection):

vm = VoiceManager(tts_engine="omnivoice", allow_downloads=False)
vm.set_profile("female_01", kind="tts")
wav_bytes = vm.speak_to_bytes("Hello.", format="wav")

TTS metrics (library-level): - VoiceManager.speak_to_bytes(...) / VoiceManager.speak_to_file(...) record best-effort stats for the last synthesis. - Call vm.pop_last_tts_metrics() to retrieve and clear them (dict with fields like engine, synth_s, audio_s, rtf, sample_rate).

Non-contract surface (may change without notice)

  • CLI behavior (abstractvoice/examples/*)
  • Internal adapter details and model catalogs beyond the documented defaults