Quick transcription using Mistral's Voxtral API with sox and Keyboard Maestro (or similar).
brew install soxGet a Mistral API key from: https://console.mistral.ai/
Add to your ~/.secrets or ~/.zshrc:
export MISTRAL_API_KEY="your-api-key-here"Trigger: Your preferred hotkey (e.g., F13)
Action: Execute Shell Script
PID_FILE="/tmp/voxtral_recording.pid"; AUDIO_FILE="/tmp/voxtral_audio.wav"; if [ -f "$PID_FILE" ] && ps -p $(cat "$PID_FILE") >/dev/null 2>&1; then exit 0; fi; rm -f "$AUDIO_FILE"; sox -d -t wav -r 16000 -c 1 -b 16 "$AUDIO_FILE" >/dev/null 2>&1 & echo $! > "$PID_FILE"Trigger: Same key release (or different hotkey)
Action: Execute Shell Script
PID_FILE="/tmp/voxtral_recording.pid"; AUDIO_FILE="/tmp/voxtral_audio.wav"; API_KEY="${MISTRAL_API_KEY:-}"; if [ -z "$API_KEY" ]; then exit 1; fi; if [ ! -f "$PID_FILE" ] || ! ps -p $(cat "$PID_FILE") >/dev/null 2>&1; then exit 0; fi; kill $(cat "$PID_FILE") 2>/dev/null; rm -f "$PID_FILE"; sleep 0.5; RESPONSE=$(curl -s -X POST https://api.mistral.ai/v1/audio/transcriptions -H "Authorization: Bearer $API_KEY" -F "model=voxtral-mini-2507" -F "file=@$AUDIO_FILE" 2>&1); if [ $? -ne 0 ]; then exit 1; fi; if echo "$RESPONSE" | grep -q '"error"'; then exit 1; fi; TEXT=$(echo "$RESPONSE" | grep -o '"text":"[^"]*"' | cut -d'"' -f4); if [ -z "$TEXT" ]; then exit 1; fi; echo "$TEXT" | pbcopy; osascript -e "tell application \"System Events\" to keystroke \"$TEXT\""; rm -f "$AUDIO_FILE"- Start: Records audio using sox at 16kHz mono 16-bit WAV (Voxtral requirement)
- Stop: Sends audio to Mistral's Voxtral API, types result at cursor
- "sox not found": Run
brew install sox - "MISTRAL_API_KEY not set": Add the export to your shell config
- No transcription: Check your API key is valid at console.mistral.ai
MIT - Use at your own risk.