Repository navigation
Phase 1 host: local dictation, translation and respond mode - #2
aliparchekan wants to merge 1 commit into
Conversation
host/sessions: voice-session API (/v1/dictate, /v1/translate, /v1/respond, WebSocket stream)
- dictation with a clean-up gate (LLM only when there are fillers or repeats)
- spoken and typed translation
- respond mode (Voxt-style ask/rewrite) with streamed answers and follow-ups;
weather and Wikipedia tools are opt-in (OPENVOICE_TOOLS=1)
host/router: per-stage model routes from the environment (accurate/fast ASR, LLM, translation)
host/workers: start_local.sh (vllm-metal servers + host), 4-bit ASR quantizer, MLX cache cap
client/demo: test page (hold-to-talk, hands-free, streaming conversation)
docs: reference, integrating, demo run sheet, OpenAPI, and the phase-1 subsystem docs
ci: run the host tests (backends faked; no models needed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| @app.get("/v1/capabilities") | ||
| async def capabilities(request: Request): | ||
| auth(request) | ||
| return dict(contract="0.3", modes=["transcribe", "polish", "translate"], |
There was a problem hiding this comment.
F1 — high, must-fix, API contract — /v1/capabilities omits respond and still reports contract: "0.3"
- Where:
host/sessions/app.py:193 - Problem:
capabilities()returnscontract="0.3", modes=["transcribe", "polish", "translate"], although this PR adds respond mode and its own docs call respond "contract 0.4" (docs/reference.md:127). The same response already carries respond-only metadata (tools,output_languages), so this is an omission rather than a deliberate choice to hide the mode.docs/reference.mdsays "Apps read this at start and hide what is not available", so a capability-driven client will never offer respond. - Conditions: any client that builds its mode list from
GET /v1/capabilities, which is the documented integration path. The bundled demo masks the bug becauseclient/demo/index.htmlhardcodes<option value="respond">. - Impact: third-party clients cannot discover or gate the PR's headline mode, and clients that gate on the advertised contract version (0.3 vs the documented 0.4) also treat respond as unsupported.
- Fix: return
contract="0.4"andmodes=["transcribe", "polish", "translate", "respond"]. Add a regression assertion tohost/sessions/test_sessions.py(for example intest_http_and_retryortest_translate_text_endpoint):assert "respond" in c.get("/v1/capabilities").json()["modes"], and align the capabilities example indocs/reference.md.
Verified against a mock backend: the response is {"contract": "0.3", "modes": ["transcribe", "polish", "translate"], ...} with tools present.
| for _ in range(3): # at most two tool rounds, then a final answer | ||
| text, pending = "", {} | ||
| async with app.state.client.stream("POST", urls["llm"] + "/v1/chat/completions", json={ | ||
| "model": models["llm"], "messages": messages, "temperature": 0, "max_tokens": 400, |
There was a problem hiding this comment.
F2 — medium, must-fix, truncation — Streamed respond answers are silently cut off at 400 tokens
- Where:
host/sessions/app.py:224 - Problem: every respond round is requested with
"max_tokens": 400, and the stream loop reads onlydelta.contentanddelta.tool_calls;finish_reasonis never inspected. The polish path rejectsfinish_reason != "stop"(app.py:313) andtranslate()does too (app.py:208), so respond is the one stage that returns a truncated model answer as if it were final. - Conditions: any answer or rewrite longer than roughly 300 words — for example "rewrite this" on a long
context.selected_text(the option accepts 8,000 characters) or "summarize/explain …" requests. - Impact: the app inserts a rewrite that stops mid-sentence, no warning is produced, and the partial answer is appended to the client's
history, so follow-ups reason about a truncated turn. Confirmed with a mock stream whose last chunk isfinish_reason: "length": the endpoint returned the partial text withwarnings: []and no error. - Fix: raise the cap for the final (non-tool) round and treat
finish_reason == "length"as incomplete — continue the completion, or return a warning such asrespond_truncated(and document it inreference.md). Add a stream test whose final chunk carriesfinish_reason: "length"and assert the visible behaviour.
| try: | ||
| r = await app.state.client.post(urls["mt"] + "/v1/chat/completions", json={ | ||
| "model": models["mt"], "messages": prompts.translation(text, target, dictionary), | ||
| "temperature": 0, "max_tokens": 1024}) |
There was a problem hiding this comment.
F3 — medium, must-fix, API contract — /v1/translate accepts 8,000 characters but caps the model at 1,024 tokens
- Where:
host/sessions/app.py:204 - Problem:
translate()always requestsmax_tokens: 1024, whilePOST /v1/translatedocuments text up to 8,000 characters (docs/reference.md:145) and speech translate can pass the transcript of a 600-second recording. Because the function correctly rejectsfinish_reason != "stop"(app.py:208), any translation longer than 1,024 tokens is treated as a model failure instead of being completed:/v1/translateanswers502 mt_failed, and speech translate falls back to the untranslated transcript withtranslate_failed. - Conditions: a translation whose output exceeds 1,024 tokens — roughly 800+ English words or 1,500+ Chinese characters (a token estimate; I did not run a real model).
- Impact: the documented input range fails for an ordinary use of
/v1/translate("typed, pasted or selected text"): pasting a paragraph or an email returns 502 and the user gets no translation. - Fix: size the cap from the source (for example
min(8192, 2 * len(text) + 256)), or split long text into chunks and join the translations; otherwise lower the documented 8,000-character limit to what the output cap can actually return. Add coverage for both: the request'smax_tokensgrows with a long input, and alengthfinish still maps tomt_failed.
| raise ValueError | ||
| if "<asr_text>" in raw and raw.startswith("language "): | ||
| prefix, raw = raw.split("<asr_text>", 1) | ||
| language = {"English": "en", "Chinese": "zh"}.get(prefix[9:].strip(), language) |
There was a problem hiding this comment.
F4 — medium, suggestion, ASR — language is only decoded for English and Chinese
- Where:
host/sessions/app.py:288 - Problem: Qwen3-ASR prefixes the transcript with the detected language (
language X<asr_text>…), but the map only knowsEnglishandChinese. For any other language the result keepslanguage: "auto", andprocess()then appendslanguage_uncertain(app.py:300) even though the recognizer named the language. - Conditions: dictating Japanese, Korean, French, … with
language: "auto". - Impact: clients that use
languagefor UI, history or the next stage get "auto", and a falselanguage_uncertainwarning is reported for speech the recognizer actually identified. Verified with a mock ASR answerlanguage Japanese<asr_text>こんにちは: the result was{"language": "auto", "warnings": ["language_uncertain"]}. - Fix: map the languages Qwen3-ASR reports (or normalise the prefix to a BCP-47 code) and append
language_uncertainonly when no language was detected. Add the Japanese case totest_sessions.py.
|
|
||
| ```json | ||
| { | ||
| "contract": "0.1", |
There was a problem hiding this comment.
F6 — medium, suggestion, docs — The API docs disagree with the implemented capabilities and result shape
- Where:
docs/reference.md:107 - Problem: the
GET /v1/capabilitiesexample still shows"contract": "0.1","modes": ["transcribe", "polish"]and"streaming": {"partials": true}, while the host returnscontract 0.3, includestranslate(and should includerespond, see F1), and reportspartials: false. TheDictateOptionsmode table (reference.md:33) and theoutput_languagerow (reference.md:35) omit respond and sayoutput_languageis "rejected for other modes", although respond accepts it.reference.md:182still lists "Translate and rewrite modes" as out of scope.docs/openapi.yaml:7sends readers to acontract.mdthat does not exist, and itsCapabilities/DictateResultschemas lackoutput_languages,speeds,tools,models.mtandtimings_ms.translate/respond, all of which the host returns (the demo page readsoutput_languagesandspeeds). - Conditions: a client generated from
openapi.yaml, or one written from the reference tables. - Impact: generated clients cannot see the new fields, and a developer following the option table treats
output_languageon respond as invalid and never learns respond exists from the documented schema. - Fix: update the example and tables to the real response, remove the stale out-of-scope entries, point the openapi description at
reference.md, and add the new capability/result fields to the schemas.
|
Important Needs a person (1): Decide whether phase 1 may include respond mode and the opt-in lookup egress; if yes, require AGENTS.md and the phase-1…. Summary at the end. PR #2 adds the phase-1 personal host: a FastAPI voice-session service ( Labels: enhancement (a new phase-1 host capability; this repository has no type/priority axes, only GitHub defaults). [Needs a person] F5 — medium, human decision, scope — Respond mode and its off-device lookups go beyond the phase-1 scope declared in
Reviewed commit: 48c7096 Needs a person (1)
|
…s-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx) labels each sentence S1, S2, ... in ~19 ms, alongside recognition; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 85 tests with faked backends (CI needs no models). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Project licence decision: Apache-2.0. The maintainers settled this in the project chat today (2026-12-03): Open Voice is licensed under the Apache License 2.0. What that means for this PR, since it says "No licence file yet":
Nothing else in this PR changes because of the licence choice. If you would rather land |
|
Included in #3, which now has the whole phase 1 host as one squashed commit. Closing this one so there is a single PR to review. |
…s-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx) labels each sentence S1, S2, ... in ~19 ms, alongside recognition; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 85 tests with faked backends (CI needs no models). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx) labels each sentence S1, S2, ... in ~19 ms, alongside recognition; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - In respond mode the model is told who spoke ([Speaker S1] ...) and whom it answered ([To S1] ...), so it keeps people's requests and likes apart. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 87 tests with faked backends (CI needs no models). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx) labels each sentence S1, S2, ... in ~19 ms, alongside recognition; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - In respond mode the model is told who spoke ([Speaker S1] ...) and whom it answered ([To S1] ...), so it keeps people's requests and likes apart. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 87 tests with faked backends (CI needs no models). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx) labels each sentence S1, S2, ... in ~19 ms, alongside recognition; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - In respond mode the model is told who spoke ([Speaker S1] ...) and whom it answered ([To S1] ...), so it keeps people's requests and likes apart. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 87 tests with faked backends (CI needs no models). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-free listening, tools and speaker labels Everything runs on one Mac with local models; nothing leaves the device. Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md: - POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm; WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health; a demo page at /demo. - Router: each stage (speech, fast speech, clean-up, translation) goes to a local OpenAI-compatible model server chosen by environment variables. Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507. - Clean-up keeps the spoken language and skips the LLM for clean sentences; respond mode answers live, with follow-ups from the conversation. - Translation drops spoken fillers (um, uh, ah, er, hmm, 呃, 嗯) before translating, by a fixed rule with no added time; "clean_up": false keeps them. raw always keeps every word. Hands-free listening (/v1/listen): - Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text from the fast speech model while speaking; per-session conversation memory. - vad.model chooses "silero" or "level" (the old loudness detector, for comparison); end_silence_ms sets the pause that ends a sentence. Tools: - The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools run directly; any other tool asks first with a confirm event, answered by POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. - Example local server host/mcp_servers/mac.py: time, Shortcuts, links, reminders (relative and clock times). Speaker labels (opt-in, speakers: true on /v1/listen): - Nemotron-3-Diarization (OpenMDW-1.1, Q8 GGUF via NeMo-Speech.cpp), when OPENVOICE_DIAR_LIB and OPENVOICE_DIAR_MODEL are set: the whole session streams into one diarizer and each sentence takes the speaker who talked most; "also" lists anyone who talked over them. Keeps people apart over a whole meeting (AMI EN2002a, 36 min: 18.3% DER vs 45.8% per-sentence CAM++). No added wait (median speech end to transcript 480 ms vs 525 ms off), ~20% of one CPU core. - CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx), the fallback: labels each sentence S1, S2, ... in ~19 ms; enrolled voices get a name. - POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech, stored only as a voiceprint on the device. - In respond mode the model is told who spoke ([Speaker S1] ...) and whom it answered ([To S1] ...), so it keeps people's requests and likes apart. - Measured and compared candidate models in docs/results/T20.md. Quality and tests: - host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit Qwen3-4B. 100 tests with faked backends (CI needs no models). - CI keeps opentelemetry-api below 1.46: 1.46.0 breaks FastAPI 0.165.1's request telemetry (every request fails with a TypeError). Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13 and #14 (backups: backup/* branches on aliparchekan/OpenVoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-free listening, tools and speaker labels
Everything runs on one Mac with local models; nothing leaves the device.
Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md:
- POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm;
WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health;
a demo page at /demo.
- Without a token (loopback only) the host serves only its own pages: a
foreign Origin, or a Host other than 127.0.0.1/localhost/[::1], gets
403 forbidden_origin, so no web page can drive it (incl. DNS rebinding).
- Router: each stage (speech, fast speech, clean-up, translation) goes to a
local OpenAI-compatible model server chosen by environment variables.
Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507.
- Clean-up keeps the spoken language and skips the LLM for clean sentences;
respond mode answers live, with follow-ups from the conversation.
- Translation drops spoken fillers (um, uh, ah, er, hmm, 呃, 嗯) before
translating, by a fixed rule with no added time; "clean_up": false keeps
them. raw always keeps every word.
Hands-free listening (/v1/listen):
- Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text
from the fast speech model while speaking; per-session conversation memory.
- vad.model chooses "silero" or "level" (the old loudness detector, for
comparison); end_silence_ms sets the pause that ends a sentence.
Tools:
- The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools
run directly; any other tool asks first with a confirm event, answered by
POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. There is no
way to turn asking off. A spoken answer with any negation ("okay no,
cancel that") is a no; 嗯 is not a yes.
- Only the tools offered in a turn can run (built-in web tools need
OPENVOICE_TOOLS=1); the last round offers none, so there is always an answer.
- Example local server host/mcp_servers/mac.py: time, Shortcuts, links,
reminders (relative and clock times).
Speaker labels (opt-in, speakers: true on /v1/listen):
- Nemotron-3-Diarization (OpenMDW-1.1, Q8 GGUF via NeMo-Speech.cpp), when
OPENVOICE_DIAR_LIB and OPENVOICE_DIAR_MODEL are set: the whole session
streams into one diarizer and each sentence takes the speaker who talked
most; "also" lists anyone who talked over them. Keeps people apart over a
whole meeting (AMI EN2002a, 36 min: 18.3% DER vs 45.8% per-sentence CAM++).
No added wait (median speech end to transcript 480 ms vs 525 ms off),
~20% of one CPU core.
- CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx), the fallback: labels
each sentence S1, S2, ... in ~19 ms; enrolled voices get a name.
- POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech,
stored only as a voiceprint on the device.
- In respond mode the model is told who spoke ([Speaker S1] ...) and whom it
answered ([To S1] ...), so it keeps people's requests and likes apart.
- Measured and compared candidate models in docs/results/T20.md.
Quality and tests:
- host/eval: clean-up 16/16, respond 24/24, tool choice 10/10 on the 4-bit
Qwen3-4B. 112 tests with faked backends (CI needs no models).
- CI keeps opentelemetry-api below 1.46: 1.46.0 breaks FastAPI 0.165.1's
request telemetry (every request fails with a TypeError).
Licence: Apache-2.0 (LICENSE), with NOTICE listing the bundled Silero VAD,
the adapted clean-up prompt, ASCEND excerpts and the optional speaker models.
Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13
and #14 (backups: backup/* branches on aliparchekan/OpenVoice).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-free listening, tools and speaker labels
Everything runs on one Mac with local models; nothing leaves the device.
Host (FastAPI, `python -m host.sessions`), API contract 0.6 in docs/reference.md:
- POST /v1/dictate (also ?stream=1), /v1/translate, /v1/respond, /v1/confirm;
WebSocket /v1/dictate/stream and /v1/listen; /v1/capabilities, /v1/health;
a demo page at /demo.
- Without a token (loopback only) the host serves only its own pages: a
foreign Origin, or a Host other than 127.0.0.1/localhost/[::1], gets
403 forbidden_origin, so no web page can drive it (incl. DNS rebinding).
- Router: each stage (speech, fast speech, clean-up, translation) goes to a
local OpenAI-compatible model server chosen by environment variables.
Qwen3-ASR-1.7B (accurate) and a 4-bit build (fast), Qwen3-4B-Instruct-2507.
- Clean-up keeps the spoken language and skips the LLM for clean sentences;
respond mode answers live, with follow-ups from the conversation.
- Translation drops spoken fillers (um, uh, ah, er, hmm, 呃, 嗯) before
translating, by a fixed rule with no added time; "clean_up": false keeps
them. raw always keeps every word.
- Spoken self-corrections are resolved in polish and translate: "Book me a
meeting at 2 p.m. No, 3 p.m." gives "...at 3 p.m.", "七点...不对,不对...
八点钟" gives "八点钟". A correction word (no, sorry, I mean, actually, 不对,
哦不...) sends the sentence to the clean-up model; the guard lets a
correction delete words but not add any, drop a negation, or only drop
"sorry"/"actually". 30/33 probe sentences, 12/12 look-alikes kept.
Transcribe and raw stay verbatim.
Hands-free listening (/v1/listen):
- Silero VAD (MIT, bundled ONNX, CPU) finds each sentence; live partial text
from the fast speech model while speaking; per-session conversation memory.
- vad.model chooses "silero" or "level" (the old loudness detector, for
comparison); end_silence_ms sets the pause that ends a sentence.
Tools:
- The host is an MCP client (OPENVOICE_MCP, mcpServers format). Read-only tools
run directly; any other tool asks first with a confirm event, answered by
POST /v1/confirm or a spoken yes/no; no answer in 60 s is no. There is no
way to turn asking off. A spoken answer with any negation ("okay no,
cancel that") is a no; 嗯 is not a yes.
- Only the tools offered in a turn can run (built-in web tools need
OPENVOICE_TOOLS=1); the last round offers none, so there is always an answer.
- Example local server host/mcp_servers/mac.py: time, Shortcuts, links,
reminders (relative and clock times).
Speaker labels (opt-in, speakers: true on /v1/listen):
- Nemotron-3-Diarization (OpenMDW-1.1, Q8 GGUF via NeMo-Speech.cpp), when
OPENVOICE_DIAR_LIB and OPENVOICE_DIAR_MODEL are set: the whole session
streams into one diarizer and each sentence takes the speaker who talked
most; "also" lists anyone who talked over them. Keeps people apart over a
whole meeting (AMI EN2002a, 36 min: 18.3% DER vs 45.8% per-sentence CAM++).
No added wait (median speech end to transcript 480 ms vs 525 ms off),
~20% of one CPU core.
- CAM++ zh/en (Apache-2.0, 28 MB ONNX via sherpa-onnx), the fallback: labels
each sentence S1, S2, ... in ~19 ms; enrolled voices get a name.
- POST/GET/DELETE /v1/speakers: consented enrolment from ~15 s of speech,
stored only as a voiceprint on the device.
- In respond mode the model is told who spoke ([Speaker S1] ...) and whom it
answered ([To S1] ...), so it keeps people's requests and likes apart.
- Measured and compared candidate models in docs/results/T20.md.
Quality and tests:
- host/eval: clean-up 21/22, respond 24/24, tool choice 10/10 on the 4-bit
Qwen3-4B. 145 tests with faked backends (CI needs no models).
- CI keeps opentelemetry-api below 1.46: 1.46.0 breaks FastAPI 0.165.1's
request telemetry (every request fails with a TypeError).
Licence: Apache-2.0 (LICENSE), with NOTICE listing the bundled Silero VAD,
the adapted clean-up prompt, ASCEND excerpts and the optional speaker models.
Squashes the former PRs ThinkFlowLab#2 and #3 and fork PRs #13
and #14 (backups: backup/* branches on aliparchekan/OpenVoice).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What this adds
A working phase-1 Personal Host that runs fully on a Mac (Apple silicon), placed in the existing skeleton:
host/sessions/POST /v1/dictate(multipart audio),POST /v1/translate,POST /v1/respond, and a WebSocket streamhost/router/host/workers/start_local.sh(vllm-metal model servers + host), a 4-bit ASR quantizer, an MLX cache capclient/demo//demo: hold-to-talk, hands-free, streaming conversationdocs/reference.md(API, contract 0.4),integrating.md,demo.md,openapi.yaml, and the phase-1 subsystem docsModes
/v1/translate). 35 languages; the model is routable.?stream=1, server-sent events).history.Scope note: respond mode goes beyond
AGENTS.md's "ASR + translation" phase-1 scope. We included it deliberately. Its lookups (weather via wttr.in, Wikipedia search) are off unlessOPENVOICE_TOOLS=1, so by default nothing leaves the device. TTS and full-duplex are not in this PR.Measured (M1 Max, 32 GB, warm, through the host)
Try it
Checks
python -m pytest -q host: 38 passing. Backends are faked, so CI needs no models;.github/workflows/ci.ymlnow runs them.Not in this PR / open
OPENVOICE_CONTACT(a project URL or email) for Wikimedia's robot policy. Which contact to publish is a team decision.host/sessions/prompts/NOTICE.🤖 Generated with Claude Code