Mistral Voxtral Dictation
Relevant source files
The following files were used as context for generating this wiki page:
Mistral Voxtral Dictation is a privacy-focused Automatic Speech Recognition (ASR) system integrated into the Ownkey Keyboard. It follows a "Bring Your Own Key" (BYOK) model, allowing users to perform voice-to-text transcriptions using the Mistral AI API or any compatible OpenAI-style transcription endpoint. Unlike standard system-level voice input, this system routes voice data through an internal dictation flow directly within the keyboard's Input Method Editor (IME) layer.
Sources: README.md:10-15, VOXTRAL_KEYBOARD_PLAN.md:21-25, VOXTRAL_FEATURE_SCOPE.md:13-17
Architecture and Components
The dictation system is composed of several layers that handle audio capture, API communication, and state management. The orchestration is managed by an internal dictation manager that bridges the physical keyboard interface with networked ASR services.
Core Components
| Component | Description |
|---|---|
VoxtralDictationManager | Orchestrates the internal dictation flow within the keyboard. |
AudioRecorder | Handles capturing raw voice data from the device microphone. |
TranscriptionClient | Interface for converting captured audio bytes into text strings. |
VoxtralRelayTranscriptionClient | Concrete implementation that communicates with the Mistral/OpenAI API. |
Sources: VOXTRAL_KEYBOARD_PLAN.md:21-30, TranscriptionClient.kt:28-34
Data Flow Diagram
The following diagram illustrates the lifecycle of a voice input request, from user initiation to text insertion.
Transcription Client Implementation
The VoxtralRelayTranscriptionClient is the primary driver for network communication. It uses a multipart/form-data request to send audio bytes to the configured endpoint.
Configuration Defaults
The client is pre-configured with Mistral-specific defaults but allows user overrides for self-hosted or alternative compatibility.
| Parameter | Default Value |
|---|---|
| Endpoint URL | https://api.mistral.ai/v1/audio/transcriptions |
| Model | voxtral-mini-latest |
| Connect Timeout | 30,000 ms |
| Read Timeout | 60,000 ms |
| Max Retries | 2 |
Sources: TranscriptionClient.kt:45-56, README.md:38-42
Request Structure
The client constructs a POST request with the following characteristics:
- Authentication: Uses a Bearer token provided by the user's API key.
- Payload: A
multipart/form-databody containing the model ID, an optional language hint (ISO code), and the audio file bytes. - Error Handling: Specifically catches
VoxtralHttpExceptionfor status codes like 408 (Timeout), 429 (Rate Limit), and 5xx (Server Error) to trigger retry logic.
Sources: TranscriptionClient.kt:100-112, TranscriptionClient.kt:145-155
Privacy and Security
The system is designed with a strict privacy model. API keys are stored using the Android Keystore-backed encrypted preferences (EncryptedSharedPreferences) rather than plaintext.
- Network Transparency: Users are informed that audio data leaves the device to reach the configured endpoint, but the app itself performs no local monitoring of private content.
- Data Sanitization: Backup and export functions specifically sanitize sensitive API key fields to prevent accidental exposure.
- Permissions: The system requires the
android.permission.RECORD_AUDIOpermission for local capture andandroid.permission.INTERNETfor cloud-based transcription.
Sources: README.md:46-52, VOXTRAL_KEYBOARD_PLAN.md:37-43, AndroidManifest.xml:8-14
User Configuration and UX
The keyboard provides a dedicated "AI" settings screen for Voxtral management. Users can configure recognition quality through ISO language hints (e.g., "en" or "nl") to improve transcription accuracy.
Sequence of Dictation Operation
Summary
Mistral Voxtral Dictation provides a flexible, BYOK-driven alternative to proprietary system voice inputs. By integrating directly with the Mistral API via a structured TranscriptionClient, the system ensures that voice data is handled according to the user's chosen provider policy while maintaining secure local credential storage via the Android Keystore. Its architecture supports both the default Mistral cloud path and custom, OpenAI-compatible local or relay endpoints.