Expand description
Voice speech-to-text endpoint — POST /api/v1/voice/transcribe, and GET /api/v1/voice/status, which
says whether the chosen engine has what it needs, so the mic can say so before it records.
The renderer captures mic audio (getUserMedia, gated by the CEF permission handler #1602) and POSTs each silence-bounded utterance here; we forward it to the configured Whisper backend and return the transcript. Keys/paths stay server-side — the renderer never sees them.
Web Speech API can’t transcribe in CEF (closed-source Google service), so this capture-and-send path is the real engine. See docs/specs/SPEC_VOICE_STT_ENGINE_2026_06_20.md and #1591.
Backends (selected by the voice:engine setting):
- “groq” (default) — hosted whisper-large-v3-turbo; renderer sends webm.
- “whisper-local” — offline whisper.cpp via a local
whisper-clisubprocess; renderer sends 16 kHz mono WAV. Opt-in, configured via settings/env; needs a model file.
Structs§
- Setup
Gap 🔒 - What an engine still needs before it can transcribe.
- Transcribe
Query 🔒
Enums§
- GroqKey 🔒
- What the Groq key setting comes to.
- Groq
KeyState 🔒 - SttError 🔒
- Transcription failure: distinguishes “not configured” (→ 501, surfaced as the frontend’s “unavailable” guidance) from a real upstream/runtime error (→ 502).
Constants§
- DEFAULT_
WHISPER_ 🔒MODEL - Transcribe via a local
whisper-cli(whisper.cpp) subprocess. The renderer sends 16 kHz mono WAV for this engine, so we write the body to a temp.wavand run the CLI. Fully offline; nothing leaves the machine. - GROQ_
GONE 🔒 - GROQ_
MODEL 🔒 - GROQ_
NOT_ 🔒CONFIGURED - GROQ_
SETTING 🔒 - The setting that holds the Groq key, or the
vault:<entry id>that names it. - GROQ_
TRANSCRIBE_ 🔒URL - MODEL_
DOWNLOAD_ 🔒TIMEOUT_ SECS - Cap the one-time model download so a stuck transfer can’t wedge a request.
- VOICE_
OFF 🔒
Functions§
- ensure_
local_ 🔒model - Resolve the GGML model path, downloading an auto-managed model on first use.
- env_
groq_ 🔒key - explicit_
model_ 🔒path - The model file the settings or the environment name outright, if they name one: there, or an error.
- groq_
key 🔒 - Groq key:
AGENTMUX_GROQ_API_KEYenv (it wins, for CI and scripts), else settings.jsonvoice:groqApiKey: avault:<entry id>reference, read from the Vault here, or a plain key from before it was moved. - groq_
key_ 🔒state_ with - Whether there is a Groq key to use, without opening a Vault entry.
- groq_
key_ 🔒with - handle_
voice_ 🔒status GET /api/v1/voice/status→{ "engine": "groq", "ready": false, "missing": "groq-key", "error": "..." }. Whether the chosen engine has what it needs to transcribe, read from the settings and the environment alone: nothing is sent anywhere, no program is run and no model is fetched. The mic asks this before it records, so a person with no engine set up is told at the click, not after speaking into nothing.- handle_
voice_ 🔒transcribe POST /api/v1/voice/transcribe?mime=audio/webm&lang=en— body is raw audio. → 200{ "text": "..." }· 400 empty body · 501 no backend configured · 502 upstream/subprocess error.- log_
not_ 🔒configured - One line in the log per run for a voice request that found no engine set up. The answer goes to the window, which is not in any log: without this line a report of “the mic does nothing” could not be read from the logs at all.
- mime_
ext 🔒 - File extension matching the posted MIME, so Groq’s content sniffing accepts
the multipart
filepart. - model_
name 🔒 - The name of the auto-managed model (
voice:whisperModel, defaultbase.en). - read_
settings_ 🔒json - Read settings.json once;
Noneif absent/unparseable. The file the config watcher loads, not<config dir>/settings.json: on a shared channel those differ (#1903). - resolve_
engine 🔒 voice:engine— “groq” (default) or “whisper-local”. Env override:AGENTMUX_VOICE_ENGINE.- resolve_
path 🔒 - Env-first, then settings.json, for a path-valued config key.
- resolve_
whisper_ 🔒cli - The
whisper-cliprogram the local engine runs: its path, when one is set and is there. - settings_
str 🔒 - setup_
gap 🔒 - The first thing
enginestill needs, orNonewhen a transcription can be tried. For local whisper a model that is fetched on first use is not a gap: only a model path that was given and is not there. - setup_
gap_ 🔒with - transcribe_
groq 🔒 - POST the audio to Groq’s OpenAI-compatible transcription endpoint.
- transcribe_
local_ 🔒whisper - voice_
off 🔒 - Voice input is switched off:
voice:enabledisfalsein settings.json (Settings > Recording). Absent, it is on.