Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(n1): LFM3 Audio/Omni komplett: Voice-Bereich, LU Engine hoert und spricht, LM-Studio-Runtime-Hinweis

purple428ad417acce
diff --git a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts b/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts
index 46717557..87f91117 100644
--- a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts
+++ b/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts
@@ -193,6 +193,9 @@ describe('endpointMap covers every backendCall/invokeMedia site the frontend can
// has no dev route (it is in the list below), so there is nothing a dev
// route for its cancel could end.
'lmstudio_cancel_load',
+ // N1: the LM Studio runtime check before an LFM3 load (api/lmstudio.ts),
+ // inside the same load that has no dev route.
+ 'lmstudio_gguf_runtime',
// The folder of the voice engine and LU's own Python (Discord D2,
// components/settings/RuntimeFolderSetting.tsx). The row only renders
// behind isTauri(): the browser build has no voice engine and no Python
diff --git a/src-tauri/resources/voice_loop/lu_voice_loop/config.py b/src-tauri/resources/voice_loop/lu_voice_loop/config.py
index dea9ea83..64782476 100644
--- a/src-tauri/resources/voice_loop/lu_voice_loop/config.py
+++ b/src-tauri/resources/voice_loop/lu_voice_loop/config.py
@@ -81,6 +81,33 @@ class LlmExtra(_Strict):
return _no_reserved_fields(value, "extra")
+class SpeechEndpoint(_Strict):
+ """An OpenAI-compatible speech service the session hears or speaks through.
+
+ Set by the app when the user picked "External HTTP" or "LU Engine" for
+ dictation or read-aloud (N1, Liquid LFM3 Audio): Ollama and llama-server
+ both take a WAV at /v1/audio/transcriptions, and speak at
+ /v1/audio/speech (Ollama) or /tts (llama-server). Without it the session
+ keeps its own Whisper and Pocket TTS.
+ """
+
+ url: str = Field(max_length=2048)
+ model: str = Field(min_length=1, max_length=512)
+ # None lets the service speak in the model's own voice.
+ voice: str | None = Field(default=None, max_length=100)
+ api_key: SecretStr | None = None
+
+ @field_validator("url")
+ @classmethod
+ def _http_url(cls, value: str) -> str:
+ parts = urlsplit(value)
+ if parts.scheme not in ("http", "https") or not parts.hostname:
+ raise ValueError("url must be an http or https URL")
+ if parts.username or parts.password:
+ raise ValueError("url must not contain credentials, use api_key")
+ return value
+
+
class ThinkingConfig(_Strict):
"""How a session deals with a model that reasons before it answers."""
@@ -159,6 +186,10 @@ class SessionConfig(_Strict):
# Thoughts are never spoken, with or without this. It adds the limit and
# the fields of the second try.
thinking: ThinkingConfig = Field(default_factory=ThinkingConfig)
+ # Hear through this service instead of the built-in Whisper.
+ stt: SpeechEndpoint | None = None
+ # Speak through this service instead of the built-in Pocket TTS.
+ tts: SpeechEndpoint | None = None
@model_validator(mode="after")
def _tools_consistent(self) -> "SessionConfig":
diff --git a/src-tauri/resources/voice_loop/lu_voice_loop/pipeline.py b/src-tauri/resources/voice_loop/lu_voice_loop/pipeline.py
index bddaf1d9..8276cf68 100644
--- a/src-tauri/resources/voice_loop/lu_voice_loop/pipeline.py
+++ b/src-tauri/resources/voice_loop/lu_voice_loop/pipeline.py
@@ -52,7 +52,7 @@ from .engines import Engines
from .latency import LatencyReport
from .log import pipeline_error_line, safe_error_text
from .ollama_native import OllamaNativeTransport
-from .speech import SharedPocketTTSService, SharedWhisperSTTService
+from .speech import HttpSTTService, HttpTTSService, SharedPocketTTSService, SharedWhisperSTTService
from .thinking import (
CHARS_PER_TOKEN,
DIRECT_INSTRUCTION,
@@ -573,6 +573,21 @@ def user_turn_params(gate: VoiceCommandGate, **kwargs) -> LLMUserAggregatorParam
return LLMUserAggregatorParams(empty_user_turn=EmptyTurnUnlessCommand(gate), **kwargs)
+def speech_services(config: SessionConfig, engines: Engines) -> tuple[FrameProcessor, FrameProcessor]:
+ """The ear and the voice of a session: the app's choice, else the built-in models."""
+ if config.stt is not None:
+ stt = HttpSTTService(url=config.stt.url, model=config.stt.model, api_key=config.stt.api_key)
+ else:
+ stt = SharedWhisperSTTService(whisper_model=engines.whisper)
+ if config.tts is not None:
+ tts = HttpTTSService(url=config.tts.url, model=config.tts.model, voice=config.tts.voice, api_key=config.tts.api_key)
+ else:
+ tts = SharedPocketTTSService(
+ tts_model=engines.tts, voice_state=engines.voice_state(config.voice), voice=config.voice,
+ )
+ return stt, tts
+
+
def build_worker(websocket, config: SessionConfig, engines: Engines) -> tuple[PipelineWorker, ToolRelay]:
"""Assemble the pipeline for one accepted WebSocket."""
transport = FastAPIWebsocketTransport(
@@ -587,11 +602,8 @@ def build_worker(websocket, config: SessionConfig, engines: Engines) -> tuple[Pi
),
)
- stt = SharedWhisperSTTService(whisper_model=engines.whisper)
+ stt, tts = speech_services(config, engines)
llm = build_llm(config)
- tts = SharedPocketTTSService(
- tts_model=engines.tts, voice_state=engines.voice_state(config.voice), voice=config.voice,
- )
relay = ToolRelay(frozenset(config.long_running_tools))
register_tools(llm, relay, config)
diff --git a/src-tauri/resources/voice_loop/lu_voice_loop/speech.py b/src-tauri/resources/voice_loop/lu_voice_loop/speech.py
index c8715955..31e7702c 100644
--- a/src-tauri/resources/voice_loop/lu_voice_loop/speech.py
+++ b/src-tauri/resources/voice_loop/lu_voice_loop/speech.py
@@ -321,3 +321,140 @@ class SharedPocketTTSService(TTSService):
yield ErrorFrame(error="Speech synthesis failed (%s)." % type(e).__name__)
finally:
await self.stop_ttfb_metrics()
+
+
+# ── Speech through an HTTP service (N1, Liquid LFM3 Audio) ──────────────────
+#
+# The app can point a session at an OpenAI-compatible speech service instead
+# of the models in this process: Ollama 0.40.13+ with lfm3-audio or lfm3-omni,
+# or the LU Engine (llama-server b11960) with one of them loaded. Both take a
+# WAV at /v1/audio/transcriptions; Ollama speaks at /v1/audio/speech and
+# llama-server at /tts, both with the same JSON body and a WAV answer.
+
+# The longest a single request may take. A speech model next to the chat
+# model on the same machine can be slow, but an answer that hangs must end.
+HTTP_SPEECH_TIMEOUT_SECS = 120.0
+
+
+def pcm_to_wav(pcm: bytes, rate: int) -> bytes:
+ """16-bit mono PCM as a WAV file, the one format every such service takes."""
+ import io
+ import wave
+
+ out = io.BytesIO()
+ with wave.open(out, "wb") as w:
+ w.setnchannels(1)
+ w.setsampwidth(2)
+ w.setframerate(rate)
+ w.writeframes(pcm)
+ return out.getvalue()
+
+
+def wav_pcm(data: bytes) -> tuple[bytes, int]:
+ """The 16-bit mono samples and the rate of a WAV answer.
+
+ Read by hand, not with the wave module: Ollama streams its WAV and writes
+ the header before it knows the length, so the size fields hold the maximum
+ value. Everything after the data chunk header is taken as samples.
+ """
+ if data[:4] != b"RIFF" or data[8:12] != b"WAVE":
+ raise ValueError("the speech service did not answer with a WAV file")
+ rate = None
+ at = 12
+ while at + 8 <= len(data):
+ kind, size = data[at:at + 4], int.from_bytes(data[at + 4:at + 8], "little")
+ if kind == b"fmt ":
+ channels = int.from_bytes(data[at + 10:at + 12], "little")
+ rate = int.from_bytes(data[at + 12:at + 16], "little")
+ bits = int.from_bytes(data[at + 22:at + 24], "little")
+ if channels != 1 or bits != 16:
+ raise ValueError("the speech service answered %d channels at %d bits, expected mono 16-bit" % (channels, bits))
+ elif kind == b"data":
+ if rate is None:
+ raise ValueError("the WAV answer has no format chunk")
+ pcm = data[at + 8:]
+ return pcm[: len(pcm) - len(pcm) % 2], rate
+ at += 8 + size + (size % 2)
+ raise ValueError("the WAV answer has no data chunk")
+
+
+def tts_body(text: str, model: str, voice: str | None) -> dict[str, Any]:
+ """The request body, the same the app sends for read-aloud (tts.rs)."""
+ body: dict[str, Any] = {"model": model, "input": text, "response_format": "wav"}
+ if voice:
+ body["voice"] = voice
+ return body
+
+
+def _auth(api_key: Any) -> dict[str, str]:
+ key = api_key.get_secret_value() if api_key is not None else None
+ return {"Authorization": "Bearer %s" % key} if key else {}
+
+
+class HttpSTTService(SharedWhisperSTTService):
+ """The same turn handling and lead-in as Whisper, the words from a service."""
+
+ def __init__(self, *, url: str, model: str, api_key: Any = None, **kwargs):
+ super().__init__(whisper_model=None, **kwargs)
+ self._url = url
+ self._model_name = model
+ self._api_key = api_key
+
+ async def run_stt(self, audio: bytes) -> AsyncGenerator[Frame, None]:
+ import httpx
+
+ await self.start_processing_metrics()
+ try:
+ async with httpx.AsyncClient(timeout=HTTP_SPEECH_TIMEOUT_SECS) as client:
+ answer = await client.post(
+ self._url,
+ headers=_auth(self._api_key),
+ files={"file": ("take.wav", pcm_to_wav(audio, WHISPER_SAMPLE_RATE), "audio/wav")},
+ data={"model": self._model_name, "response_format": "json"},
+ )
+ if answer.status_code >= 400:
+ raise RuntimeError("HTTP %d: %s" % (answer.status_code, answer.text[:200]))
+ text = str(answer.json().get("text") or "").strip()
+ except Exception as e:
+ await self.stop_processing_metrics()
+ logger.error("Speech recognition failed (%s)." % safe_error_text(e))
+ yield ErrorFrame(error="Speech recognition through %s failed (%s)." % (self._model_name, safe_error_text(e)))
+ return
+ await self.stop_processing_metrics()
+ if text:
+ yield TranscriptionFrame(text, self._user_id, time_now_iso8601(), Language.EN)
+
+
+class HttpTTSService(SharedPocketTTSService):
+ """The same sentence cutting as Pocket TTS, the sound from a service."""
+
+ def __init__(self, *, url: str, model: str, voice: str | None = None, api_key: Any = None, **kwargs):
+ super().__init__(tts_model=None, voice_state=None, voice=voice or "default", **kwargs)
+ self._url = url
+ self._model_name = model
+ self._voice_name = voice
+ self._api_key = api_key
+
+ async def run_tts(self, text: str, context_id: str) -> AsyncGenerator[Frame, None]:
+ import httpx
+
+ async def pcm_chunks(pcm: bytes) -> AsyncIterator[bytes]:
+ step = 9600
+ for at in range(0, len(pcm), step):
+ yield pcm[at:at + step]
+
+ try:
+ await self.start_tts_usage_metrics(text)
+ async with httpx.AsyncClient(timeout=HTTP_SPEECH_TIMEOUT_SECS) as client:
+ answer = await client.post(self._url, headers=_auth(self._api_key), json=tts_body(text, self._model_name, self._voice_name))
+ if answer.status_code >= 400:
+ raise RuntimeError("HTTP %d: %s" % (answer.status_code, answer.text[:200]))
+ pcm, rate = wav_pcm(answer.content)
+ async for frame in self._stream_audio_frames_from_iterator(pcm_chunks(pcm), in_sample_rate=rate, context_id=context_id):
+ await self.stop_ttfb_metrics()
+ yield frame
+ except Exception as e:
+ logger.error("Speech synthesis failed (%s)." % safe_error_text(e))
+ yield ErrorFrame(error="Speech synthesis through %s failed (%s)." % (self._model_name, safe_error_text(e)))
+ finally:
+ await self.stop_ttfb_metrics()
diff --git a/src-tauri/resources/voice_loop/tests/test_http_speech.py b/src-tauri/resources/voice_loop/tests/test_http_speech.py
new file mode 100644
index 00000000..526b4e95
--- /dev/null
+++ b/src-tauri/resources/voice_loop/tests/test_http_speech.py
@@ -0,0 +1,133 @@
+"""N1, 30.10.2026: a voice session that hears and speaks through LFM3 Audio.
+
+The app can point a session at Ollama (lfm3-audio, lfm3-omni) or at the LU
+Engine (llama-server b11960 with one of them loaded) instead of the Whisper
+and Pocket TTS models in this process. Before, the session always used its
+own two models and the speech settings of the app did not reach it.
+"""
+
+import json
+
+import httpx
+import pytest
+from pipecat.frames.frames import ErrorFrame, TranscriptionFrame, TTSAudioRawFrame, TTSSpeakFrame
+from pipecat.tests.utils import SleepFrame, run_test
+from pydantic import ValidationError
+
+from lu_voice_loop.config import SessionConfig
+from lu_voice_loop.pipeline import speech_services
+from lu_voice_loop.speech import (
+ HttpSTTService,
+ HttpTTSService,
+ SharedPocketTTSService,
+ SharedWhisperSTTService,
+ pcm_to_wav,
+ tts_body,
+ wav_pcm,
+)
+
+OLLAMA = "http://127.0.0.1:11434"
+
+
+def session(**speech) -> SessionConfig:
+ return SessionConfig.model_validate({"llm": {"base_url": "http://127.0.0.1:8127/v1", "model": "m"}, **speech})
+
+
+class Hollow:
+ tts = object()
+ whisper = object()
+
+ def voice_state(self, name):
+ return object()
+
+
+def fake_service(monkeypatch, handler):
+ """Every httpx.AsyncClient the services open answers through `handler`."""
+ seen = []
+ real = httpx.AsyncClient
+
+ def wrapped(request):
+ seen.append(request)
+ return handler(request)
+
+ monkeypatch.setattr(httpx, "AsyncClient", lambda **kw: real(transport=httpx.MockTransport(wrapped), **kw))
+ return seen
+
+
+def test_without_a_speech_service_the_session_keeps_its_own_models():
+ stt, tts = speech_services(session(), Hollow())
+ assert type(stt) is SharedWhisperSTTService
+ assert type(tts) is SharedPocketTTSService
+
+
+def test_with_one_it_hears_and_speaks_through_it():
+ stt, tts = speech_services(session(
+ stt={"url": OLLAMA + "/v1/audio/transcriptions", "model": "lfm3-audio:2b"},
+ tts={"url": OLLAMA + "/v1/audio/speech", "model": "lfm3-audio:2b"},
+ ), Hollow())
+ assert isinstance(stt, HttpSTTService)
+ assert isinstance(tts, HttpTTSService)
+
+
+def test_only_http_services_without_credentials_in_the_address():
+ with pytest.raises(ValidationError):
+ session(stt={"url": "file:///etc/passwd", "model": "m"})
+ with pytest.raises(ValidationError):
+ session(tts={"url": "http://user:[email protected]:8127/tts", "model": "m"})
+
+
+def test_the_key_of_the_lu_engine_stays_hidden():
+ parsed = session(stt={"url": "http://127.0.0.1:8127/v1/audio/transcriptions", "model": "x", "api_key": "k" * 64})
+ assert "k" * 64 not in repr(parsed)
+
+
+def test_without_a_voice_the_model_speaks_in_its_own():
+ assert tts_body("Hi.", "lfm3-audio:2b", None) == {"model": "lfm3-audio:2b", "input": "Hi.", "response_format": "wav"}
+ assert tts_body("Hi.", "m", "female")["voice"] == "female"
+
+
+def test_a_wav_answer_is_read_also_with_the_streamed_header_of_ollama():
+ pcm = bytes(range(200)) * 10
+ wav = pcm_to_wav(pcm, 24000)
+ assert wav_pcm(wav) == (pcm, 24000)
+ # Ollama writes the header before it knows the length: sizes at maximum.
+ streamed = wav[:4] + b"\xff\xff\xff\xff" + wav[8:40] + b"\xff\xff\xff\xff" + wav[44:]
+ assert wav_pcm(streamed) == (pcm, 24000)
+ with pytest.raises(ValueError):
+ wav_pcm(b"{\"error\":\"model not found\"}")
+
+
+async def test_an_utterance_goes_to_the_service_as_wav_and_comes_back_as_words(monkeypatch):
+ seen = fake_service(monkeypatch, lambda r: httpx.Response(200, json={"text": " Hello from LFM3. "}))
+ stt = HttpSTTService(url=OLLAMA + "/v1/audio/transcriptions", model="lfm3-audio:2b")
+ frames = [f async for f in stt.run_stt(b"\x00\x01" * 16000)]
+ assert [f.text for f in frames if isinstance(f, TranscriptionFrame)] == ["Hello from LFM3."]
+ body = seen[0].read()
+ assert b'name="model"' in body and b"lfm3-audio:2b" in body
+ assert b"RIFF" in body and b"WAVE" in body
+ assert "authorization" not in seen[0].headers
+
+
+async def test_the_lu_engine_gets_its_key(monkeypatch):
+ seen = fake_service(monkeypatch, lambda r: httpx.Response(200, json={"text": "ok"}))
+ stt = HttpSTTService(url="http://127.0.0.1:8127/v1/audio/transcriptions", model="engine", api_key=session(
+ stt={"url": "http://127.0.0.1:8127/v1/audio/transcriptions", "model": "e", "api_key": "secret"}).stt.api_key)
+ [f async for f in stt.run_stt(b"\x00\x01" * 1600)]
+ assert seen[0].headers["authorization"] == "Bearer secret"
+
+
+async def test_a_refusal_of_the_service_is_said_not_swallowed(monkeypatch):
+ fake_service(monkeypatch, lambda r: httpx.Response(404, json={"error": "model \"lfm3-audio:2b\" not found"}))
+ stt = HttpSTTService(url=OLLAMA + "/v1/audio/transcriptions", model="lfm3-audio:2b")
+ frames = [f async for f in stt.run_stt(b"\x00\x01" * 1600)]
+ errors = [f.error for f in frames if isinstance(f, ErrorFrame)]
+ assert errors and "lfm3-audio:2b" in errors[0] and "404" in errors[0]
+
+
+async def test_a_sentence_is_spoken_from_the_wav_the_service_answers(monkeypatch):
+ seen = fake_service(monkeypatch, lambda r: httpx.Response(200, content=pcm_to_wav(b"\x00\x00" * 24000, 24000), headers={"content-type": "audio/wav"}))
+ tts = HttpTTSService(url=OLLAMA + "/v1/audio/speech", model="lfm3-audio:2b")
+ down, up = await run_test(tts, frames_to_send=[TTSSpeakFrame("Hello there."), SleepFrame(0.5)])
+ assert [f for f in down if isinstance(f, TTSAudioRawFrame)], "the sentence was never spoken"
+ assert not [f for f in [*down, *up] if isinstance(f, ErrorFrame)]
+ assert json.loads(seen[0].read()) == {"model": "lfm3-audio:2b", "input": "Hello there.", "response_format": "wav"}
diff --git a/src-tauri/src/commands/engine.rs b/src-tauri/src/commands/engine.rs
index d6734686..a8797fb3 100644
--- a/src-tauri/src/commands/engine.rs
+++ b/src-tauri/src/commands/engine.rs
@@ -326,8 +326,30 @@ pub(crate) fn existing_mmproj(model_path: &str) -> Option<String> {
/// gemma-3-4b conversion is a gemma3 by name, the app fed it the picture it
/// had just generated, and the run ended on a red "This model can't read
/// images" line under a picture that came out fine.
+///
+/// N1, 30.10.2026: a projector is not always an image part. llama.cpp b11960
+/// loads audio encoders through the same `--mmproj`, and the projector of
+/// LiquidAI/LFM3-Audio-2B-GGUF carries `clip.has_audio_encoder` and no vision
+/// encoder at all (Omni carries both, VL only vision). Such a model hears and
+/// does not see, and an image sent to it ends on a 501 from the engine. The
+/// projector's own head says which; a head without the flag (older and
+/// hand-made projectors, the dummies in the tests below) stays a vision part,
+/// as every projector was before audio ones existed.
pub(crate) fn model_can_see_images(model_path: &str) -> bool {
- existing_mmproj(model_path).is_some()
+ existing_mmproj(model_path).is_some_and(|p| projector_sees_images(&p))
+}
+
+/// `clip.has_vision_encoder` of a projector. A head without it is a vision
+/// part unless it names an audio encoder instead (LFM3 Audio writes only
+/// `clip.has_audio_encoder`); an unreadable head stays a vision part.
+pub(crate) fn projector_sees_images(projector_path: &str) -> bool {
+ use crate::commands::gguf::{read_model_head, Meta};
+ let Some(head) = read_model_head(projector_path) else { return true };
+ let flag = |key: &str| match head.keys.get(key) {
+ Some(Meta::Int(n)) => Some(*n != 0),
+ _ => None,
+ };
+ flag("clip.has_vision_encoder").unwrap_or_else(|| flag("clip.has_audio_encoder") != Some(true))
}
// ── How much of a model a card can actually hold (3.0.0 list, bugs u and a) ──
@@ -6703,6 +6725,44 @@ mod tests {
);
}
+ /// A GGUF head with nothing but these bool keys, as a projector writes them.
+ fn projector_head(flags: &[(&str, bool)]) -> Vec<u8> {
+ let mut b = Vec::new();
+ b.extend_from_slice(b"GGUF");
+ b.extend_from_slice(&3u32.to_le_bytes());
+ b.extend_from_slice(&0u64.to_le_bytes());
+ b.extend_from_slice(&(flags.len() as u64).to_le_bytes());
+ for (key, on) in flags {
+ b.extend_from_slice(&(key.len() as u64).to_le_bytes());
+ b.extend_from_slice(key.as_bytes());
+ b.extend_from_slice(&7u32.to_le_bytes());
+ b.push(u8::from(*on));
+ }
+ b
+ }
+
+ #[test]
+ fn an_audio_projector_hears_and_does_not_see() {
+ // The flags of the three LFM3 projectors, read from the files on
+ // Hugging Face (LiquidAI/LFM3-{Audio,Omni,VL}-2B-GGUF, Q8_0) on the Mac.
+ let dir = tempfile::tempdir().unwrap();
+ for (name, flags, sees) in [
+ ("LFM3-Audio-2B-Q4_K_M", vec![("clip.has_audio_encoder", true)], false),
+ ("LFM3-Omni-2B-Q4_K_M", vec![("clip.has_vision_encoder", true), ("clip.has_audio_encoder", true)], true),
+ ("LFM3-VL-2B-Q4_K_M", vec![("clip.has_vision_encoder", true)], true),
+ ("Older-Vision-Q4_K_M", vec![], true),
+ ("Off-Q4_K_M", vec![("clip.has_vision_encoder", false), ("clip.has_audio_encoder", true)], false),
+ ] {
+ let model = dir.path().join(format!("{name}.gguf"));
+ std::fs::write(&model, b"weights").unwrap();
+ std::fs::write(dir.path().join(format!("{name}.mmproj.gguf")), projector_head(&flags)).unwrap();
+ let path = model.to_string_lossy().to_string();
+ assert_eq!(model_can_see_images(&path), sees, "{name}");
+ // The engine still starts with the projector: it is the model's ear.
+ assert!(existing_mmproj(&path).is_some(), "{name}");
+ }
+ }
+
#[test]
fn what_the_list_calls_seeing_is_what_the_start_passes_along() {
// One question, asked twice: the model list reports `vision`, the
diff --git a/src-tauri/src/commands/install/lmstudio.rs b/src-tauri/src/commands/install/lmstudio.rs
index fc3e1aa7..c31bd2e8 100644
--- a/src-tauri/src/commands/install/lmstudio.rs
+++ b/src-tauri/src/commands/install/lmstudio.rs
@@ -914,6 +914,52 @@ fn should_run_lms_unload(daemon_answers: bool, process_running: impl FnOnce() ->
daemon_answers || process_running()
}
+/// The llama.cpp runtime LM Studio runs GGUF models with, e.g. "2.55.0".
+///
+/// N1, 30.10.2026: Liquid LFM3 needs LM Studio's llama.cpp runtime 2.65.1 or
+/// newer (model card of LiquidAI/LFM3-1.7B-GGUF). LM Studio keeps the runtime
+/// it uses per format in `~/.lmstudio/.internal/backend-preferences-v1.json`
+/// (read on the Mac: `[{"model_format":"gguf","name":"llama.cpp-mac-arm64-
+/// apple-metal-advsimd","version":"2.55.0"}, …]`). An internal file, so
+/// anything that does not read as that shape answers None and LU says nothing.
+/// Read only; LU never changes LM Studio's runtime.
+#[tauri::command]
+pub fn lmstudio_gguf_runtime() -> Option<String> {
+ let path = dirs::home_dir()?.join(".lmstudio").join(".internal").join("backend-preferences-v1.json");
+ gguf_runtime_of(&std::fs::read_to_string(path).ok()?)
+}
+
+fn gguf_runtime_of(preferences: &str) -> Option<String> {
+ let entries: Vec<serde_json::Value> = serde_json::from_str(preferences).ok()?;
+ entries.iter().find_map(|e| {
+ let gguf = e.get("model_format")?.as_str()? == "gguf";
+ let llama = e.get("name")?.as_str()?.starts_with("llama.cpp");
+ let version = e.get("version")?.as_str()?;
+ (gguf && llama && !version.is_empty()).then(|| version.to_string())
+ })
+}
+
+#[cfg(test)]
+mod gguf_runtime_tests {
+ use super::gguf_runtime_of;
+
+ #[test]
+ fn the_gguf_runtime_is_read_from_lm_studios_preferences() {
+ // The file as it lies on the Mac (LM Studio, 30.10.2026).
+ let mac = r#"[{"model_format":"gguf","name":"llama.cpp-mac-arm64-apple-metal-advsimd","version":"2.55.0"},{"model_format":"safetensors","name":"mlx-llm-mac-arm64-apple-metal-nax-advsimd","version":"1.13.1"}]"#;
+ assert_eq!(gguf_runtime_of(mac).as_deref(), Some("2.55.0"));
+ let windows = r#"[{"model_format":"gguf","name":"llama.cpp-win-x86_64-nvidia-cuda12-avx2","version":"2.66.0"}]"#;
+ assert_eq!(gguf_runtime_of(windows).as_deref(), Some("2.66.0"));
+ }
+
+ #[test]
+ fn another_shape_says_nothing() {
+ assert_eq!(gguf_runtime_of("{}"), None);
+ assert_eq!(gguf_runtime_of("not json"), None);
+ assert_eq!(gguf_runtime_of(r#"[{"model_format":"safetensors","name":"mlx","version":"1.0"}]"#), None);
+ }
+}
+
#[cfg(test)]
mod tests {
/// Security pass of 2026-10-13: the server was started with a flag that
diff --git a/src-tauri/src/commands/tts.rs b/src-tauri/src/commands/tts.rs
index 66ae0373..c50ee648 100644
--- a/src-tauri/src/commands/tts.rs
+++ b/src-tauri/src/commands/tts.rs
@@ -356,8 +356,10 @@ fn transcript_of(answer: &serde_json::Value) -> Option<String> {
/// Speech to text through a user-configured OpenAI-compatible
/// `/v1/audio/transcriptions` endpoint, the counterpart of
/// `synthesize_external` for the microphone. Ollama (0.40.13+) serves it for
-/// models that take audio, such as `lfm3-audio` and `lfm3-omni` (N1). The
-/// take is the WAV `createAudioRecorder` writes; Ollama accepts WAV only.
+/// models that take audio, such as `lfm3-audio` and `lfm3-omni` (N1), and so
+/// does the LU Engine (llama-server b11960) with one of them loaded; that
+/// request carries the engine key. The take is the WAV `createAudioRecorder`
+/// writes; Ollama accepts WAV only.
///
/// SSRF: the same reasoning as `synthesize_external`, the URL comes from the
/// voice settings, never from model output.
@@ -367,8 +369,10 @@ pub async fn transcribe_external(
content_type: String,
url: String,
model: String,
+ state: State<'_, AppState>,
) -> Result<serde_json::Value, String> {
let parsed = external_voice_url(&url, "transcription")?;
+ let ports = super::engine_key::engine_ports(&state);
let model = model.trim().to_string();
if model.is_empty() {
return Err("No speech-to-text model is set. Enter one in Settings, Voice.".to_string());
@@ -394,8 +398,9 @@ pub async fn transcribe_external(
.timeout(std::time::Duration::from_secs(300))
.build()
.map_err(|e| e.to_string())?;
- let resp = client
- .post(parsed.as_str())
+ // The LU Engine (llama-server b11960 with LFM3 Audio or Omni) answers
+ // only with its key; any other service never sees it.
+ let resp = super::engine_key::authorize(client.post(parsed.as_str()), parsed.as_str(), &ports)
.multipart(form)
.send()
.await
@@ -427,6 +432,7 @@ pub async fn synthesize_external(
url: String,
voice: Option<String>,
model: Option<String>,
+ state: State<'_, AppState>,
) -> Result<serde_json::Value, String> {
let text = text.trim().to_string();
if text.is_empty() {
@@ -443,8 +449,8 @@ pub async fn synthesize_external(
let body = external_tts_body(&text, model.as_deref(), voice.as_deref());
- let resp = client
- .post(parsed.as_str())
+ let ports = super::engine_key::engine_ports(&state);
+ let resp = super::engine_key::authorize(client.post(parsed.as_str()), parsed.as_str(), &ports)
.json(&body)
.send()
.await
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 28299247..99812631 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -727,6 +727,8 @@ pub fn run() {
#[cfg(desktop)]
commands::install::lmstudio_load_model,
#[cfg(desktop)]
+ commands::install::lmstudio_gguf_runtime,
+ #[cfg(desktop)]
commands::install::lmstudio_model_context,
#[cfg(desktop)]
commands::install::lmstudio_unload_model,
diff --git a/src/api/__tests__/image-part-catalog.test.ts b/src/api/__tests__/image-part-catalog.test.ts
index 5a16d786..91250d44 100644
--- a/src/api/__tests__/image-part-catalog.test.ts
+++ b/src/api/__tests__/image-part-catalog.test.ts
@@ -26,7 +26,10 @@ describe('the image parts of the chat catalog', () => {
expect(gguf.length).toBeGreaterThan(100)
for (const m of gguf) {
const seesByTag = m.tags.includes('Vision')
- expect(seesByTag, `${m.name}: the Vision tag and the image part must agree`).toBe(!!m.mmprojUrl)
+ // N1: LFM3 Audio's part is a sound part (an audio encoder through the
+ // same --mmproj). It carries the tag "Audio" and no "Vision".
+ const hearsOnly = m.tags.includes('Audio') && !seesByTag
+ expect(seesByTag || hearsOnly, `${m.name}: the Vision tag and the image part must agree`).toBe(!!m.mmprojUrl)
}
})
diff --git a/src/api/__tests__/lfm3-in-lm-studio-braucht-runtime.test.ts b/src/api/__tests__/lfm3-in-lm-studio-braucht-runtime.test.ts
new file mode 100644
index 00000000..0d73e476
--- /dev/null
+++ b/src/api/__tests__/lfm3-in-lm-studio-braucht-runtime.test.ts
@@ -0,0 +1,69 @@
+/**
+ * N1, 30.10.2026: LFM3 in LM Studio needs its llama.cpp runtime 2.65.1 or
+ * newer. On the Mac LM Studio ran 2.55.0, and a load of LFM3 there fails
+ * without a word about why. LU reads the runtime (read only, never changes it)
+ * and says what to do instead of asking LM Studio for a load that cannot work.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+type Args = Record<string, unknown> | undefined
+const backendCall = vi.fn(async (_command: string, _args?: Args): Promise<unknown> => ({}))
+vi.mock('../backend', () => ({ backendCall: (command: string, args?: Args) => backendCall(command, args) }))
+
+import { loadLmStudioModel, LmStudioSwitchError, __stopEndedLmStudioLoadWatchForTests } from '../lmstudio'
+import { __resetEndedLmStudioLoadsForTests } from '../../lib/lmstudio-ended-loads'
+import { compareVersions, isLfm3Model, lmStudioRuntimeNote } from '../../lib/lmstudio-runtime'
+
+function lmStudio(runtime: string | null) {
+ backendCall.mockImplementation(async (command) => {
+ if (command === 'lmstudio_gguf_runtime') return runtime
+ if (command === 'lmstudio_list_loaded') return { models: [] }
+ return {}
+ })
+}
+
+beforeEach(() => { backendCall.mockReset(); __resetEndedLmStudioLoadsForTests() })
+afterEach(() => __stopEndedLmStudioLoadWatchForTests())
+
+describe('LFM3 in LM Studio', () => {
+ it('mit Runtime 2.55.0 sagt LU, was zu tun ist, und fragt LM Studio gar nicht erst', async () => {
+ lmStudio('2.55.0')
+ const err = await loadLmStudioModel('liquidai/lfm3-1.7b').catch((e: unknown) => e)
+ expect(err).toBeInstanceOf(LmStudioSwitchError)
+ expect((err as LmStudioSwitchError).reason).toContain("Update LM Studio's runtime to 2.65.1 or newer for LFM3")
+ expect((err as LmStudioSwitchError).reason).toContain('2.55.0')
+ expect(backendCall.mock.calls.some(([c]) => c === 'lmstudio_load_model')).toBe(false)
+ })
+
+ it('mit 2.66.0 wird geladen', async () => {
+ lmStudio('2.66.0')
+ await loadLmStudioModel('liquidai/lfm3-vl-2b')
+ expect(backendCall.mock.calls.some(([c]) => c === 'lmstudio_load_model')).toBe(true)
+ })
+
+ it('unbekannte Runtime: kein Satz, LM Studio entscheidet', async () => {
+ lmStudio(null)
+ await loadLmStudioModel('liquidai/lfm3-1.7b')
+ expect(backendCall.mock.calls.some(([c]) => c === 'lmstudio_load_model')).toBe(true)
+ })
+
+ it('andere Modelle fragen nicht nach der Runtime', async () => {
+ lmStudio('2.0.0')
+ await loadLmStudioModel('qwen/qwen3.8-27b')
+ expect(backendCall.mock.calls.some(([c]) => c === 'lmstudio_gguf_runtime')).toBe(false)
+ })
+})
+
+describe('Versionen und Namen', () => {
+ it('vergleicht Teil fuer Teil, nicht als Text', () => {
+ expect(compareVersions('2.65.1', '2.65.1')).toBe(0)
+ expect(compareVersions('2.9.0', '2.65.1')).toBe(-1)
+ expect(compareVersions('2.100.0', '2.65.1')).toBe(1)
+ expect(compareVersions('3.0', '2.65.1')).toBe(1)
+ })
+ it('LFM3 ja, LFM2 und LFM 2.5 nicht', () => {
+ for (const id of ['liquidai/lfm3-1.7b', 'LFM3-VL-2B-Q4_K_M', 'lfm3-omni-2b']) expect(isLfm3Model(id)).toBe(true)
+ for (const id of ['liquidai/lfm2.5-2.6b', 'lfm2-8b', 'xlfm3y']) expect(isLfm3Model(id)).toBe(false)
+ expect(lmStudioRuntimeNote('lfm2-8b', '2.0.0')).toBeNull()
+ })
+})
diff --git a/src/api/__tests__/lfm3-nur-was-laeuft.test.ts b/src/api/__tests__/lfm3-nur-was-laeuft.test.ts
index bdd744d4..0ba6d00b 100644
--- a/src/api/__tests__/lfm3-nur-was-laeuft.test.ts
+++ b/src/api/__tests__/lfm3-nur-was-laeuft.test.ts
@@ -91,7 +91,7 @@ describe('LFM3 als GGUF fuer LU Engine und LM Studio', () => {
const g = lfm3Gguf()
expect(g.map((m) => m.filename).sort()).toEqual([
'LFM3-1.7B-Q4_K_M.gguf', 'LFM3-1.7B-Q8_0.gguf', 'LFM3-1.7B-QAD-Q4_0.gguf',
- 'LFM3-Omni-2B-Q4_K_M.gguf', 'LFM3-VL-2B-Q4_K_M.gguf', 'LFM3-VL-2B-Q8_0.gguf',
+ 'LFM3-Audio-2B-Q4_K_M.gguf', 'LFM3-Omni-2B-Q4_K_M.gguf', 'LFM3-VL-2B-Q4_K_M.gguf', 'LFM3-VL-2B-Q8_0.gguf',
])
for (const m of g) {
expect(m.downloadUrl).toMatch(/^https:\/\/huggingface\.co\/LiquidAI\/LFM3-/)
@@ -101,20 +101,24 @@ describe('LFM3 als GGUF fuer LU Engine und LM Studio', () => {
}
})
- it('VL und Omni bringen ihren Projektor mit, der Text nicht', () => {
+ it('VL, Omni und Audio bringen ihren Projektor mit, der Text nicht', () => {
for (const m of lfm3Gguf()) {
- const sieht = /VL|Omni/.test(m.name)
- expect(Boolean(m.mmprojUrl), m.name).toBe(sieht)
- if (sieht) {
- expect(m.mmprojUrl).toMatch(/LiquidAI\/LFM3-(VL|Omni)-2B-GGUF\/resolve\/main\/mmproj-/)
+ const teil = /VL|Omni|Audio/.test(m.name)
+ expect(Boolean(m.mmprojUrl), m.name).toBe(teil)
+ if (teil) {
+ expect(m.mmprojUrl).toMatch(/LiquidAI\/LFM3-(VL|Omni|Audio)-2B-GGUF\/resolve\/main\/mmproj-/)
expect(m.mmprojSha256).toMatch(/^[0-9a-f]{64}$/)
- expect(m.tags).toContain('Vision')
}
+ // Audio hoert nur: kein Vision, damit Kachel und Bildfilter nicht luegen.
+ expect(m.tags.includes('Vision'), m.name).toBe(/VL|Omni/.test(m.name))
}
})
- it('kein Audio-GGUF: in der Engine waere es nur ein Textmodell', () => {
- expect(lfm3Gguf().some((m) => /Audio/.test(m.name))).toBe(false)
+ it('Audio und Omni sagen, dass die LU Engine mit ihnen hoert und spricht', () => {
+ for (const m of lfm3Gguf().filter((x) => /Audio|Omni/.test(x.name))) {
+ expect(m.description, m.name).toMatch(/LU Engine/)
+ expect(m.description, m.name).toMatch(/Settings, Voice/)
+ }
})
})
diff --git a/src/api/__tests__/voice-speech.test.ts b/src/api/__tests__/voice-speech.test.ts
new file mode 100644
index 00000000..de61c2ab
--- /dev/null
+++ b/src/api/__tests__/voice-speech.test.ts
@@ -0,0 +1,46 @@
+/**
+ * N1: the Voice surface hears and speaks through the same choice as
+ * dictation and read-aloud. Before, the session body carried no speech
+ * settings and the voice loop always used its own Whisper and Pocket TTS.
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const backend = vi.hoisted(() => ({ backendCall: vi.fn() }))
+vi.mock('../backend', async (orig) => ({ ...((await orig()) as object), backendCall: backend.backendCall }))
+
+import { voiceSessionSpeech } from '../voice-speech'
+import { useVoiceStore } from '../../stores/voiceStore'
+import { useProviderStore } from '../../stores/providerStore'
+
+beforeEach(() => {
+ backend.backendCall.mockReset()
+ useVoiceStore.getState().resetVoiceDefaults()
+})
+
+describe('Voice-Sitzung und Spracheinstellung', () => {
+ it('ohne Wahl behaelt die Sitzung ihre eigenen Modelle', async () => {
+ expect(await voiceSessionSpeech()).toEqual({})
+ })
+
+ it('Ollama: Adresse und Modell, ohne Schluessel', async () => {
+ useVoiceStore.getState().updateVoiceSettings({
+ sttMode: 'external', externalSttUrl: 'http://localhost:11434/v1/audio/transcriptions', externalSttModel: 'lfm3-audio:2b',
+ ttsMode: 'external', externalTtsUrl: 'http://localhost:11434/v1/audio/speech', externalTtsModel: 'lfm3-audio:2b',
+ })
+ expect(await voiceSessionSpeech()).toEqual({
+ stt: { url: 'http://localhost:11434/v1/audio/transcriptions', model: 'lfm3-audio:2b' },
+ tts: { url: 'http://localhost:11434/v1/audio/speech', model: 'lfm3-audio:2b' },
+ })
+ expect(backend.backendCall).not.toHaveBeenCalled()
+ })
+
+ it('LU Engine: aktueller Port aus dem Slot und der Engine-Schluessel', async () => {
+ const p = useProviderStore.getState()
+ p.setProviderConfig('openai', { enabled: true, managed: true, baseUrl: 'http://127.0.0.1:8129/v1' })
+ backend.backendCall.mockImplementation(async (cmd: string, args: { url: string }) => (cmd === 'engine_key_for' && args.url.startsWith('http://127.0.0.1:8129/') ? 'k'.repeat(64) : null))
+ useVoiceStore.getState().updateVoiceSettings({ sttMode: 'engine', ttsMode: 'engine' })
+ const speech = await voiceSessionSpeech()
+ expect(speech.stt).toEqual({ url: 'http://127.0.0.1:8129/v1/audio/transcriptions', model: 'lu-engine', api_key: 'k'.repeat(64) })
+ expect(speech.tts).toEqual({ url: 'http://127.0.0.1:8129/tts', model: 'lu-engine', api_key: 'k'.repeat(64) })
+ })
+})
diff --git a/src/api/discover.ts b/src/api/discover.ts
index ddf01227..28cd3f12 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1428,15 +1428,16 @@ export function getMainstreamTextModels(): DiscoverModel[] {
// v1.0, like LFM 2.5: commercial use is licensed below 10 million revenue a year.
// GGUF for the LU Engine and LM Studio (N1 after E1): llama.cpp knows
// `lfm3` from b11960, the pin E1 set. Bytes and SHA-256 are the LFS values
- // of the LiquidAI repositories, read 30.10.2026. LFM3 Audio has no GGUF
- // row: in the engine it would be a text model only, LU's speech in and
- // out for it runs through Ollama (Settings, Voice).
+ // of the LiquidAI repositories, read 30.10.2026. LFM3 Audio and Omni hear
+ // and speak in the engine too: llama-server b11960 answers
+ // /v1/audio/transcriptions and /tts (lib/speech-route.ts).
{ name: 'LFM3 1.7B', group: 'LFM3 1.7B', blurb: "very small, fast model for quick answers, summaries and simple tool calls", description: 'Liquid AI LFM3 1.7B · very small, fast model for quick answers, summaries, extraction and simple tool calls, 256K context. Weaker at long reasoning than 7B+ models. Runs in the LU Engine from 3.0.9 (llama.cpp b11960) and in LM Studio with its llama.cpp runtime 2.65.1 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: '97K+', tags: ['1.7B', 'Q4_K_M', '1.0 GB', 'Tools'], updated: 'New', agent: true, released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-1.7B-GGUF', 'LFM3-1.7B-Q4_K_M.gguf'), filename: 'LFM3-1.7B-Q4_K_M.gguf', sizeGB: 1.02, sizeBytes: 1099627808, sha256: '3793e1e6e2266919d6e015287221b41100175a98eddaba92e111aed3b05c93c4' },
{ name: 'LFM3 1.7B QAD Q4_0', group: 'LFM3 1.7B', blurb: "very small, fast model for quick answers, summaries and simple tool calls", description: 'Liquid AI LFM3 1.7B · Q4_0 from quantization-aware distillation, trained by Liquid AI to keep the quality of the full model at 4 bits.', pulls: '97K+', tags: ['1.7B', 'QAD Q4_0', '1.0 GB', 'Tools'], updated: 'New', agent: true, released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-1.7B-GGUF', 'LFM3-1.7B-QAD-Q4_0.gguf'), filename: 'LFM3-1.7B-QAD-Q4_0.gguf', sizeGB: 0.98, sizeBytes: 1049615680, sha256: '43a7d09a0e9cba91b63eb7052488b9564569bddfd65754d2e426465e572a7452' },
{ name: 'LFM3 1.7B Q8_0', group: 'LFM3 1.7B', blurb: "very small, fast model for quick answers, summaries and simple tool calls", description: 'Liquid AI LFM3 1.7B · Q8_0, closest to the original weights.', pulls: '97K+', tags: ['1.7B', 'Q8_0', '1.7 GB', 'Tools'], updated: 'New', agent: true, released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-1.7B-GGUF', 'LFM3-1.7B-Q8_0.gguf'), filename: 'LFM3-1.7B-Q8_0.gguf', sizeGB: 1.72, sizeBytes: 1846238496, sha256: '8f6b24182258205e9e01e21f1f24a1f208c1e8115578825d202ce39976af20b6' },
{ name: 'LFM3 VL 2B', group: 'LFM3 VL 2B', blurb: "small model with image input: photos, screenshots, documents", description: 'Liquid AI LFM3 VL 2B · LFM3 with image input: describe photos, read screenshots and documents. Small, so expect short and simple answers. The 0.2 GB image part comes with it. Runs in the LU Engine from 3.0.9 (llama.cpp b11960) and in LM Studio with its llama.cpp runtime 2.65.1 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: '36K+', tags: ['2B', 'Vision', 'Q4_K_M', '1.0 GB'], updated: 'New', released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-VL-2B-GGUF', 'LFM3-VL-2B-Q4_K_M.gguf'), filename: 'LFM3-VL-2B-Q4_K_M.gguf', sizeGB: 1.02, sizeBytes: 1099627808, sha256: '56dac2e192ff0d9ab8507f4f1aeb4aed0463449bbbefaac79497f041c95f21eb', ...IMAGE_PART['LiquidAI/LFM3-VL-2B-GGUF/mmproj-LFM3-VL-2B-Q8_0.gguf'] },
{ name: 'LFM3 VL 2B Q8_0', group: 'LFM3 VL 2B', blurb: "small model with image input: photos, screenshots, documents", description: 'Liquid AI LFM3 VL 2B · Q8_0, closest to the original weights. The 0.2 GB image part comes with it.', pulls: '36K+', tags: ['2B', 'Vision', 'Q8_0', '1.7 GB'], updated: 'New', released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-VL-2B-GGUF', 'LFM3-VL-2B-Q8_0.gguf'), filename: 'LFM3-VL-2B-Q8_0.gguf', sizeGB: 1.72, sizeBytes: 1846238496, sha256: 'e138e54189a751d90ea8c0b236360490613ecd465d28d68fa6094d3db7fa6727', ...IMAGE_PART['LiquidAI/LFM3-VL-2B-GGUF/mmproj-LFM3-VL-2B-Q8_0.gguf'] },
- { name: 'LFM3 Omni 2B', group: 'LFM3 Omni 2B', blurb: "text, images and sound in one small model", description: 'Liquid AI LFM3 Omni 2B · text, images and sound in one small model. In the LU Engine and LM Studio LU chats with it in text and images; for speech in and out use the Ollama build (Settings, Voice). The 0.5 GB image and sound part comes with it. Runs in the LU Engine from 3.0.9 (llama.cpp b11960) and in LM Studio with its llama.cpp runtime 2.65.1 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: 'New', tags: ['2B', 'Vision', 'Q4_K_M', '1.0 GB'], updated: 'New', released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-Omni-2B-GGUF', 'LFM3-Omni-2B-Q4_K_M.gguf'), filename: 'LFM3-Omni-2B-Q4_K_M.gguf', sizeGB: 1.02, sizeBytes: 1099630080, sha256: '9f8d30e9d4fd7a9349d586e077988229b3ca0a0e4ad730897563d1eccc9893e2', ...IMAGE_PART['LiquidAI/LFM3-Omni-2B-GGUF/mmproj-LFM3-Omni-2B-Q8_0.gguf'] },
+ { name: 'LFM3 Omni 2B', group: 'LFM3 Omni 2B', blurb: "text, images and sound in one small model", description: 'Liquid AI LFM3 Omni 2B · text, images and sound in one small model. Chats with image input; in the LU Engine it also hears and speaks (Settings, Voice, "LU Engine" for dictation and read-aloud). The 0.5 GB image and sound part comes with it. Runs in the LU Engine from 3.0.9 (llama.cpp b11960) and in LM Studio with its llama.cpp runtime 2.65.1 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: 'New', tags: ['2B', 'Vision', 'Q4_K_M', '1.0 GB'], updated: 'New', released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-Omni-2B-GGUF', 'LFM3-Omni-2B-Q4_K_M.gguf'), filename: 'LFM3-Omni-2B-Q4_K_M.gguf', sizeGB: 1.02, sizeBytes: 1099630080, sha256: '9f8d30e9d4fd7a9349d586e077988229b3ca0a0e4ad730897563d1eccc9893e2', ...IMAGE_PART['LiquidAI/LFM3-Omni-2B-GGUF/mmproj-LFM3-Omni-2B-Q8_0.gguf'] },
+ { name: 'LFM3 Audio 2B', group: 'LFM3 Audio 2B', blurb: "speech in and out for LU's dictation and read-aloud, 18 languages", description: 'Liquid AI LFM3 Audio 2B · speech recognition, translation and text-to-speech. Load it in the LU Engine and pick "LU Engine" for dictation and read-aloud in Settings, Voice. The 0.3 GB sound part comes with it. Runs in the LU Engine from 3.0.9 (llama.cpp b11960). LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: 'New', tags: ['2B', 'Audio', 'Q4_K_M', '1.0 GB'], updated: 'New', released: '2026-10', downloadUrl: HF('LiquidAI/LFM3-Audio-2B-GGUF', 'LFM3-Audio-2B-Q4_K_M.gguf'), filename: 'LFM3-Audio-2B-Q4_K_M.gguf', sizeGB: 1.02, sizeBytes: 1099626016, sha256: '9a773289bd321ed879cd3a76545f6aca506e403851a45fb315420aee45625be2', ...IMAGE_PART['LiquidAI/LFM3-Audio-2B-GGUF/mmproj-LFM3-Audio-2B-Q8_0.gguf'] },
{ name: 'LFM3 1.7B (Ollama)', group: 'LFM3 1.7B (Ollama)', blurb: "very small, fast model for quick answers, summaries and simple tool calls", description: 'Liquid AI LFM3 1.7B · very small, fast model for quick answers, summaries, extraction and simple tool calls, 256K context. Weaker at long reasoning than 7B+ models. Needs Ollama 0.40.13 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: 'New', tags: ['1.7B', 'Q4_K_M', '1.0 GB', 'Tools'], updated: 'New', agent: true, released: '2026-10', ollamaModel: 'lfm3:1.7b', sizeGB: 1.02 },
{ name: 'LFM3 1.7B (Ollama) NVFP4', group: 'LFM3 1.7B (Ollama)', blurb: "very small, fast model for quick answers, summaries and simple tool calls", description: 'Liquid AI LFM3 1.7B · NVFP4, an MLX build in Ollama made for Apple Silicon Macs. Needs Ollama 0.40.13 or newer. Not officially supported on Windows or Linux, take the Q4_K_M tag there.', pulls: 'New', tags: ['1.7B', 'NVFP4', 'MLX', '1.6 GB', 'Tools'], updated: 'New', agent: true, released: '2026-10', ollamaModel: 'lfm3:1.7b-nvfp4', sizeGB: 1.57 },
{ name: 'LFM3 VL 2B (Ollama)', group: 'LFM3 VL 2B (Ollama)', blurb: "small model with image input: photos, screenshots, documents", description: 'Liquid AI LFM3 VL 2B · LFM3 with image input: describe photos, read screenshots and documents. Small, so expect short and simple answers. Projector included. Needs Ollama 0.40.13 or newer. LFM Open License: commercial use is licensed only below a revenue limit of 10 million a year.', pulls: 'New', tags: ['2B', 'Vision', 'Q4_K_M', '1.4 GB'], updated: 'New', released: '2026-10', ollamaModel: 'lfm3-vl:2b', sizeGB: 1.38 },
diff --git a/src/api/image-parts.ts b/src/api/image-parts.ts
index 71ae06ce..2838db79 100644
--- a/src/api/image-parts.ts
+++ b/src/api/image-parts.ts
@@ -81,6 +81,9 @@ export const IMAGE_PART = {
// halves them. The Omni part carries the audio encoder as well; LU passes
// it as --mmproj and uses it for images.
'LiquidAI/LFM3-VL-2B-GGUF/mmproj-LFM3-VL-2B-Q8_0.gguf': part('LiquidAI/LFM3-VL-2B-GGUF', 'mmproj-LFM3-VL-2B-Q8_0.gguf', 203031872, 'c5c5b58d544a18da919172d2d0368090ea1a4a351b6feb7f8a326a264a5918ab'),
+ // LFM3 Audio's part is an audio encoder only (clip.has_audio_encoder): the
+ // LU Engine hears and speaks with it and reports the model as not seeing.
+ 'LiquidAI/LFM3-Audio-2B-GGUF/mmproj-LFM3-Audio-2B-Q8_0.gguf': part('LiquidAI/LFM3-Audio-2B-GGUF', 'mmproj-LFM3-Audio-2B-Q8_0.gguf', 303811840, '2b6648b1fd48af16aa0877b0592b144d15070783673e038a379fdbc51d40e365'),
'LiquidAI/LFM3-Omni-2B-GGUF/mmproj-LFM3-Omni-2B-Q8_0.gguf': part('LiquidAI/LFM3-Omni-2B-GGUF', 'mmproj-LFM3-Omni-2B-Q8_0.gguf', 506842528, '8a25f9d1931244429de404fccacfb7fb933970a36aa5688d2f5069f29c6b27b1'),
'bartowski/FrogNano-4B-2609-GGUF/mmproj-FrogNano-4B-2609-f16.gguf': part('bartowski/FrogNano-4B-2609-GGUF', 'mmproj-FrogNano-4B-2609-f16.gguf', 672423104, 'e6fba76cf8cd2e2e8793807ee54147c1f5a5209bc4780e53e79878e7c9887020'),
'bartowski/Hcompany_Holo4-35B-A3B-GGUF/mmproj-Hcompany_Holo4-35B-A3B-f16.gguf': part('bartowski/Hcompany_Holo4-35B-A3B-GGUF', 'mmproj-Hcompany_Holo4-35B-A3B-f16.gguf', 899283488, '9fe08693f0ae3c02b3ef76a2762475366c98dcdced879ff90e8258734b5bf6d1'),
diff --git a/src/api/lmstudio.ts b/src/api/lmstudio.ts
index 4f039935..01437166 100644
--- a/src/api/lmstudio.ts
+++ b/src/api/lmstudio.ts
@@ -4,6 +4,7 @@
// The frontend talks only to the bridge, there is no CLI shell-out from the
// browser.
+import { isLfm3Model, lmStudioRuntimeNote } from '../lib/lmstudio-runtime'
import { backendCall } from './backend'
import { callLimit, CallTimeoutError, type CallLimitOptions } from '../lib/call-limit'
import { lmStudioReason } from '../lib/lmstudio-switch'
@@ -153,6 +154,13 @@ export async function loadLmStudioModel(model: string, contextLength?: number, o
// stays somebody else's, and so does one behind a list nobody could read.
ours = window !== null
|| await limit.race(readLoadedLmStudioModels().then((loaded) => !loaded.includes(model), () => false))
+ // N1: LFM3 needs LM Studio's runtime 2.65.1+; an older one fails the load
+ // without saying why, so LU says it first (lib/lmstudio-runtime.ts).
+ if (isLfm3Model(model)) {
+ const runtime = await limit.race(backendCall<string | null>('lmstudio_gguf_runtime').catch(() => null))
+ const note = lmStudioRuntimeNote(model, runtime)
+ if (note) throw new LmStudioSwitchError(note, note)
+ }
limit.signal.addEventListener('abort', endLoad, { once: true })
bridge = backendCall('lmstudio_load_model', {
model,
diff --git a/src/api/voice-session.ts b/src/api/voice-session.ts
index 138b9a42..4c2063e6 100644
--- a/src/api/voice-session.ts
+++ b/src/api/voice-session.ts
@@ -42,6 +42,7 @@ import { TASK_TIME_LIMIT_MS } from './computer-task'
import { COMPUTER_TASK_TOOL_NAME } from '../lib/computer/prompt'
import { COMPUTER_TASK_TOOL } from './computer-task'
import { backendCall, isTauri } from './backend'
+import { voiceSessionSpeech } from './voice-speech'
import { rememberedFolderRefusal } from './agents/workspace-validate'
import { levelInScope, scopePromptLine, scopeRefusal, thinkingBudgetStep, toolInScope } from '../lib/voice/work-scope'
import type { VoiceWork } from '../lib/voice/work-scope'
@@ -626,6 +627,10 @@ export async function startVoiceSession(): Promise<void> {
const hasTask = tools.defs.some((tool) => tool.name === COMPUTER_TASK_TOOL_NAME)
const thinking = thinkingConfig(brain)
+ // N1: hear and speak through LFM3 Audio when Settings, Voice says so.
+ const speech = await voiceSessionSpeech()
+ guard(session)
+
// 4. The connection.
dispatch({ type: 'start-step', step: 'connecting' })
const response = await fetch(`${loop.baseUrl}/session`, {
@@ -647,6 +652,7 @@ export async function startVoiceSession(): Promise<void> {
// keeps them. Without this the first answer waits for that.
prewarm: brain.local,
context_limit_tokens: voiceContextLimit(brain.local),
+ ...speech,
}),
signal: session.abort.signal,
}).catch((error: unknown) => {
diff --git a/src/api/voice-speech.ts b/src/api/voice-speech.ts
new file mode 100644
index 00000000..c2ffeda9
--- /dev/null
+++ b/src/api/voice-speech.ts
@@ -0,0 +1,45 @@
+/**
+ * The ear and the voice of a Voice session, when they are not the voice
+ * loop's own Whisper and Pocket TTS (N1, Liquid LFM3 Audio).
+ *
+ * The same choice as dictation and read-aloud in Settings, Voice: External
+ * HTTP (Ollama with lfm3-audio or lfm3-omni) or the LU Engine with one of
+ * them loaded. The voice loop talks to the service itself, so the LU Engine's
+ * key travels along, handed out by the Rust side for an engine address only
+ * (engine_key.rs), as for the model that answers (voice-brain.ts).
+ */
+import { backendCall } from './backend'
+import { useProviderStore } from '../stores/providerStore'
+import { useVoiceStore } from '../stores/voiceStore'
+import { sttRoute, ttsRoute, type SpeechRoute } from '../lib/speech-route'
+
+export interface SessionSpeechEndpoint {
+ url: string
+ model: string
+ voice?: string
+ api_key?: string
+}
+
+function engineBaseUrl(): string | null {
+ const slot = useProviderStore.getState().providers.openai
+ return slot?.enabled && slot.managed === true ? slot.baseUrl : null
+}
+
+async function endpoint(route: SpeechRoute | null): Promise<SessionSpeechEndpoint | undefined> {
+ if (!route) return undefined
+ const out: SessionSpeechEndpoint = { url: route.url, model: route.model || 'default' }
+ if (route.voice) out.voice = route.voice
+ if (route.engine) {
+ const key = await backendCall<string | null>('engine_key_for', { url: route.url }).catch(() => null)
+ if (key) out.api_key = key
+ }
+ return out
+}
+
+/** `stt` and `tts` for the POST /session body; absent keys keep the loop's own models. */
+export async function voiceSessionSpeech(): Promise<{ stt?: SessionSpeechEndpoint; tts?: SessionSpeechEndpoint }> {
+ const s = useVoiceStore.getState()
+ const base = engineBaseUrl()
+ const [stt, tts] = await Promise.all([endpoint(sttRoute(s, base)), endpoint(ttsRoute(s, base))])
+ return { ...(stt ? { stt } : {}), ...(tts ? { tts } : {}) }
+}
diff --git a/src/components/chat/SpeakerButton.tsx b/src/components/chat/SpeakerButton.tsx
index 9a27c1d3..0b283e0a 100644
--- a/src/components/chat/SpeakerButton.tsx
+++ b/src/components/chat/SpeakerButton.tsx
@@ -13,7 +13,7 @@ export function SpeakerButton({ text }: Props) {
// Jaeger B, B11: when the external voice fails, read-aloud switches to the
// system voice. The bubble whose button was pressed says so, with the
// error, instead of speaking in another voice without a word.
- const fallbackReason = useVoiceStore((s) => (s.ttsMode === "external" ? s.ttsFallbackReason : null))
+ const fallbackReason = useVoiceStore((s) => (s.ttsMode !== "piper" ? s.ttsFallbackReason : null))
const [pressed, setPressed] = useState(false)
// Show the read-aloud button only when the feature is on AND some TTS engine
diff --git a/src/components/models/DiscoverModels.tsx b/src/components/models/DiscoverModels.tsx
index 184af7fb..0d7ecd9f 100644
--- a/src/components/models/DiscoverModels.tsx
+++ b/src/components/models/DiscoverModels.tsx
@@ -24,7 +24,8 @@ import { getTotalRamGb } from '../../lib/hardware'
import { vramFit } from '../../lib/vram-fit'
import { chatModelBudgetGb, sharedMemoryWording } from '../../lib/shared-memory-wording'
import { useGraphicsMemoryGb } from '../../hooks/useGraphicsMemory'
-import { openExternal, isMacOS } from '../../api/backend'
+import { openExternal, isMacOS, backendCall } from '../../api/backend'
+import { isLfm3Model, lmStudioRuntimeNote } from '../../lib/lmstudio-runtime'
import { bundleCloudTask } from '../../lib/cloud-offer'
import { forThisPlatform } from '../../lib/mlx-only-builds'
import { useModels } from '../../hooks/useModels'
@@ -43,6 +44,7 @@ import { LuEngineSwitchBar } from '../chat/LuEngineSwitchBar'
import { ollamaOnlyDownloadBlock, resolveTextDownloadTarget } from '../../lib/text-download-target'
import { mayBeStartHerePick } from '../../lib/start-here-picks'
import { modelInfoTitle } from '../../lib/model-info-title'
+import { partInputWord } from '../../lib/image-part'
import { hfUrlToOllamaRef, hfUrlToLmStudioSubdir, parseHfUrl, isShardedOrIncompatibleGguf } from '../../lib/hf-to-provider'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { Modal } from '../ui/Modal'
@@ -752,6 +754,15 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
if (!model.downloadUrl || !model.filename) return
setInstallNotice(null)
+ // N1: an LFM3 GGUF for LM Studio needs its runtime 2.65.1+. Said before
+ // the download, which still runs: the file is right, the runtime is old.
+ if (isActiveLmStudio && isLfm3Model(model.filename)) {
+ void backendCall<string | null>('lmstudio_gguf_runtime').catch(() => null).then((runtime) => {
+ const note = lmStudioRuntimeNote(model.filename!, runtime)
+ if (note) setInstallNotice(note)
+ })
+ }
+
// Resolve the REAL file(s) on HuggingFace before downloading. The curated /
// search-derived (url, filename) is only a *guess* — the repo may host the
// quant in a subfolder, split it into multiple parts, or not have that
@@ -879,7 +890,7 @@ export function DiscoverModels({ category, search = '', searchSubmitToken = 0 }:
])
if (both && !both.fits && alone?.fits) {
withPart = false
- setInstallNotice(`${model.name} is downloading without image input: the drive has no room for the extra ${gbOf(part.sizeBytes)} GB. You can add it later under Installed.`)
+ setInstallNotice(`${model.name} is downloading without ${partInputWord(model)}: the drive has no room for the extra ${gbOf(part.sizeBytes)} GB. You can add it later under Installed.`)
}
}
const plan = planModelDownload(model, realUrl, realName, realBytes, single?.sha256, { part, withImagePart: withPart })
diff --git a/src/components/models/ModelTiles.tsx b/src/components/models/ModelTiles.tsx
index 40470f9c..6260ae56 100644
--- a/src/components/models/ModelTiles.tsx
+++ b/src/components/models/ModelTiles.tsx
@@ -13,6 +13,7 @@ import {
import type { LucideIcon } from 'lucide-react'
import type { DiscoverModel, DownloadProgress, ModelBundle } from '../../api/discover'
import { formatBytes, countLabel } from '../../lib/formatters'
+import { partInputWord } from '../../lib/image-part'
import { vramFit, vramFitLine, vramNeedTitle, type VramFit } from '../../lib/vram-fit'
import { sharedFitWords, sharedMemoryWording } from '../../lib/shared-memory-wording'
import { tierMarks } from '../../lib/render/model-tier'
@@ -466,7 +467,7 @@ export function useModelTile({ variants, vramGb, isInstalled, dlState, onUse, ca
const downloadTitle = !selSize
? 'Download'
: partComes
- ? `Download ${selSize} GB (model ${sel.sizeGB} GB, image input ${gbOf(sel.mmprojBytes)} GB)`
+ ? `Download ${selSize} GB (model ${sel.sizeGB} GB, ${partInputWord(sel)} ${gbOf(sel.mmprojBytes)} GB)`
: `Download ${selSize} GB`
return { pickerOpen, setPickerOpen, setChosen, pickerRef, variantListRef, variantList, sel, groupTitle, dl, downloading, fit, action, sizeOf, selSize, downloadTitle }
diff --git a/src/components/models/__tests__/das-raster-zaehlt-seine-knoten.test.ts b/src/components/models/__tests__/das-raster-zaehlt-seine-knoten.test.ts
index 0e3d4f34..87f4115d 100644
--- a/src/components/models/__tests__/das-raster-zaehlt-seine-knoten.test.ts
+++ b/src/components/models/__tests__/das-raster-zaehlt-seine-knoten.test.ts
@@ -141,7 +141,8 @@ describe('D-S26 · was das Raster wirklich kostet', () => {
// oben traegt weiter: 54 liegt am unteren Ende.
// 54 -> 57 am selben Tag, nach E1 (llama.cpp b11960): LFM3 1.7B, VL 2B
// und Omni 2B auch als GGUF-Gruppen fuer LU Engine und LM Studio.
- expect(messeReiter(getMainstreamTextModels()).kacheln).toBe(57)
+ // 57 -> 58: LFM3 Audio 2B als GGUF, seit die LU Engine damit hoert und spricht.
+ expect(messeReiter(getMainstreamTextModels()).kacheln).toBe(58)
//
// 56 -> 57 am 05.09.2026, vierte Bewegung. Der Inhaber: „orcarouter ist ein
// muss." Die sechs Qwen-3.8-27B-Uncensored-Quants zeigen jetzt auf
diff --git a/src/components/settings/SpeechSettings.tsx b/src/components/settings/SpeechSettings.tsx
index 3ee77325..89388595 100644
--- a/src/components/settings/SpeechSettings.tsx
+++ b/src/components/settings/SpeechSettings.tsx
@@ -299,7 +299,7 @@ export function SpeechSettings() {
<p className={`text-[0.55rem] leading-snug ${HINWEIS_TEXT.fehler}`}>{whisper.installError}</p>
)}
{/* N1: with an external dictation engine faster-whisper is not required. */}
- {showsHint(whisper) && voiceSettings.sttMode !== 'external' && (
+ {showsHint(whisper) && voiceSettings.sttMode === 'whisper' && (
<p className="text-[0.55rem] text-gray-500 leading-snug">
Required for the microphone. Installs faster-whisper into LU's Python; first run also downloads a small model.
</p>
@@ -310,9 +310,10 @@ export function SpeechSettings() {
<EngineSwitch
label="Dictation"
value={voiceSettings.sttMode}
- options={[['whisper', 'faster-whisper'], ['external', 'External HTTP']]}
+ options={[['whisper', 'faster-whisper'], ['external', 'External HTTP'], ['engine', 'LU Engine']]}
onPick={(m) => voiceSettings.updateVoiceSettings({ sttMode: m })}
/>
+ {voiceSettings.sttMode === 'engine' && <EngineSpeechNote what="hears" />}
{voiceSettings.sttMode === 'external' && (
<div className="space-y-1.5">
<SettingInput value={voiceSettings.externalSttUrl} onChange={(v) => voiceSettings.updateVoiceSettings({ externalSttUrl: v })} placeholder="http://localhost:11434/v1/audio/transcriptions" />
@@ -404,7 +405,7 @@ export function SpeechSettings() {
<div className="flex items-center justify-between gap-2 pt-1">
<span className="text-[0.7rem] text-gray-500">Engine</span>
<div className="flex items-center gap-1 text-[0.6rem]">
- {(['piper', 'external'] as const).map((m) => (
+ {(['piper', 'external', 'engine'] as const).map((m) => (
<button
key={m}
onClick={() => voiceSettings.updateVoiceSettings({ ttsMode: m })}
@@ -420,11 +421,19 @@ export function SpeechSettings() {
: 'text-gray-500 border-white/8 hover:text-gray-300')
}
>
- {m === 'piper' ? 'Piper neural' : 'External HTTP'}
+ {m === 'piper' ? 'Piper neural' : m === 'external' ? 'External HTTP' : 'LU Engine'}
</button>
))}
</div>
</div>
+ {voiceSettings.ttsMode === 'engine' && (
+ <div className="space-y-1.5">
+ <EngineSpeechNote what="speaks" />
+ {voiceSettings.ttsFallbackReason && (
+ <p className={`t-micro leading-snug ${HINWEIS_TEXT.fehler}`}>{voiceSettings.ttsFallbackReason}</p>
+ )}
+ </div>
+ )}
{voiceSettings.ttsMode === 'external' && (
<div className="space-y-1.5">
<input
@@ -504,3 +513,12 @@ function EngineSwitch<T extends string>({ label, value, options, onPick }: { lab
</div>
)
}
+
+/** N1: what "LU Engine" means for speech. The engine runs one model, the chat model. */
+function EngineSpeechNote({ what }: { what: 'hears' | 'speaks' }) {
+ return (
+ <p className="t-micro text-gray-500 leading-snug">
+ The LU Engine {what} with the model it has loaded, so that model must take sound: LFM3 Audio or LFM3 Omni (get them in Models). Chat with it in the LU Engine, and dictation and read-aloud use the same model. Nothing is installed.
+ </p>
+ )
+}
diff --git a/src/hooks/__tests__/lfm3-audio-spricht-und-hoert.dom.test.tsx b/src/hooks/__tests__/lfm3-audio-spricht-und-hoert.dom.test.tsx
index 78a9d6b1..d3e66cf1 100644
--- a/src/hooks/__tests__/lfm3-audio-spricht-und-hoert.dom.test.tsx
+++ b/src/hooks/__tests__/lfm3-audio-spricht-und-hoert.dom.test.tsx
@@ -121,6 +121,20 @@ describe('Einstellungen: ein Klick traegt LFM3 Audio in Ollama ein', () => {
})
})
+ it('Diktat und Vorlesen bieten die LU Engine an und sagen, welches Modell sie dort braucht', async () => {
+ backend.tauri.on = false
+ backend.backendCall.mockImplementation(async (cmd: string) => (cmd === 'installed_piper_voices' ? [] : { available: false }))
+ vi.stubGlobal('fetch', vi.fn(async () => new Response(JSON.stringify({ available: false, backend: null }), { status: 200 })))
+ render(createElement(SpeechSettings))
+ const engine = screen.getAllByRole('button', { name: 'LU Engine' })
+ expect(engine).toHaveLength(2)
+ for (const b of engine) await act(async () => { fireEvent.click(b) })
+ expect(useVoiceStore.getState()).toMatchObject({ sttMode: 'engine', ttsMode: 'engine' })
+ expect(screen.getAllByText(/LFM3 Audio or LFM3 Omni/).length).toBe(2)
+ expect(screen.queryByText(/Required for the microphone/)).toBeNull()
+ vi.unstubAllGlobals()
+ })
+
it('mit externem Diktat sagt die Seite nicht mehr, faster-whisper sei noetig', async () => {
backend.tauri.on = false
backend.backendCall.mockImplementation(async (cmd: string) => (cmd === 'installed_piper_voices' ? [] : { available: false }))
diff --git a/src/hooks/__tests__/mobile-voice.test.ts b/src/hooks/__tests__/mobile-voice.test.ts
index 42601fd8..5dcf8313 100644
--- a/src/hooks/__tests__/mobile-voice.test.ts
+++ b/src/hooks/__tests__/mobile-voice.test.ts
@@ -316,7 +316,8 @@ describe('read-aloud on a phone', () => {
const speak = hookSource.slice(hookSource.indexOf('const speakInternal = useCallback('))
expect(speak).toMatch(/async \(text: string, streaming: boolean\) => \{\s*\/\/[^\n]*\n\s*\/\/[^\n]*\n\s*if \(!hasLocalVoice\(\)\) return speakOnPhone\(text, streaming, cloudVoice\);\s*if \(!store\.ttsEnabled\) return;/)
// The desktop road still knows its three engines.
- expect(speak).toContain('synthesizeExternal(text, store.externalTtsUrl.trim()')
+ // N1: the external road resolves its address first (External HTTP or LU Engine).
+ expect(speak).toContain('synthesizeExternal(text, ttsExt!.url')
expect(speak).toContain('piperReady = await recheckTtsAvailable(store.piperVoice);')
expect(speak).toContain('"Piper is installed but not responding, so read-aloud used the system voice instead."')
})
diff --git a/src/hooks/useVoice.ts b/src/hooks/useVoice.ts
index 749c959d..36dc0797 100644
--- a/src/hooks/useVoice.ts
+++ b/src/hooks/useVoice.ts
@@ -2,6 +2,8 @@ import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
import { useVoiceStore } from "../stores/voiceStore";
import { useSettingsStore } from "../stores/settingsStore";
import { useCloudAuthStore, deriveCloudAvailable } from "../stores/cloudAuthStore";
+import { useProviderStore } from "../stores/providerStore";
+import { sttRoute, ttsRoute, speechRefusalText, type SpeechRoute } from "../lib/speech-route";
import {
recheckWhisperAvailable,
recheckTtsAvailable,
@@ -116,15 +118,24 @@ export function sttErrorMessage(err: unknown): string {
* nothing to transcribe with, so it says so instead of calling a local
* Whisper that does not exist there.
*/
+/** The managed LU Engine's `…/v1` base, or null when the slot is not the LU Engine. */
+function engineBaseUrl(): string | null {
+ const slot = useProviderStore.getState().providers.openai;
+ return slot?.enabled && slot.managed === true ? slot.baseUrl : null;
+}
+
/**
- * The external speech-to-text endpoint, when it is chosen and complete (N1).
- * Half filled in is not chosen: dictation stays on faster-whisper then, as it
- * was before the switch existed.
+ * Where dictation goes when it does not use faster-whisper (N1): an external
+ * OpenAI-compatible service or the LU Engine. Half filled in is not chosen:
+ * dictation stays on faster-whisper then, as it was before the switch existed.
*/
-export function externalStt(s: { sttMode: string; externalSttUrl: string; externalSttModel: string }): { url: string; model: string } | null {
- const url = s.externalSttUrl.trim();
- const model = s.externalSttModel.trim();
- return s.sttMode === "external" && url && model ? { url, model } : null;
+export function externalStt(s: Parameters<typeof sttRoute>[0]): SpeechRoute | null {
+ return sttRoute(s, engineBaseUrl());
+}
+
+/** Where read-aloud goes when it does not use Piper (N1), or null. */
+export function externalTts(s: Parameters<typeof ttsRoute>[0]): SpeechRoute | null {
+ return ttsRoute(s, engineBaseUrl());
}
export async function transcribeTake(blob: Blob, cloudVoice: boolean): Promise<string> {
@@ -154,7 +165,10 @@ export async function transcribeTake(blob: Blob, cloudVoice: boolean): Promise<s
const ext = externalStt(store);
const transcript = cloudVoice
? await transcribeAudioCloud(blob)
- : ext ? await transcribeExternal(blob, ext.url, ext.model) : await transcribeAudio(blob);
+ : ext ? await transcribeExternal(blob, ext.url, ext.model).catch((err: unknown) => {
+ const refusal = speechRefusalText(err instanceof Error ? err.message : String(err), ext);
+ throw refusal ? refusal : err;
+ }) : await transcribeAudio(blob);
discardFailedTake();
store.setTranscript(transcript);
// A silent take is not an error, but it must not be silence in the UI
@@ -661,7 +675,7 @@ export function useVoice() {
// External HTTP TTS engine configured + selected (#58). Lets the read-aloud
// button light up even on a machine without Piper or browser voices.
- const ttsExternalReady = store.ttsMode === "external" && !!store.externalTtsUrl.trim();
+ const ttsExternalReady = externalTts(store) !== null;
// Re-probe Whisper on demand (mic mount / after install) and sync the store.
const recheckStt = useCallback(async (): Promise<boolean> => {
@@ -841,7 +855,8 @@ export function useVoice() {
// An external HTTP engine (#58) needs a configured URL; Piper needs to be
// installed; the browser path needs SpeechSynthesis; cloud mode brings
// its own hosted engine. Bail only if none of them can speak.
- const externalReady = store.ttsMode === "external" && !!store.externalTtsUrl.trim();
+ const ttsExt = externalTts(store);
+ const externalReady = ttsExt !== null;
if (!cloudVoice && !externalReady && !store.ttsAvailable && !ttsSupported) return;
const gen = ++speakGen;
@@ -883,7 +898,7 @@ export function useVoice() {
// External HTTP TTS engine takes precedence when selected + configured.
if (externalReady) {
try {
- const url = await synthesizeExternal(text, store.externalTtsUrl.trim(), store.externalTtsVoice || undefined, store.externalTtsModel || undefined);
+ const url = await synthesizeExternal(text, ttsExt!.url, ttsExt!.voice, ttsExt!.model || undefined);
if (stopped()) return;
await playNeuralAudio(url);
store.setTtsFallbackReason(null);
@@ -894,7 +909,8 @@ export function useVoice() {
// Jaeger B, B11: the same silent switch as Piper had (#77). Who
// set up an own voice heard another one and was told nothing.
// The reason is shown at the Read aloud button and in Settings.
- store.setTtsFallbackReason(externalTtsFallbackReason(err, ttsSupported));
+ const refusal = speechRefusalText(String(err instanceof Error ? err.message : err), ttsExt);
+ store.setTtsFallbackReason(refusal ?? externalTtsFallbackReason(err, ttsSupported));
}
} else {
// Local neural (Piper). Trust the cached availability flag, but if it
@@ -903,7 +919,7 @@ export function useVoice() {
// permanently silence Piper (#77). A positive re-probe is
// written back to the store so later reads skip straight to Piper.
let piperReady = store.ttsAvailable;
- if (!piperReady && lazyTtsReprobes < MAX_LAZY_TTS_REPROBES && store.ttsMode !== "external") {
+ if (!piperReady && lazyTtsReprobes < MAX_LAZY_TTS_REPROBES && store.ttsMode === "piper") {
lazyTtsReprobes++;
piperReady = await recheckTtsAvailable(store.piperVoice);
if (stopped()) return;
@@ -926,7 +942,7 @@ export function useVoice() {
`Piper failed to speak (${err instanceof Error ? err.message : String(err)}). Read-aloud used the system voice instead.`,
);
}
- } else if (store.ttsMode !== "external") {
+ } else if (store.ttsMode === "piper") {
// Say which of the three things is actually missing. The old text
// asserted "installed but not responding" for all of them, so a
// user who had never set Piper up was sent looking for a fault
diff --git a/src/lib/__tests__/chat-model-minimum.test.ts b/src/lib/__tests__/chat-model-minimum.test.ts
index b919cc46..a3447520 100644
--- a/src/lib/__tests__/chat-model-minimum.test.ts
+++ b/src/lib/__tests__/chat-model-minimum.test.ts
@@ -41,7 +41,8 @@ describe('chat catalog minimum', () => {
// each as Ollama tag and as MLX NVFP4 build.
// 40 -> 46 the same day, after E1: six LFM3 GGUF rows (1.7B Q4_K_M, QAD
// Q4_0, Q8_0; VL Q4_K_M, Q8_0; Omni Q4_K_M).
- expect(small.length).toBe(46)
+ // 46 -> 47: LFM3 Audio 2B GGUF, once the LU Engine heard and spoke with it.
+ expect(small.length).toBe(47)
const picks = chatRecommendationGroups(models.map(model => [model]))
expect(picks.flat().some(isBelowChatMinimum)).toBe(false)
expect(picks.length).toBe(models.length - small.length)
diff --git a/src/lib/__tests__/part-input-word.test.ts b/src/lib/__tests__/part-input-word.test.ts
new file mode 100644
index 00000000..ff81e016
--- /dev/null
+++ b/src/lib/__tests__/part-input-word.test.ts
@@ -0,0 +1,18 @@
+/** N1: LFM3 Audio's part is a sound part; the Get button said "image input". */
+import { describe, expect, it } from 'vitest'
+import { partInputWord } from '../image-part'
+import { getMainstreamTextModels } from '../../api/discover'
+
+describe('was der Teil neben dem Modell tut', () => {
+ it('Audio ohne Vision ist Toneingang, alles andere bleibt Bildeingang', () => {
+ expect(partInputWord({ tags: ['2B', 'Audio'] })).toBe('sound input')
+ expect(partInputWord({ tags: ['2B', 'Vision', 'Audio'] })).toBe('image input')
+ expect(partInputWord({ tags: ['27B', 'Vision'] })).toBe('image input')
+ expect(partInputWord({})).toBe('image input')
+ })
+
+ it('der Katalogeintrag LFM3 Audio 2B (GGUF) heisst Toneingang', () => {
+ const audio = getMainstreamTextModels().find((m) => m.filename === 'LFM3-Audio-2B-Q4_K_M.gguf')!
+ expect(partInputWord(audio)).toBe('sound input')
+ })
+})
diff --git a/src/lib/__tests__/speech-route.test.ts b/src/lib/__tests__/speech-route.test.ts
new file mode 100644
index 00000000..623cba46
--- /dev/null
+++ b/src/lib/__tests__/speech-route.test.ts
@@ -0,0 +1,53 @@
+/**
+ * N1, 30.10.2026: dictation and read-aloud through LFM3 Audio, in Ollama or
+ * in the LU Engine. Measured on the Mac with llama-server b11960 and
+ * LFM3-Audio-2B: /v1/audio/transcriptions answers {"text": ...}, /tts answers
+ * a WAV for the body read-aloud sends, /v1/audio/speech is 404 there. A model
+ * without sound answers 501 "The current model does not support audio input."
+ * and "this server does not support audio generation".
+ */
+import { describe, expect, it } from 'vitest'
+import { engineSpeechUrls, speechRefusalText, sttRoute, ttsRoute } from '../speech-route'
+
+const leer = { sttMode: 'whisper', externalSttUrl: '', externalSttModel: '', ttsMode: 'piper', externalTtsUrl: '', externalTtsModel: '', externalTtsVoice: '' }
+
+describe('LU Engine', () => {
+ it('hoert an /v1/audio/transcriptions und spricht an /tts, auf dem Port, auf dem die Engine gerade laeuft', () => {
+ expect(engineSpeechUrls('http://127.0.0.1:8129/v1')).toEqual({
+ stt: 'http://127.0.0.1:8129/v1/audio/transcriptions',
+ tts: 'http://127.0.0.1:8129/tts',
+ })
+ expect(sttRoute({ ...leer, sttMode: 'engine' }, 'http://127.0.0.1:8127/v1/')).toMatchObject({ url: 'http://127.0.0.1:8127/v1/audio/transcriptions', engine: true })
+ expect(ttsRoute({ ...leer, ttsMode: 'engine' }, 'http://127.0.0.1:8127/v1')).toMatchObject({ url: 'http://127.0.0.1:8127/tts', engine: true })
+ })
+
+ it('ohne LU Engine im Slot gibt es keinen Weg dorthin', () => {
+ expect(sttRoute({ ...leer, sttMode: 'engine' }, null)).toBeNull()
+ expect(ttsRoute({ ...leer, ttsMode: 'engine' }, '')).toBeNull()
+ })
+})
+
+describe('External HTTP', () => {
+ it('nimmt Adresse, Modell und Stimme, wie eingetragen', () => {
+ expect(ttsRoute({ ...leer, ttsMode: 'external', externalTtsUrl: ' http://localhost:11434/v1/audio/speech ', externalTtsModel: 'lfm3-audio:2b' }, null))
+ .toEqual({ url: 'http://localhost:11434/v1/audio/speech', model: 'lfm3-audio:2b', voice: undefined, engine: false })
+ expect(sttRoute({ ...leer, sttMode: 'external', externalSttUrl: 'http://x/v1/audio/transcriptions', externalSttModel: '' }, null)).toBeNull()
+ })
+
+ it('Whisper und Piper bleiben Whisper und Piper', () => {
+ expect(sttRoute(leer, 'http://127.0.0.1:8127/v1')).toBeNull()
+ expect(ttsRoute(leer, 'http://127.0.0.1:8127/v1')).toBeNull()
+ })
+})
+
+describe('ein Modell ohne Ton', () => {
+ const engine = sttRoute({ ...leer, sttMode: 'engine' }, 'http://127.0.0.1:8127/v1')
+ it('die echte Absage von llama-server wird zu einem Satz mit Ausweg', () => {
+ const satz = speechRefusalText('speech-to-text HTTP 501 from lu-engine: {"error":{"code":501,"message":"The current model does not support audio input."}}', engine)
+ expect(satz).toContain('LFM3 Audio or LFM3 Omni in the LU Engine')
+ expect(speechRefusalText('external TTS HTTP 501: {"error":{"message":"this server does not support audio generation"}}', engine)).toContain('takes no sound')
+ })
+ it('andere Fehler bleiben, wie sie sind', () => {
+ expect(speechRefusalText('speech-to-text HTTP 404 from lfm3-audio:2b: model not found', engine)).toBeNull()
+ })
+})
diff --git a/src/lib/image-part.ts b/src/lib/image-part.ts
index f122cf32..b14e6f95 100644
--- a/src/lib/image-part.ts
+++ b/src/lib/image-part.ts
@@ -38,6 +38,17 @@ export function imagePartFileName(modelFilename: string): string {
return `${stem}.mmproj.gguf`
}
+/**
+ * What the part beside the model does, in the words a tile uses. Most parts
+ * are image parts; LFM3 Audio's carries only an audio encoder (N1, the
+ * projector's head says `clip.has_audio_encoder`), and the catalog marks such
+ * an entry with the tag "Audio" and without "Vision".
+ */
+export function partInputWord(model: { tags?: string[] }): 'image input' | 'sound input' {
+ const tags = model.tags ?? []
+ return tags.includes('Audio') && !tags.includes('Vision') ? 'sound input' : 'image input'
+}
+
/** True for the on-disk name of an image part. */
export function isImagePartFile(filename: string): boolean {
return /\.mmproj\.gguf$/i.test(filename)
diff --git a/src/lib/lmstudio-runtime.ts b/src/lib/lmstudio-runtime.ts
new file mode 100644
index 00000000..b085ec96
--- /dev/null
+++ b/src/lib/lmstudio-runtime.ts
@@ -0,0 +1,33 @@
+/**
+ * Does LM Studio's llama.cpp runtime load this model (N1, 30.10.2026).
+ *
+ * Liquid LFM3 needs LM Studio's llama.cpp runtime 2.65.1 or newer (model card
+ * of LiquidAI/LFM3-1.7B-GGUF). The Mac this was written on had 2.55.0, where
+ * the load fails without a word about why. LU reads the runtime LM Studio uses
+ * (command lmstudio_gguf_runtime, read only) and says what to do before it
+ * asks LM Studio for a load that cannot work. Unknown runtime: nothing said.
+ */
+
+export const LFM3_LMSTUDIO_RUNTIME = '2.65.1'
+
+/** -1, 0 or 1 for two dotted versions, numbers compared part by part. */
+export function compareVersions(a: string, b: string): number {
+ const pa = a.split('.').map((n) => parseInt(n, 10) || 0)
+ const pb = b.split('.').map((n) => parseInt(n, 10) || 0)
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
+ const d = (pa[i] ?? 0) - (pb[i] ?? 0)
+ if (d !== 0) return d < 0 ? -1 : 1
+ }
+ return 0
+}
+
+export function isLfm3Model(modelId: string): boolean {
+ return /(^|[^a-z0-9])lfm3([^a-z0-9]|$)/i.test(modelId)
+}
+
+/** The sentence for an LFM3 model on a runtime that is too old, or null. */
+export function lmStudioRuntimeNote(modelId: string, runtime: string | null | undefined): string | null {
+ if (!isLfm3Model(modelId) || !runtime || !/^\d+(\.\d+)*$/.test(runtime)) return null
+ if (compareVersions(runtime, LFM3_LMSTUDIO_RUNTIME) >= 0) return null
+ return `Update LM Studio's runtime to ${LFM3_LMSTUDIO_RUNTIME} or newer for LFM3. LM Studio runs llama.cpp ${runtime}, which cannot load this model. In LM Studio: Settings, Runtime.`
+}
diff --git a/src/lib/speech-route.ts b/src/lib/speech-route.ts
new file mode 100644
index 00000000..2e700377
--- /dev/null
+++ b/src/lib/speech-route.ts
@@ -0,0 +1,89 @@
+/**
+ * Where dictation and read-aloud go when they do not use LU's own engines
+ * (faster-whisper, Piper, the voice loop's Whisper and Pocket TTS).
+ *
+ * N1, 30.10.2026, Liquid LFM3 Audio / Omni. Two kinds of service hear and
+ * speak with them, and both answer the same two requests:
+ *
+ * - "External HTTP": any OpenAI-compatible service the user named, e.g.
+ * Ollama 0.40.13+ at /v1/audio/transcriptions and /v1/audio/speech.
+ * - "LU Engine": llama-server b11960 with LFM3 Audio or Omni loaded. It
+ * transcribes at /v1/audio/transcriptions and speaks at /tts, a WAV for
+ * the same JSON body (measured on the Mac with E1's build). Its address is
+ * read at the moment of use from the managed engine slot, because the
+ * engine moves to the next free port when 8127 is taken.
+ *
+ * Pure on purpose: which address a take goes to is the part to get right.
+ */
+
+export type SttMode = 'whisper' | 'external' | 'engine'
+export type TtsMode = 'piper' | 'external' | 'engine'
+
+export interface SpeechRoute {
+ url: string
+ model: string
+ /** Empty: the service speaks in the model's own voice. */
+ voice?: string
+ /** True for the LU Engine: the request needs the engine key. */
+ engine: boolean
+}
+
+export interface SpeechSettings {
+ sttMode: string
+ externalSttUrl: string
+ externalSttModel: string
+ ttsMode: string
+ externalTtsUrl: string
+ externalTtsModel: string
+ externalTtsVoice: string
+}
+
+/** llama-server answers any model name; this one names the slot in its log. */
+export const ENGINE_SPEECH_MODEL = 'lu-engine'
+
+/** The managed engine's `…/v1` base without the `/v1`. */
+function engineRoot(engineBaseUrl: string | null | undefined): string | null {
+ const b = (engineBaseUrl ?? '').trim().replace(/\/+$/, '')
+ return b ? b.replace(/\/v1$/, '') : null
+}
+
+export function engineSpeechUrls(engineBaseUrl: string): { stt: string; tts: string } | null {
+ const root = engineRoot(engineBaseUrl)
+ return root ? { stt: `${root}/v1/audio/transcriptions`, tts: `${root}/tts` } : null
+}
+
+/** Dictation's route, or null for faster-whisper (also when half filled in). */
+export function sttRoute(s: Pick<SpeechSettings, 'sttMode' | 'externalSttUrl' | 'externalSttModel'>, engineBaseUrl: string | null | undefined): SpeechRoute | null {
+ if (s.sttMode === 'engine') {
+ const urls = engineSpeechUrls(engineBaseUrl ?? '')
+ return urls ? { url: urls.stt, model: ENGINE_SPEECH_MODEL, engine: true } : null
+ }
+ const url = s.externalSttUrl.trim()
+ const model = s.externalSttModel.trim()
+ return s.sttMode === 'external' && url && model ? { url, model, engine: false } : null
+}
+
+/** Read-aloud's route, or null for Piper. */
+export function ttsRoute(s: Pick<SpeechSettings, 'ttsMode' | 'externalTtsUrl' | 'externalTtsModel' | 'externalTtsVoice'>, engineBaseUrl: string | null | undefined): SpeechRoute | null {
+ if (s.ttsMode === 'engine') {
+ const urls = engineSpeechUrls(engineBaseUrl ?? '')
+ return urls ? { url: urls.tts, model: ENGINE_SPEECH_MODEL, engine: true } : null
+ }
+ const url = s.externalTtsUrl.trim()
+ if (s.ttsMode !== 'external' || !url) return null
+ return { url, model: s.externalTtsModel.trim(), voice: s.externalTtsVoice.trim() || undefined, engine: false }
+}
+
+/**
+ * The sentence for a service that does not take sound. llama-server answers a
+ * take with HTTP 400/500 when the loaded model has no audio encoder; Ollama
+ * with "does not support audio". Said in LU's words, with the way out.
+ */
+export function speechRefusalText(message: string, route: SpeechRoute | null): string | null {
+ const m = message.toLowerCase()
+ const noAudio = /audio/.test(m) && /(not supported|does not support|no audio|unsupported|not enabled|multimodal)/.test(m)
+ if (!noAudio) return null
+ return route?.engine
+ ? 'The model in the LU Engine takes no sound. Load LFM3 Audio or LFM3 Omni in the LU Engine, or use LFM3 Audio in Ollama (Settings, Voice).'
+ : 'This model takes no sound. Pick LFM3 Audio or LFM3 Omni for speech (Settings, Voice).'
+}
diff --git a/src/stores/voiceStore.ts b/src/stores/voiceStore.ts
index 8d45927c..79e7978f 100644
--- a/src/stores/voiceStore.ts
+++ b/src/stores/voiceStore.ts
@@ -1,3 +1,4 @@
+import type { SttMode, TtsMode } from "../lib/speech-route";
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { safeJSONStorage } from "../lib/storage-quota"
@@ -54,7 +55,7 @@ interface VoiceState {
ttsPitch: number;
/** TTS engine: bundled Piper (local) or a user-configured external HTTP
* endpoint (OpenAI-compatible, e.g. Kokoro-FastAPI) — GitHub #58. */
- ttsMode: "piper" | "external";
+ ttsMode: TtsMode;
/** External TTS endpoint URL, e.g. http://localhost:8880/v1/audio/speech. */
externalTtsUrl: string;
/** Voice name passed to the external engine (e.g. "af_bella" / "alloy"). */
@@ -62,10 +63,11 @@ interface VoiceState {
/** Model name for the external TTS engine; empty sends OpenAI's "tts-1".
* Ollama needs its own name here, e.g. "lfm3-audio:2b" (N1). */
externalTtsModel: string;
- /** Speech-to-text engine for dictation: the local faster-whisper, or an
+ /** Speech-to-text engine for dictation: the local faster-whisper, an
* OpenAI-compatible /v1/audio/transcriptions endpoint such as Ollama
- * serving LFM3 Audio (N1). */
- sttMode: "whisper" | "external";
+ * serving LFM3 Audio, or the LU Engine with LFM3 Audio/Omni loaded (N1,
+ * lib/speech-route.ts). */
+ sttMode: SttMode;
/** External STT endpoint, e.g. http://localhost:11434/v1/audio/transcriptions. */
externalSttUrl: string;
/** Model the external STT endpoint transcribes with, e.g. "lfm3-audio:2b". */
@@ -112,11 +114,11 @@ interface VoiceState {
ttsVoice: string;
ttsRate: number;
ttsPitch: number;
- ttsMode: "piper" | "external";
+ ttsMode: TtsMode;
externalTtsUrl: string;
externalTtsVoice: string;
externalTtsModel: string;
- sttMode: "whisper" | "external";
+ sttMode: SttMode;
externalSttUrl: string;
externalSttModel: string;
cloudTtsVoice: string;