Local Voice Dictation in Mixed Chinese and English: My Hex Setup

How I set up Hex for on-device dictation to coding agents in mixed Chinese and English: the speech model, a vocabulary of misheard terms, a five-step output pipeline, and what broke along the way.

Most of my typing these days is talking to coding agents in a terminal, half in Chinese and half in English. Voice dictation should be ideal for that, but most tools either send audio to a server or mangle every technical term they hear. Hex does neither: it transcribes on-device and pastes the text at the cursor in whichever app is in front, on macOS, Windows, and Linux.

This post covers what Hex can do, how I configured it (Hex 3.5.2 on an Apple M5 Pro running macOS 27.2), why I made each choice, and what I ran into along the way.

What Hex does

Dictation

  • Shortcuts. One main dictation shortcut in Hold mode (talk while held) or Toggle mode (tap to start, tap to stop). Labs adds more: a second shortcut, up to four extra ones, mouse buttons, Caps Lock, the laptop mic key, or the middle mouse button.
  • Paste last. Option-Shift-V pastes the previous dictation again.
  • History. Dictations are saved and searchable (7 days by default). Each entry stores its raw transcript, final text, app, processing steps, and model.
  • Cancel. Esc cancels a dictation in progress.

Speech models

Every model runs on-device. The first run downloads one model; you can install others from the model picker or with hex model install.

Model

Strength

Parakeet Unified English

Default for English; writes while you talk

Parakeet v3

25 European languages, detects which one you speak

Whisper large-v3-turbo

Almost any language; reads the vocabulary

Qwen3-ASR 0.6B

Chinese and 30 more; reads the vocabulary

SenseVoice Small

Chinese, Japanese, Korean, English; small (252 MB)

Cohere Transcribe

Fewest wrong words in 14 languages; large download

Nemotron 3.5 ASR

Writes while you talk, 27 languages

You can also add custom GGUF models with "Add model file…".

Vocabulary

Hex keeps a single list of names and terms it should recognize. Whisper and Qwen3-ASR read it while transcribing, Parakeet reads it when Labs › Vocabulary help is on, and the OpenCode rewrite uses it too. Each term can include "sounds like" spellings: the wrong forms a transcript tends to produce instead.

Output processing

Every dictation can pass through a chain of steps before Hex pastes it:

  1. Replacements: fixed word-for-word corrections.
  2. Built-in clean-ups: filler-word removal, spoken symbols and formatting, Apple Intelligence clean-up, and dictation style.
  3. OpenCode rewrite: an LLM rewrites the text using your own prompt.
  4. Transformations: your own TypeScript functions in ~/.config/hex.

Modes apply different steps per app or website—for example, one set for a terminal and another for a chat app.

The OpenCode rewrite is the only way to get an LLM rewrite inside Hex. Hex never starts OpenCode itself; it talks to an already running OpenCode background service (opencode service status). You can pick any model configured in OpenCode, including your own providers. With a cloud model, the text leaves the machine, and each dictation waits for a response up to deadline_seconds (30 s by default).

Custom transformations start with hex commands init, which creates ~/.config/hex/hex.config.ts. Each transformation is a function transform(text, context) => string that runs in Hex's embedded JavaScript engine. Once allowed in the Output pane, scripts can use fetch and node:child_process, so a script can also call an external API directly without OpenCode. Hex reloads the file on save, and hex commands check validates it.

Everything else

  • Annotate: record the screen while drawing and narrating, then send the capture to a coding agent (Option-Shift-S).
  • Meetings: record a call and get a transcript with chapters, summaries, and calendar integration. hex mcp serves recorded meetings to agents read-only over MCP.
  • Local API and TypeScript SDK: transcribe with the same model from your own tools.
  • File transcription: drop an audio or video file onto the window, or run hex transcribe <file>.
  • Labs: about 70 experimental switches at the bottom of the sidebar, also available via hex labs list|on|off.

