Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat: add Mistral Voxtral transcription support (#227)
Gabriel Steind53d9f288d90
diff --git a/.env.example b/.env.exampleindex cddc9e315..cd362ab87 100644--- a/.env.example+++ b/.env.example@@ -29,5 +29,9 @@ GEMINI_API_KEY=your_gemini_api_key_here# Get your API key from: https://console.groq.com/keysGROQ_API_KEY=your_groq_api_key_here+# Mistral API Configuration (optional - for Voxtral transcription)+# Get your API key from: https://console.mistral.ai/api-keys+MISTRAL_API_KEY=your_mistral_api_key_here+# Optional: Debug modeOPENWHISPR_LOG_LEVEL=debugdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex efba4709e..919fd56a7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added+- **Mistral Voxtral Transcription**: Added Mistral as a cloud transcription provider with Voxtral Mini model and custom dictionary support via context_bias+## [1.4.2] - 2026-02-07### Fixeddiff --git a/README.md b/README.mdindex d6b046c9b..7bb0c4031 100644--- a/README.md+++ b/README.md@@ -75,6 +75,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file# ANTHROPIC_API_KEY=your_anthropic_key# GEMINI_API_KEY=your_gemini_key# GROQ_API_KEY=your_groq_key+ # MISTRAL_API_KEY=your_mistral_key```**Method B - In-app configuration**:@@ -194,6 +195,13 @@ sudo pacman -S xdotool**Wayland (Modern Linux Desktop)**:+**Recommended:** Install `wl-clipboard` for reliable clipboard sharing between Wayland apps:+```bash+sudo apt install wl-clipboard # Debian/Ubuntu+sudo dnf install wl-clipboard # Fedora/RHEL+sudo pacman -S wl-clipboard # Arch+```+Choose **one** of the following paste tools:**Option 1: wtype** (requires virtual keyboard protocol support)@@ -492,6 +500,9 @@ GEMINI_API_KEY=your_gemini_api_key_here# Optional: Groq API Configuration (ultra-fast inference)GROQ_API_KEY=your_groq_api_key_here+# Optional: Mistral API Configuration (Voxtral transcription)+MISTRAL_API_KEY=your_mistral_api_key_here+# Optional: Debug modeDEBUG=false```@@ -587,7 +598,7 @@ OpenWhispr is designed with privacy and security in mind:6. **Text not pasting**:- macOS: Check accessibility permissions (System Settings → Privacy & Security → Accessibility)- Linux X11: Install `xdotool`- - Linux Wayland: Install `wtype` or `ydotool` (ensure `ydotoold` daemon is running)+ - Linux Wayland: Install `wtype` or `ydotool` for paste simulation (ensure `ydotoold` daemon is running)- All platforms: Text is always copied to clipboard - use Ctrl+V (Cmd+V on macOS) to paste manually7. **Panel position**: If the panel appears off-screen, restart the app to reset positiondiff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.mdindex 4f3fd1ad7..a9d93e979 100644--- a/TROUBLESHOOTING.md+++ b/TROUBLESHOOTING.md@@ -83,6 +83,22 @@4. Clear model cache: `rm -rf ~/.cache/openwhispr/whisper-models`5. Try cloud transcription as fallback+### Wayland Clipboard Issues (Linux)++**Symptoms:** Paste simulation succeeds but target app shows "clipboard is empty", "no image on clipboard", or "contents not available in the requested format"++**Cause:** Electron's main-process clipboard API uses X11 selections (via XWayland), which native Wayland apps cannot read.++**Fix:**+1. Install `wl-clipboard` for the most reliable Wayland clipboard support:+ - Debian/Ubuntu: `sudo apt install wl-clipboard`+ - Fedora/RHEL: `sudo dnf install wl-clipboard`+ - Arch: `sudo pacman -S wl-clipboard`+2. Ensure a paste tool is installed (`wtype`, `ydotool`, or `xdotool`)+3. Restart OpenWhispr after installing++OpenWhispr tries clipboard methods in order: `wl-copy` (most reliable) → renderer `navigator.clipboard` → X11 fallback.+### Windows-Specific IssuesSee [WINDOWS_TROUBLESHOOTING.md](WINDOWS_TROUBLESHOOTING.md) for:diff --git a/electron-builder.json b/electron-builder.jsonindex 0afd66d49..054270c26 100644--- a/electron-builder.json+++ b/electron-builder.json@@ -156,10 +156,10 @@},"deb": {"afterRemove": "resources/linux/after-remove.sh",- "fpm": ["--deb-recommends", "xdotool", "--deb-recommends", "wtype"]+ "fpm": ["--deb-recommends", "xdotool", "--deb-recommends", "wtype", "--deb-recommends", "wl-clipboard"]},"rpm": {- "fpm": ["--rpm-tag", "Recommends: xdotool", "--rpm-tag", "Recommends: wtype"]+ "fpm": ["--rpm-tag", "Recommends: xdotool", "--rpm-tag", "Recommends: wtype", "--rpm-tag", "Recommends: wl-clipboard"]},"nsis": {"oneClick": false,diff --git a/package.json b/package.jsonindex a58619514..869737ca4 100644--- a/package.json+++ b/package.json@@ -40,6 +40,7 @@"format:js": "eslint . --fix && cd src && eslint . --fix && prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"","format": "npm run format:js","format:check": "eslint . && cd src && eslint . && prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\"",+ "lint": "eslint . && cd src && eslint .","typecheck": "cd src && tsc --noEmit","quality-check": "npm run format:check && npm run typecheck","preview": "cd src && vite preview",diff --git a/preload.js b/preload.jsindex 629dbb4a0..6ffd015cc 100644--- a/preload.js+++ b/preload.js@@ -191,6 +191,11 @@ contextBridge.exposeInMainWorld("electronAPI", {getGroqKey: () => ipcRenderer.invoke("get-groq-key"),saveGroqKey: (key) => ipcRenderer.invoke("save-groq-key", key),+ // Mistral API+ getMistralKey: () => ipcRenderer.invoke("get-mistral-key"),+ saveMistralKey: (key) => ipcRenderer.invoke("save-mistral-key", key),+ proxyMistralTranscription: (data) => ipcRenderer.invoke("proxy-mistral-transcription", data),+// Custom endpoint API keysgetCustomTranscriptionKey: () => ipcRenderer.invoke("get-custom-transcription-key"),saveCustomTranscriptionKey: (key) => ipcRenderer.invoke("save-custom-transcription-key", key),diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex d24e5d341..46e002af5 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -77,6 +77,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {cloudTranscriptionBaseUrl,openaiApiKey,groqApiKey,+ mistralApiKey,customTranscriptionApiKey,setCustomTranscriptionApiKey,dictationKey,@@ -85,6 +86,7 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {setDictationKey,setOpenaiApiKey,setGroqApiKey,+ setMistralApiKey,updateTranscriptionSettings,preferredLanguage,} = useSettings();@@ -454,6 +456,8 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {setOpenaiApiKey={setOpenaiApiKey}groqApiKey={groqApiKey}setGroqApiKey={setGroqApiKey}+ mistralApiKey={mistralApiKey}+ setMistralApiKey={setMistralApiKey}customTranscriptionApiKey={customTranscriptionApiKey}setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex b0f6c1702..2c022f7ad 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -134,6 +134,8 @@ interface TranscriptionSectionProps {setOpenaiApiKey: (key: string) => void;groqApiKey: string;setGroqApiKey: (key: string) => void;+ mistralApiKey: string;+ setMistralApiKey: (key: string) => void;customTranscriptionApiKey: string;setCustomTranscriptionApiKey: (key: string) => void;cloudTranscriptionBaseUrl?: string;@@ -167,6 +169,8 @@ function TranscriptionSection({setOpenaiApiKey,groqApiKey,setGroqApiKey,+ mistralApiKey,+ setMistralApiKey,customTranscriptionApiKey,setCustomTranscriptionApiKey,cloudTranscriptionBaseUrl,@@ -336,6 +340,8 @@ function TranscriptionSection({setOpenaiApiKey={setOpenaiApiKey}groqApiKey={groqApiKey}setGroqApiKey={setGroqApiKey}+ mistralApiKey={mistralApiKey}+ setMistralApiKey={setMistralApiKey}customTranscriptionApiKey={customTranscriptionApiKey}setCustomTranscriptionApiKey={setCustomTranscriptionApiKey}cloudTranscriptionBaseUrl={cloudTranscriptionBaseUrl}@@ -606,6 +612,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPageanthropicApiKey,geminiApiKey,groqApiKey,+ mistralApiKey,dictationKey,activationMode,setActivationMode,@@ -629,6 +636,7 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPagesetAnthropicApiKey,setGeminiApiKey,setGroqApiKey,+ setMistralApiKey,customTranscriptionApiKey,setCustomTranscriptionApiKey,customReasoningApiKey,diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsxindex f347abf0e..cf1e875c7 100644--- a/src/components/TranscriptionModelPicker.tsx+++ b/src/components/TranscriptionModelPicker.tsx@@ -189,6 +189,8 @@ interface TranscriptionModelPickerProps {setOpenaiApiKey: (key: string) => void;groqApiKey: string;setGroqApiKey: (key: string) => void;+ mistralApiKey: string;+ setMistralApiKey: (key: string) => void;customTranscriptionApiKey?: string;setCustomTranscriptionApiKey?: (key: string) => void;cloudTranscriptionBaseUrl?: string;@@ -200,6 +202,7 @@ interface TranscriptionModelPickerProps {const CLOUD_PROVIDER_TABS = [{ id: "openai", name: "OpenAI" },{ id: "groq", name: "Groq", recommended: true },+ { id: "mistral", name: "Mistral" },{ id: "custom", name: "Custom" },];@@ -262,6 +265,8 @@ export default function TranscriptionModelPicker({setOpenaiApiKey,groqApiKey,setGroqApiKey,+ mistralApiKey,+ setMistralApiKey,customTranscriptionApiKey = "",setCustomTranscriptionApiKey,cloudTranscriptionBaseUrl = "",@@ -804,9 +809,11 @@ export default function TranscriptionModelPicker({<buttontype="button"onClick={createExternalLinkHandler(- selectedCloudProvider === "groq"- ? "https://console.groq.com/keys"- : "https://platform.openai.com/api-keys"+ {+ groq: "https://console.groq.com/keys",+ mistral: "https://console.mistral.ai/api-keys",+ openai: "https://platform.openai.com/api-keys",+ }[selectedCloudProvider] || "https://platform.openai.com/api-keys")}className="text-[11px] text-white/70 hover:text-white transition-colors cursor-pointer">@@ -814,8 +821,16 @@ export default function TranscriptionModelPicker({</button></div><ApiKeyInput- apiKey={selectedCloudProvider === "groq" ? groqApiKey : openaiApiKey}- setApiKey={selectedCloudProvider === "groq" ? setGroqApiKey : setOpenaiApiKey}+ apiKey={+ { groq: groqApiKey, mistral: mistralApiKey, openai: openaiApiKey }[+ selectedCloudProvider+ ] || openaiApiKey+ }+ setApiKey={+ { groq: setGroqApiKey, mistral: setMistralApiKey, openai: setOpenaiApiKey }[+ selectedCloudProvider+ ] || setOpenaiApiKey+ }label=""helpText=""/>diff --git a/src/config/constants.ts b/src/config/constants.tsindex dc6884eda..8af7a47b7 100644--- a/src/config/constants.ts+++ b/src/config/constants.ts@@ -69,6 +69,7 @@ export const API_ENDPOINTS = {ANTHROPIC: "https://api.anthropic.com/v1/messages",GEMINI: "https://generativelanguage.googleapis.com/v1beta",GROQ_BASE: "https://api.groq.com/openai/v1",+ MISTRAL_BASE: "https://api.mistral.ai/v1",TRANSCRIPTION_BASE: DEFAULT_TRANSCRIPTION_BASE,TRANSCRIPTION: buildApiUrl(DEFAULT_TRANSCRIPTION_BASE, "/audio/transcriptions"),} as const;diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex 2021f2727..367756e99 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -12,6 +12,7 @@ const REASONING_CACHE_TTL = 30000; // 30 secondsconst PLACEHOLDER_KEYS = {openai: "your_openai_api_key_here",groq: "your_groq_api_key_here",+ mistral: "your_mistral_api_key_here",};const isValidApiKey = (key, provider = "openai") => {@@ -621,6 +622,14 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (!apiKey) {apiKey = null;}+ } else if (provider === "mistral") {+ apiKey = await window.electronAPI.getMistralKey?.();+ if (!isValidApiKey(apiKey, "mistral")) {+ apiKey = localStorage.getItem("mistralApiKey");+ }+ if (!isValidApiKey(apiKey, "mistral")) {+ throw new Error("Mistral API key not found. Please set your API key in the Control Panel.");+ }} else if (provider === "groq") {// Try to get Groq API keyapiKey = await window.electronAPI.getGroqKey?.();@@ -1243,7 +1252,43 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);const endpoint = this.getTranscriptionEndpoint();const isCustomEndpoint =provider === "custom" ||- (!endpoint.includes("api.openai.com") && !endpoint.includes("api.groq.com"));+ (!endpoint.includes("api.openai.com") &&+ !endpoint.includes("api.groq.com") &&+ !endpoint.includes("api.mistral.ai"));++ const apiCallStart = performance.now();++ // Mistral uses x-api-key auth (not Bearer) and doesn't allow browser CORS — proxy through main process+ if (provider === "mistral" && window.electronAPI?.proxyMistralTranscription) {+ const audioBuffer = await optimizedAudio.arrayBuffer();+ const proxyData = { audioBuffer, model, language };++ if (dictionaryPrompt) {+ const tokens = dictionaryPrompt+ .split(",")+ .flatMap((entry) => entry.trim().split(/\s+/))+ .filter(Boolean)+ .slice(0, 100);+ if (tokens.length > 0) {+ proxyData.contextBias = tokens;+ }+ }++ const result = await window.electronAPI.proxyMistralTranscription(proxyData);+ const proxyText = result?.text;++ if (proxyText && proxyText.trim().length > 0) {+ timings.transcriptionProcessingDurationMs = Math.round(performance.now() - apiCallStart);+ const reasoningStart = performance.now();+ const text = await this.processTranscription(proxyText, "mistral");+ timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);++ const source = (await this.isReasoningAvailable()) ? "mistral-reasoned" : "mistral";+ return { success: true, text, source, timings };+ }++ throw new Error("No text transcribed - Mistral response was empty");+ }logger.debug("Making transcription API request",@@ -1281,7 +1326,6 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);"transcription");- const apiCallStart = performance.now();const response = await fetch(endpoint, {method: "POST",headers,@@ -1470,6 +1514,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (trimmedModel) {const isGroqModel = trimmedModel.startsWith("whisper-large-v3");const isOpenAIModel = trimmedModel.startsWith("gpt-4o") || trimmedModel === "whisper-1";+ const isMistralModel = trimmedModel.startsWith("voxtral-");if (provider === "groq" && isGroqModel) {return trimmedModel;@@ -1477,11 +1522,16 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);if (provider === "openai" && isOpenAIModel) {return trimmedModel;}+ if (provider === "mistral" && isMistralModel) {+ return trimmedModel;+ }// Model doesn't match provider - fall through to default}// Return provider-appropriate default- return provider === "groq" ? "whisper-large-v3-turbo" : "gpt-4o-mini-transcribe";+ if (provider === "groq") return "whisper-large-v3-turbo";+ if (provider === "mistral") return "voxtral-mini-latest";+ return "gpt-4o-mini-transcribe";} catch (error) {return "gpt-4o-mini-transcribe";}@@ -1531,6 +1581,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);base = currentBaseUrl.trim() || API_ENDPOINTS.TRANSCRIPTION_BASE;} else if (currentProvider === "groq") {base = API_ENDPOINTS.GROQ_BASE;+ } else if (currentProvider === "mistral") {+ base = API_ENDPOINTS.MISTRAL_BASE;} else {// OpenAI or other standard providersbase = API_ENDPOINTS.TRANSCRIPTION_BASE;@@ -1621,7 +1673,8 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);return true;} catch (error) {const message =- error?.message ?? (typeof error?.toString === "function" ? error.toString() : String(error));+ error?.message ??+ (typeof error?.toString === "function" ? error.toString() : String(error));this.onError?.({title: "Paste Error",description: `Failed to paste text. Please check accessibility permissions. ${message}`,diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.jsindex 92d41c52f..8d0a23e99 100644--- a/src/helpers/clipboard.js+++ b/src/helpers/clipboard.js@@ -47,18 +47,12 @@ const RESTORE_DELAYS = {linux: 200,};-/**- * Write text to clipboard via renderer's WebContents (for Wayland persistent ownership).- * Uses JSON.stringify to safely embed text in executed JS. Returns a Promise.- */function writeClipboardInRenderer(webContents, text) {if (!webContents || !webContents.executeJavaScript) {return Promise.reject(new Error("Invalid webContents for clipboard write"));}const escaped = JSON.stringify(text);- return webContents.executeJavaScript(- `navigator.clipboard.writeText(${escaped})`- );+ return webContents.executeJavaScript(`navigator.clipboard.writeText(${escaped})`);}class ClipboardManager {@@ -71,12 +65,30 @@ class ClipboardManager {this.fastPasteChecked = false;}- _isWaylandWithRenderer() {+ _isWayland() {if (process.platform !== "linux") return false;const { isWayland } = getLinuxSessionInfo();return isWayland;}+ _writeClipboardWayland(text, webContents) {+ if (this.commandExists("wl-copy")) {+ try {+ const result = spawnSync("wl-copy", ["--", text], { timeout: 2000 });+ if (result.status === 0) {+ clipboard.writeText(text);+ return;+ }+ } catch {}+ }++ if (webContents && !webContents.isDestroyed()) {+ writeClipboardInRenderer(webContents, text).catch(() => {});+ }++ clipboard.writeText(text);+ }+getNircmdPath() {if (this.nircmdChecked) {return this.nircmdPath;@@ -220,24 +232,12 @@ class ClipboardManager {originalClipboard.substring(0, 50) + "...");- const useRendererClipboard =- platform === "linux" &&- this._isWaylandWithRenderer() &&- webContents &&- !webContents.isDestroyed();- if (useRendererClipboard) {- try {- await writeClipboardInRenderer(webContents, text);- this.safeLog("📋 Text copied to clipboard (Wayland renderer):", text.substring(0, 50) + "...");- } catch (err) {- this.safeLog("Wayland renderer clipboard failed, using main process:", err?.message);- clipboard.writeText(text);- this.safeLog("📋 Text copied to clipboard:", text.substring(0, 50) + "...");- }+ if (platform === "linux" && this._isWayland()) {+ this._writeClipboardWayland(text, webContents);} else {clipboard.writeText(text);- this.safeLog("📋 Text copied to clipboard:", text.substring(0, 50) + "...");}+ this.safeLog("📋 Text copied to clipboard:", text.substring(0, 50) + "...");if (platform === "darwin") {method = this.resolveFastPasteBinary() ? "cgevent" : "applescript";@@ -783,10 +783,8 @@ class ClipboardManager {if (code === 0) {debugLogger.debug("Paste successful", { cmd: tool.cmd }, "clipboard");setTimeout(() => {- if (isWayland && webContents && !webContents.isDestroyed()) {- writeClipboardInRenderer(webContents, originalClipboard).catch((err) =>- this.safeLog("Wayland clipboard restore failed:", err?.message)- );+ if (isWayland) {+ this._writeClipboardWayland(originalClipboard, webContents);} else {clipboard.writeText(originalClipboard);}@@ -1095,18 +1093,8 @@ Would you like to open System Settings now?`;}async writeClipboard(text, webContents = null) {- const useRendererClipboard =- process.platform === "linux" &&- this._isWaylandWithRenderer() &&- webContents &&- !webContents.isDestroyed();- if (useRendererClipboard) {- try {- await writeClipboardInRenderer(webContents, text);- } catch (err) {- this.safeLog("Wayland renderer clipboard failed in writeClipboard, using main process:", err?.message);- clipboard.writeText(text);- }+ if (process.platform === "linux" && this._isWayland()) {+ this._writeClipboardWayland(text, webContents);} else {clipboard.writeText(text);}diff --git a/src/helpers/environment.js b/src/helpers/environment.jsindex 26ae89f65..6da6610a4 100644--- a/src/helpers/environment.js+++ b/src/helpers/environment.js@@ -7,6 +7,7 @@ const PERSISTED_KEYS = ["ANTHROPIC_API_KEY","GEMINI_API_KEY","GROQ_API_KEY",+ "MISTRAL_API_KEY","CUSTOM_TRANSCRIPTION_API_KEY","CUSTOM_REASONING_API_KEY","LOCAL_TRANSCRIPTION_PROVIDER",@@ -83,6 +84,14 @@ class EnvironmentManager {return this._saveKey("GROQ_API_KEY", key);}+ getMistralKey() {+ return this._getKey("MISTRAL_API_KEY");+ }++ saveMistralKey(key) {+ return this._saveKey("MISTRAL_API_KEY", key);+ }+getCustomTranscriptionKey() {return this._getKey("CUSTOM_TRANSCRIPTION_API_KEY");}diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 5e03a77e1..1ff711fcc 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -8,6 +8,8 @@ const debugLogger = require("./debugLogger");const GnomeShortcutManager = require("./gnomeShortcut");const AssemblyAiStreaming = require("./assemblyAiStreaming");+const MISTRAL_TRANSCRIPTION_URL = "https://api.mistral.ai/v1/audio/transcriptions";+class IPCHandlers {constructor(managers) {this.environmentManager = managers.environmentManager;@@ -684,6 +686,53 @@ class IPCHandlers {return this.environmentManager.saveGroqKey(key);});+ ipcMain.handle("get-mistral-key", async () => {+ return this.environmentManager.getMistralKey();+ });++ ipcMain.handle("save-mistral-key", async (event, key) => {+ return this.environmentManager.saveMistralKey(key);+ });++ // Proxy Mistral transcription through main process to avoid CORS+ ipcMain.handle(+ "proxy-mistral-transcription",+ async (event, { audioBuffer, model, language, contextBias }) => {+ const apiKey = this.environmentManager.getMistralKey();+ if (!apiKey) {+ throw new Error("Mistral API key not configured");+ }++ const formData = new FormData();+ const audioBlob = new Blob([Buffer.from(audioBuffer)], { type: "audio/webm" });+ formData.append("file", audioBlob, "audio.webm");+ formData.append("model", model || "voxtral-mini-latest");+ if (language && language !== "auto") {+ formData.append("language", language);+ }+ if (contextBias && contextBias.length > 0) {+ for (const token of contextBias) {+ formData.append("context_bias", token);+ }+ }++ const response = await fetch(MISTRAL_TRANSCRIPTION_URL, {+ method: "POST",+ headers: {+ "x-api-key": apiKey,+ },+ body: formData,+ });++ if (!response.ok) {+ const errorText = await response.text();+ throw new Error(`Mistral API Error: ${response.status} ${errorText}`);+ }++ return await response.json();+ }+ );+ipcMain.handle("get-custom-transcription-key", async () => {return this.environmentManager.getCustomTranscriptionKey();});diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.tsindex 97e089b33..98729c968 100644--- a/src/hooks/useSettings.ts+++ b/src/hooks/useSettings.ts@@ -46,6 +46,7 @@ export interface ApiKeySettings {anthropicApiKey: string;geminiApiKey: string;groqApiKey: string;+ mistralApiKey: string;customTranscriptionApiKey: string;customReasoningApiKey: string;}@@ -273,6 +274,11 @@ export function useSettings() {deserialize: String,});+ const [mistralApiKey, setMistralApiKeyLocal] = useLocalStorage("mistralApiKey", "", {+ serialize: String,+ deserialize: String,+ });+// Theme settingconst [theme, setTheme] = useLocalStorage<"light" | "dark" | "auto">("theme", "auto", {serialize: String,@@ -338,6 +344,10 @@ export function useSettings() {const envKey = await window.electronAPI.getGroqKey?.();if (envKey) setGroqApiKeyLocal(envKey);}+ if (!mistralApiKey) {+ const envKey = await window.electronAPI.getMistralKey?.();+ if (envKey) setMistralApiKeyLocal(envKey);+ }if (!customTranscriptionApiKey) {const envKey = await window.electronAPI.getCustomTranscriptionKey?.();if (envKey) setCustomTranscriptionApiKeyLocal(envKey);@@ -371,7 +381,7 @@ export function useSettings() {}, 1000);const invalidateApiKeyCaches = useCallback(- (provider?: "openai" | "anthropic" | "gemini" | "groq" | "custom") => {+ (provider?: "openai" | "anthropic" | "gemini" | "groq" | "mistral" | "custom") => {if (provider) {ReasoningService.clearApiKeyCache(provider);}@@ -417,6 +427,15 @@ export function useSettings() {[setGroqApiKeyLocal, invalidateApiKeyCaches]);+ const setMistralApiKey = useCallback(+ (key: string) => {+ setMistralApiKeyLocal(key);+ window.electronAPI?.saveMistralKey?.(key);+ invalidateApiKeyCaches("mistral");+ },+ [setMistralApiKeyLocal, invalidateApiKeyCaches]+ );+const setCustomTranscriptionApiKey = useCallback((key: string) => {setCustomTranscriptionApiKeyLocal(key);@@ -596,8 +615,9 @@ export function useSettings() {if (keys.anthropicApiKey !== undefined) setAnthropicApiKey(keys.anthropicApiKey);if (keys.geminiApiKey !== undefined) setGeminiApiKey(keys.geminiApiKey);if (keys.groqApiKey !== undefined) setGroqApiKey(keys.groqApiKey);+ if (keys.mistralApiKey !== undefined) setMistralApiKey(keys.mistralApiKey);},- [setOpenaiApiKey, setAnthropicApiKey, setGeminiApiKey, setGroqApiKey]+ [setOpenaiApiKey, setAnthropicApiKey, setGeminiApiKey, setGroqApiKey, setMistralApiKey]);return {@@ -625,6 +645,7 @@ export function useSettings() {anthropicApiKey,geminiApiKey,groqApiKey,+ mistralApiKey,dictationKey,theme,setUseLocalWhisper,@@ -649,6 +670,7 @@ export function useSettings() {setAnthropicApiKey,setGeminiApiKey,setGroqApiKey,+ setMistralApiKey,customTranscriptionApiKey,setCustomTranscriptionApiKey,customReasoningApiKey,diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.jsonindex 20443d3b8..104e63025 100644--- a/src/models/modelRegistryData.json+++ b/src/models/modelRegistryData.json@@ -123,6 +123,18 @@"description": "216x real-time speed"}]+ },+ {+ "id": "mistral",+ "name": "Mistral",+ "baseUrl": "https://api.mistral.ai/v1",+ "models": [+ {+ "id": "voxtral-mini-latest",+ "name": "Voxtral Mini",+ "description": "Fast multilingual transcription"+ }+ ]}],"cloudProviders": [diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex 79789e0dc..a00e17bbf 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -1113,7 +1113,9 @@ class ReasoningService extends BaseReasoningService {}}- clearApiKeyCache(provider?: "openai" | "anthropic" | "gemini" | "groq" | "custom"): void {+ clearApiKeyCache(+ provider?: "openai" | "anthropic" | "gemini" | "groq" | "mistral" | "custom"+ ): void {if (provider) {if (provider !== "custom") {this.apiKeyCache.delete(provider);diff --git a/src/types/electron.ts b/src/types/electron.tsindex 48ed531cb..ef41f8509 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -357,6 +357,16 @@ declare global {getGroqKey: () => Promise<string | null>;saveGroqKey: (key: string) => Promise<void>;+ // Mistral API key management+ getMistralKey: () => Promise<string | null>;+ saveMistralKey: (key: string) => Promise<void>;+ proxyMistralTranscription: (data: {+ audioBuffer: ArrayBuffer;+ model?: string;+ language?: string;+ contextBias?: string[];+ }) => Promise<{ text: string }>;+// Custom endpoint API keysgetCustomTranscriptionKey?: () => Promise<string | null>;saveCustomTranscriptionKey?: (key: string) => Promise<void>;