返回 CodeWhale
VOICE_INPUT.md
根目录 / docs / VOICE_INPUT.md
1 # Voice input
2
3 Dictate into the composer instead of typing. Codewhale records from your
4 microphone with a command-line recorder, sends the audio to one speech-to-text
5 backend, and puts the text at the cursor. Nothing is recorded until you run a
6 voice command.
7
8 This page covers the terminal. How Codewhale writes its own messages is in the
9 [voice and terminal charter](VOICE.md). Speech synthesis and the other media
10 routes are in [Media models](MEDIA_MODELS.md).
11
12 ## Before you start
13
14 Install one recorder. Codewhale uses the first one it finds:
15
16 | System | Recorders tried, in order |
17 | --- | --- |
18 | macOS | `sox`, `rec` |
19 | Linux | `arecord`, `sox` |
20 | Windows | `sox` |
21
22 If none is installed, `/voice` answers `Voice: no recording tool found.
23 Install sox, arecord, or rec.` and records nothing.
24
25 ## Commands
26
27 | Command | What it does |
28 | --- | --- |
29 | `/voice` | Records one dictation and inserts the text at the cursor. Aliases: `/yuyin`, `/语音`. |
30 | `/voicesend` | Turns auto-send on or off. Aliases: `/voice-send`, `/yuyinsend`, `/语音发送`. |
31 | `/voicecontrol` | Turns voice control on or off. Aliases: `/voice-control`, `/yuyincontrol`, `/语音控制`. |
32
33 The hotbar action `voice.toggle` runs `/voice`.
34
35 ### Dictate
36
37 Run `/voice` and speak. The status line shows `Recording... speak now · pause to
38 finish`, and a preview of the words appears in the composer while you talk.
39 Recording stops after one second of silence or after 10 seconds, whichever
40 comes first. No key stops it early. The final text replaces the preview and
41 you can edit it before you send.
42
43 Each `/voice` is one recording. Run it again for the next sentence.
44
45 ### Send by voice
46
47 With auto-send on, a dictation that ends in `send it`, `发送` or `發送` is
48 submitted without the phrase:
49
50 - "ship the fix, send it" submits `ship the fix`.
51 - "send it" alone submits what is already in the composer.
52
53 Without one of those phrases the text is inserted as usual and nothing is
54 sent. `/voicesend` again turns it off.
55
56 ### Voice control
57
58 With voice control on, the speech model also receives your current draft as
59 context for the transcription, for example the names and terms you have
60 already typed. The result is still inserted at the cursor; your draft is not
61 rewritten. This works only with the configured-provider backend below, which
62 then uses the model `mimo-v2.5`. The local Whisper, Groq and DeepSeek backends
63 never see the draft and return a plain transcription.
64
65 ## Where the audio goes
66
67 One backend handles each recording. Codewhale picks it in this order and does
68 not change your chat provider:
69
70 1. The backend named in `CODEWHALE_ASR_MODEL`, when set.
71 2. Local Whisper, when a `whisper`, `whisper.cpp`, `whisper-cpp` or
72 `faster-whisper` binary is on `PATH`. The audio stays on your machine.
73 3. Groq, when `GROQ_API_KEY` is set (`whisper-large-v3-turbo`).
74 4. DeepSeek, when the active provider is `deepseek` or `deepseek-anthropic`
75 (`deepseek-asr`).
76 5. The active provider's endpoint, with the model `mimo-v2.5-asr`.
77
78 `CODEWHALE_ASR_MODEL` accepts:
79
80 | Value | Backend |
81 | --- | --- |
82 | `local-whisper` | Local Whisper with the `tiny` model. The binary and model must already be installed. |
83 | `groq` | Groq. Needs `GROQ_API_KEY`. |
84 | `deepseek` | DeepSeek Tools speech recognition. Needs a DeepSeek key. |
85 | `mimo` | The active provider's endpoint with `mimo-v2.5-asr`. |
86
87 Any other value is ignored and the order above applies. The variable selects a
88 backend, not an arbitrary model id, and there is no config-file setting for it.
89
90 If the selected backend fails, Codewhale reports the failure. It does not
91 upload the audio to a different backend.
92
93 ## Turn the microphone off
94
95 Set `CODEWHALE_DISABLE_VOICE=1` to disable microphone capture on this machine.
96 `/voice` then behaves as if no recorder were installed. Audio that a client
97 uploads through the Runtime API is not affected; see
98 [Runtime API](RUNTIME_API.md).
99
100 ## Messages you may see
101
102 | Message | Meaning |
103 | --- | --- |
104 | `Voice: no recording tool found. Install sox, arecord, or rec.` | No recorder on `PATH`, or the microphone is disabled. |
105 | `Voice: no API key configured for the active provider` | The backend that would run needs a key you have not set. Set the key, or choose another backend with `CODEWHALE_ASR_MODEL`. |
106 | `Voice: no speech detected, recording too short` | The recorder heard nothing above the speech threshold. |
107 | `Voice: transcription request failed` | The backend returned an error; the reason follows the message. |
108 | `Voice: nothing to send` | The transcript was empty, or you said "send it" with an empty composer. |
109
110 ## From another client
111
112 The Runtime API exposes the same recorder and backend selection under
113 `/v1/voice`, and accepts uploaded audio when the host has no microphone. The
114 routes are listed in [Runtime API](RUNTIME_API.md).
115
115 lines MARKDOWN