The hex CLI drives the running app and covers every setting—it's how I made most of the changes below:

hex status                      # what Hex is doing now
hex settings list|get|set       # every persisted setting
hex model list|use|install      # speech models
hex vocabulary list|add|remove  # vocabulary
hex labs list|on|off            # Labs features
hex history stats               # dictation statistics
hex logs                        # recent log lines
hex restart                     # quit and reopen

My setup

Almost all of my dictation happens in the kitty terminal, talking to coding agents in mixed Chinese and English. My setup is tuned for that, and every step stays on-device.

Speech model: Qwen3-ASR 0.6B

I switched from SenseVoice Small. SenseVoice is smaller and faster, but it doesn't read the vocabulary. Qwen3-ASR does, which matters for technical terms in mixed Chinese and English speech.

hex model use qwen3_asr06_b

Vocabulary

My list has 21 terms. Most are technical words I use every day:

Zig, zig-analyzer, comptime, Neovim, LSP, Claude Code, OpenCode, Hex, Qwen, Rust, TypeScript, JSON, PR, CI, uv

The rest are terms earlier dictations got wrong, paired with those misheard forms under "sounds like":

Term

Sounds like

Raycast

tiycast, teny cost, T内cast

GitHub

get up, get hub

Homebrew

brare, brew

ComfyUI

comfi

Mac

麦ac, 麦克上

程序坞

程序屋

I left "麦克" out of the Mac entry because on its own it also means microphone. The vocabulary worked immediately: in a test, saying "get up" came out as "GitHub" straight from the speech model.

hex vocabulary add Raycast --sounds-like "tiycast,teny cost,T内cast"

Output pipeline

Global mode runs these steps in order:

  1. `filler-words` (Labs): removes English fillers such as "um" and "uh".
  2. `clean-up-apple-intelligence` (Labs): fixes clearly misheard words and spoken self-corrections with the on-device Apple Intelligence model.
  3. `dictation-style` = Polished (Labs): rewrites each dictation in a polished style.
  4. `zh-fillers` (custom): drops 嗯 and 呃 when they stand alone before a comma.
  5. `cjk-spacing` (custom): inserts one space between Chinese characters and Latin letters or digits.

The OpenCode rewrite is off, so no dictated text leaves the machine.

Custom transformations

The two custom steps live in ~/.config/hex/hex.config.ts:

import { defineHexConfig } from "@hex/commands"

const HAN = "\\p{Script=Han}"
const LATIN = "[A-Za-z0-9]"

export default defineHexConfig({
  transformations: {
    "cjk-spacing": {
      name: "CJK spacing",
      description: "Put one space between Chinese characters and Latin letters or digits",
      transform: (text) =>
        text
          .replace(new RegExp(`(${HAN})(${LATIN})`, "gu"), "$1 $2")
          .replace(new RegExp(`(${LATIN})(${HAN})`, "gu"), "$1 $2"),
    },
    "zh-fillers": {
      name: "Chinese fillers",
      description: "Drop 嗯 / 呃 fillers that stand alone before a comma",
      transform: (text) =>
        text
          .replace(/(^|[,。!?、\s])(?:嗯|呃)+[,、]/gu, "$1")
          .replace(/^[,、\s]+/u, ""),
    },
  },
})

There's a reason the filler rule only fires before a comma: an earlier version also matched 额 without that condition, turning "额度" (quota) into "度".

Both transformations are enabled in Global mode:

hex settings get dictation_processing.default_mode
# ... "transformations":["zh-fillers","cjk-spacing"]

Labs features I turned on

Feature

Why

learn-from-corrections

A name I fix by hand right after a paste is added to the vocabulary

screen-vocabulary

Names visible in the window help spelling; never saved

live-text

Shows words next to the recording indicator while I speak

failure-notices

Shows why a dictation failed instead of silently pasting nothing

modes-editor

A Modes pane to give apps their own processing

history-stats

