English | 简体中文
agent-voice-input
Context-aware voice input built specifically for CLI coding agents (Codex, Claude Code, and Antigravity CLI / agy).
Generic OS dictation has no idea what files, symbols, or CLI flags exist in your repository. agent-voice-input automatically locates the active coding agent session in your focused terminal window or pane, pairs fast speech recognition with lightweight refinement grounded in your live dialogue + git status filenames, and fixes homophone identifiers, mixed-language technical terms, and mid-sentence self-corrections before pasting safely into your terminal:
🎙️ What you say casually to your terminal:
"Check the default max duration seconds in platform w s l dot py, change it from
three minutes to five minutes—actually wait, make it ten minutes—and run unit tests
without piping to head"
❌ Generic OS dictation:
Check the default max duration seconds in platform WSL dot pie, change it from 3 minutes to 5 minutes actually wait make it 10 minutes and run unit tests without piping to head
✅ agent-voice-input (refined against your active Agent session & repo context, pasted without pressing Enter):
Check the default of max_duration_sec in platform_wsl.py, change it to 10 minutes, and run the unit tests without piping to head.
Verified on Windows Terminal + WSL2 (including Remote Desktop and
tmux) and macOS (Ghostty, built-inTerminal.app, andtmux); common third-party macOS terminals (iTerm2,WezTerm,Alacritty,Kitty,Warp, etc.) share baseline window-scoping, child-PTY session discovery, andCmd+V/tmuxpaste support (community verification PRs welcome).
Why It Works Better for Coding Agents
- Grounded in Your Active Agent Session: Automatically resolves the foreground agent session inside your active terminal window, Ghostty split, or
tmuxpane (zero~/.tmux.confchanges needed), incrementally extracting recent dialogue andgit statuspaths as context while strictly ignoring background subagents and sibling splits. - Provider-Driven Speech + Context Pipeline: Pairs fast dedicated speech-to-text with a resident tool-free
codexrefiner by default, switches cleanly to any built-in cloud/local API provider, or runs single-hop multimodal audio + context refinement (Gemini / OpenRouter)—just pick aproviderand its built-in default model applies automatically. - Built for Long & Back-to-Back Dictation: Start a new recording immediately while earlier utterances are still transcribing or refining—utterances queue and paste in FIFO order (joining consecutive focus-drifted clipboard fallbacks with a blank line instead of overwriting); local silence gating and loudness normalization block empty triggers; supports up to 10-minute recordings by default (with a 15s HUD countdown), splits recordings over 3 minutes (
180s) at natural pauses for concurrent transcription, alerts immediately if a mic is missing or unplugged, and stashes failed audio foragent-voice-input retryso long thoughts are never lost. - Native HiDPI Waveform HUD & Focus-Safe Paste: Non-activating floating capsule on both Windows (Per-Monitor V2 HiDPI) and macOS (Retina AppKit) displays live timer, waveform bars, and stage progress in English or Chinese matching your desktop locale. Locks onto the origin terminal window/split on record start, never auto-presses Enter, and falls back to clipboard if focus moved elsewhere.
- Zero Extra Python Dependencies: Pure Python
>= 3.10standard library plus hostffmpeg(uses built-inpowershell.exeon WSL2; compiles and caches a nativemac_shimhelper via/usr/bin/swiftcon macOS).
Quick Start
Option 1: Let Your Coding Agent Set It Up (Recommended)
Copy and paste this prompt directly into Codex, Claude Code, or AGY:
Please install and configure agent-voice-input (https://github.com/xiaohuaxi/agent-voice-input) for me:
1. Check python3 (>=3.10) and ffmpeg (plus Xcode Command Line Tools `/usr/bin/swiftc` on macOS), then install via `uv tool install agent-voice-input` (or `pipx` if `uv` is unavailable).
2. Check if an API key is already set in my environment (e.g. DASHSCOPE_API_KEY, OPENROUTER_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, GROQ_API_KEY); if not, ask which provider I want to use and write it to `~/.config/agent-voice-input/agent-voice-input.env` with chmod 600.
3. If the `codex` CLI is not installed or logged in on this machine, set `[refiner] provider` in `~/.config/agent-voice-input/config.toml` to match my configured API provider (leave `model` unset so built-in defaults apply).
4. Run `agent-voice-input doctor` to verify all checks pass, then start the background daemon with `agent-voice-input start`.
Option 2: Manual Setup in 3 Steps
1. Prerequisites
- Python
>= 3.10 - ffmpeg:
sudo apt install ffmpeg(Ubuntu / WSL2) orbrew install ffmpeg(macOS) - Xcode Command Line Tools (recommended on macOS):
xcode-select --installfor/usr/bin/swiftcto compile and cache the native hotkey & HUD helper on first start (falls back to CLItoggle/onceif absent).
2. Install
uv tool install agent-voice-input
# Or with pipx: pipx install agent-voice-input
3. Configure One Credential & Start
Add at least one provider key to ~/.config/agent-voice-input/agent-voice-input.env (for example OPENROUTER_API_KEY, GEMINI_API_KEY, OPENAI_API_KEY, or DASHSCOPE_API_KEY):
mkdir -p ~/.config/agent-voice-input && chmod 700 ~/.config/agent-voice-input
cat > ~/.config/agent-voice-input/agent-voice-input.env <<'EOF'
OPENROUTER_API_KEY="<your-openrouter-api-key>"
EOF
chmod 600 ~/.config/agent-voice-input/agent-voice-input.env
# Verify audio bridge, native shim, resolved providers/models, and session binding, then start daemon
agent-voice-input doctor
agent-voice-input start
Tap Right Ctrl (
RControl) inside your terminal to start and finish recording. To customize hotkeys (trigger_mode = "ptt"), HUD position (bottom/top), duration limits, or providers, copyconfig.example.tomlto~/.config/agent-voice-input/config.toml(seeconfig.example.envfor all credential variables).
Platform Experience
Windows Terminal + WSL2 (Including Remote Desktop & tmux)
- Terminal-Scoped Hotkey & HiDPI Capsule: Isolated Right Ctrl tap toggles recording (chords like
RControl+Cpass through untouched; starts only when a terminal is focused, while stopping/canceling works from any app) with an anti-aliased Per-Monitor V2 HiDPI capsule above the taskbar. - Native WASAPI Capture (Zero WSLg / RDP Glitches): Captures 16 kHz audio directly via Windows WASAPI in a resident
win_shim, bypassing WSLgRDPSourcezero-packet deadlocks; start/stop audio cues default to off to avoid 1–2s Remote Desktop audio wake-up lag. - Zero-Config
tmuxPane Resolution: Automatically tracks the active pane of the attachedtmuxclient without modifying~/.tmux.conf.
macOS (Ghostty, Built-in Terminal.app & tmux)
- Native Retina HUD & Terminal-Aware Delivery: Uses a cached native
mac_shimfor Right Ctrl tap/PTT and Retina capsule rendering. In Ghostty, locks onto the exact focused split surface and injects bracketed-paste text directly; in built-inTerminal.app(and other macOS terminals), locks onto the window ID / active tabttyand delivers viatmuxbuffer paste (when attached totmux) orCmd+V(falling back to clipboard if focus or tab moved). - Zero-Hook Tab/Split &
tmuxSession Binding: Reads Ghostty's splittty/cwd,Terminal.app's selected tabtty, or the terminal window's child PTY tree (plus active pane insidetmux) to bind directly to thecodex,claude, oragysession running in that tab while isolating sibling terminals; audio input defaults to system mic ([audio] macos_device = "default"). - Minimal macOS Permissions (TCC): Requires Microphone (for
ffmpeg) plus Automation → Ghostty (for Ghostty) or Automation → Terminal (for multi-tabTerminal.appactive-tab lookup). Input Monitoring is not required for default modifier hotkeys (RControl), and Accessibility is only needed forCmd+Vpaste into non-Ghostty terminals when not running insidetmux.
Configuration & Providers Reference
Configuration uses two clean files (CLI flags > config.toml > built-in defaults):
~/.config/agent-voice-input/config.toml: Structured[hotkey],[ui],[audio],[asr], and[refiner]settings.~/.config/agent-voice-input/agent-voice-input.env: API credentials (prefix-style aliases also supported; seeconfig.example.env).
How provider, model, and asr.api Work
- Provider-first defaults (
modelis optional): Leavemodel = ""(or omit it) in[asr]and[refiner]to automatically use the selectedprovider's built-in default model. Overridingprovidervia CLI without specifyingmodelcleanly resets any config-filemodelto the new provider's default. When explicitly set,modelpasses the upstream model ID verbatim. - Two-stage STT vs. single-hop multimodal (
asr.api):asr.api = "auto"(default) routesdashscope,doubao, and dedicated STT models (qwen/qwen3-asr-1.7b,whisper-*,*-transcribe,SenseVoiceSmall, etc.) through Stage 1 transcription + Stage 2 context refinement;- Native
geminiand multimodal chat-audio models on OpenRouter / OpenAI-compatible channels (gemini-2.5-flash,google/gemini-2.5-flash,gpt-audio*, etc.) perform transcription + context refinement in a single hop and skip Stage 2 automatically (unlessrefiner.force_on_single_hop = true). For newly released uncataloged models onopenrouter, setasr.api = "audio-transcriptions"or"chat-completions"explicitly.
- Reasoning budget (
effort): Accepts"auto" | "default" | "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max".asr.effortdefaults to"auto"(suppressing thinking latency on supported multimodal models);refiner.effortdefaults to"low". - Stage 2 prompt & context caching (
refiner.prompt,include_git_status,context_max_chars): Leaveprompt = ""(default) to use the built-in English voice-dictation editor prompt (repairs ASR typos/identifiers from read-only<session_reference_log>blocks and<workspace_git_status>, smooths spoken disfluencies while preserving original sentence structure and language, and strictly forbids answering dictated questions), or customize it with TOML multiline stringsprompt = '''...'''. Recent dialogue (up tocontext_max_chars = 200000, evicted in ~1/4-window50Kblocks) is placed at the start of a singleusermessage ahead of the current draft and trailinggit statuspaths (include_git_status = trueby default) for automatic prefix caching (codexreuses a reverted per-session shell thread to preserveprompt_cache_keywithout retaining prior drafts). - Same-provider retries & handshake timeout (
max_retries):[asr] max_retriesand[refiner] max_retriesdefault to2(0..10, extra retries beyond the initial request;0disables retries), separating rate-limit throttling (HTTP 429,Retry-After, vendor QPS codes) from transient network/5xx errors under the stagetimeout_secbudget with a 9s connect/TLS handshake cap.
Built-in Providers
provider |
Stages | Built-in Default asr.model |
Built-in Default refiner.model |
Credential Source / Env |
|---|---|---|---|---|
codex |
refiner |
— | gpt-6-luna |
Local codex CLI login (resident read-only tool-free session; never enables Fast mode) |
dashscope |
asr, refiner |
qwen3-asr-flash |
qwen-turbo-latest |
DASHSCOPE_API_KEY (compat: ALI_API_KEY) |
doubao |
asr |
bigmodel |
— | DOUBAO_ASR_APP_ID + DOUBAO_ASR_API_KEY (auto-probes granted slot) |
volcengine |
refiner |
— | doubao-seed-1-6-flash |
ARK_API_KEY (compat: VOLCENGINE_API_KEY, HUOSHAN_API_KEY) |
openrouter |
asr, refiner |
qwen/qwen3-asr-1.7b |
google/gemini-2.5-flash-lite |
OPENROUTER_API_KEY |
gemini |
asr, refiner |
gemini-2.5-flash (single-hop) |
gemini-2.5-flash-lite |
GEMINI_API_KEY |
openai |
asr, refiner |
gpt-4o-mini-transcribe |
gpt-4o-mini |
OPENAI_API_KEY |
groq |
asr, refiner |
whisper-large-v3-turbo |
llama-3.3-70b-versatile |
GROQ_API_KEY |
siliconflow |
asr, refiner |
FunAudioLLM/SenseVoiceSmall |
Qwen/Qwen2.5-7B-Instruct |
SILICONFLOW_API_KEY |
openai-compatible |
asr, refiner |
gpt-4o-mini-transcribe (needs base_url) |
(needs explicit base_url + model) |
api_key_env or OPENAI_API_KEY (loopback URLs need no key) |
asr.provider = "auto"(default): selects the first configured credential in orderdashscope -> doubao -> openrouter -> gemini -> openai -> groq -> siliconflow.refiner.provider = "off": disables Stage 2 refinement.
Common config.toml Recipes
# Recipe 1: OpenRouter single key — two-stage dedicated STT + fast refiner (uses built-in defaults)
[asr]
provider = "openrouter"
[refiner]
provider = "openrouter"
# Recipe 2: Single-hop multimodal audio + context refinement (OpenRouter or native Gemini; skips Stage 2)
[asr]
provider = "openrouter" # Or set provider = "gemini" (with GEMINI_API_KEY, no model needed)
model = "google/gemini-2.5-flash"
effort = "auto"
# Recipe 3: Low-latency Mainland China setup (DashScope STT + resident local Codex or API refiner)
[asr]
provider = "dashscope"
[refiner]
provider = "codex" # Or "dashscope" / "volcengine" if Codex CLI is not installed
CLI Commands & Overrides
Common Subcommands
agent-voice-input start # Start background daemon
agent-voice-input restart # Restart daemon after config changes
agent-voice-input status # Inspect daemon state, last latency, and redacted errors
agent-voice-input doctor # Check audio bridge, native shim, credentials, and session binding
agent-voice-input retry --list # List stashed failed recordings (`agent-voice-input retry` re-runs latest)
agent-voice-input once --duration 4 --dry-run # Record once and print result without pasting
agent-voice-input toggle # Toggle recording start/stop from CLI
agent-voice-input stop # Stop background daemon
agent-voice-input key-test # Inspect raw key scancodes / modifier events
Runtime CLI Flags
| CLI Flag | Description |
|---|---|
--config PATH |
Path to config.toml or config.json (also supports AGENT_VOICE_INPUT_CONFIG) |
--asr, --asr-provider |
Stage 1 provider (auto, dashscope, doubao, openrouter, gemini, openai, groq, siliconflow, openai-compatible) |
--asr-model |
Stage 1 upstream model ID |
--asr-api |
Stage 1 protocol (auto, audio-transcriptions, chat-completions) |
--asr-effort |
Stage 1 thinking budget |
--refiner, --refiner-provider |
Stage 2 provider (codex, dashscope, volcengine, openrouter, gemini, openai, groq, siliconflow, openai-compatible, off) |
--refiner-model |
Stage 2 upstream model ID |
--refiner-effort, --effort |
Stage 2 thinking budget |
(Environment variables are reserved for API credentials, bootstrap paths AGENT_VOICE_INPUT_CONFIG / AGENT_VOICE_INPUT_RUNTIME_DIR, and low-level runtime/diagnostic hooks; ordinary options live in config.toml.)
Optional: Multi-Window Session Title Hooks
Single-window setups, macOS + Ghostty splits, and tmux panes work out of the box with zero hooks. If you run multiple standalone terminal windows side by side in the same project directory on WSL2 or in terminals without per-split tty/cwd introspection, see integrations/ for optional lightweight session title hooks (agent-voice-input session-hook) for Codex, Claude Code, and Antigravity CLI.
Development
git clone https://github.com/xiaohuaxi/agent-voice-input.git ~/repos/agent-voice-input
ln -sf ~/repos/agent-voice-input/bin/agent-voice-input ~/.local/bin/agent-voice-input
PYTHONPATH=src python3 -m unittest discover -s tests -v
Acknowledgments
Early exploration for this project was inspired by Einstellung/voice-asr, particularly around pairing Qwen3-ASR with technical terminology context for mixed Chinese–English speech, as well as pre-transcription silence gating and loudness normalization.
License
Metadata
Release files for agent-voice-input 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agent_voice_input-0.6.0.tar.gz | 425.8 kB | With provenance | Details for agent_voice_input-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_voice_input-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for agent_voice_input-0.6.0-py3-none-any.whl |
Total release size: 654.7 kB
Release files / agent_voice_input-0.6.0.tar.gz
| Download URL | agent_voice_input-0.6.0.tar.gz |
|---|---|
| Size | 425.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76a9ebd3e1052b8d76521e673b61dc1dbfd791cea2208334b4d6a6d0cb8cdc1c
|
|
BLAKE2b-256 checksum How to use checksums |
550bce2b440e2daa1c223a1ff7f11ae1e30f9b680fa18d09029cef3410c1ac5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / agent_voice_input-0.6.0-py3-none-any.whl
| Download URL | agent_voice_input-0.6.0-py3-none-any.whl |
|---|---|
| Size | 229.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
897c6f50b0812335bfc89baa81e8e39c983fdb5201ab18c29ba2385f3f3618e1
|
|
BLAKE2b-256 checksum How to use checksums |
10a414ba899e35a65d49b528d76eb1fbee6fed0466ec09b38702128c034a5a6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for agent-voice-input 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agent_voice_input-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.