Required by history-stats-strip, which was on but showed nothing

clean-up-apple-intelligence

See the output pipeline

dictation-style (Polished)

See the output pipeline

These were already on, and I kept them: filler-words, smart-spacing, notch-indicator, hide-menu-bar-icon, meetings, live-chapters, transcript-edits, drop-transcribe.

Labs features I turned off

Feature

Reason

neutral-voice

Rewrites wording, which overlaps with the Polished style

voice-isolation

My wired headset mic doesn't support Apple voice processing; the fallback reopened the mic mid-dictation and dropped the dictation

unload-idle

Keeping the model in memory (~375 MB) avoids a slow first dictation after idle

faster-live-text

Shortens the streaming lookahead; Qwen3-ASR is probably not a streaming model, so it likely does nothing here

What I learned along the way

Apple Intelligence depends on your Apple Account region

Apple Intelligence didn't appear in System Settings while my Apple Account region was set to China mainland, even though both the Mac (a Hong Kong model) and macOS support it. After I moved the account to Singapore and restarted, the on-device model reported available. Also, in a Chinese system UI, the setting is called "Apple 智能与 Siri", so searching for "Apple Intelligence" finds nothing.

A one-line check for the on-device model:

echo 'import FoundationModels; print(SystemLanguageModel.default.availability)' > /tmp/ai.swift
swift /tmp/ai.swift   # prints "available" when ready

Hex rejects AI edits that change numbers

I said "明天下午三点开会,不对,是四点。" ("Meeting tomorrow at three, no wait, at four."), and it came through unchanged. The history entry showed "fallback": "a number changed". Apple Intelligence had applied the correction, but to protect times, amounts, and version numbers, Hex rejects any AI result where a number changed. Self-corrections involving numbers have to be fixed by hand.

The Apple Intelligence clean-up fixes but doesn't polish

The clean-up step corrects misheard words and spoken self-corrections. A sentence already transcribed correctly passes through unchanged. Polishing comes from dictation-style or the OpenCode rewrite.

The first Apple Intelligence call can time out

The first dictation after enabling Apple Intelligence timed out at 2 s while the model loaded, and Hex pasted the unprocessed text. Later calls took 0.5–0.7 s.

Microphone interruptions came from voice isolation

Hex showed "Microphone audio was interrupted for 838 ms". I traced it in ~/Library/Application Support/hex/logs/process.log to voice processing would not start: The microphone reported no usable format on the wired headset mic. Turning off voice-isolation fixed it.

Keeping it working

  • A word keeps being misheard: add it and its misheard forms to the vocabulary with hex vocabulary add <term> --sounds-like "<wrong1>,<wrong2>".
  • Polished changes too much: switch the style with hex settings set labs.dictation_style_choice casual.
  • Extra spaces show up in Chinese text: turn off smart-spacing with hex labs off smart-spacing.
  • A dictation fails: read the notice, then check hex logs and ~/Library/Application Support/hex/logs/process.log.
  • Inspect a dictation: ~/Library/Application Support/hex/history.json holds raw_text, final_text, and the processing record for each entry.
  • Back to SenseVoice: hex model use sense_voice_small (the vocabulary stops applying).

What I haven't tried yet

  • Annotate with Claude Code: turn on annotate-agent-tools and annotate-agent-install so a coding agent can read screen captures.
  • A kitty mode: keep prompts to coding agents close to what I said (corrections and spacing only) and allow more polishing in chat apps.
  • `tap-or-hold`: hold the shortcut for short prompts, tap for long ones.
  • zsh completions: hex completions zsh.
  • OpenCode rewrite: use a fast model such as deepseek-v4.1-flash from the OpenCode subscription, or DeepSeek on Cloudflare added as an OpenCode provider. A custom transformation that calls the Cloudflare API with fetch would skip OpenCode entirely.
  • Leaving off: yolo-mode, which presses Return after every paste in every app, including chat apps.

No comments yet