Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(tinfoil): add batch STT (#1120)

Daniel MS7922bcb34caf
diff --git a/preload.js b/preload.js
index 3229a2bc9..9c8608f57 100644
--- a/preload.js
+++ b/preload.js
@@ -381,6 +381,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
saveCortiClientSecret: (key) => ipcRenderer.invoke("save-corti-client-secret", key),
proxyCortiTranscription: (data) => ipcRenderer.invoke("proxy-corti-transcription", data),
getTinfoilChatModels: () => ipcRenderer.invoke("get-tinfoil-chat-models"),
+ proxyTinfoilTranscription: (data) => ipcRenderer.invoke("proxy-tinfoil-transcription", data),
// Custom endpoint API keys
getCustomTranscriptionKey: () => ipcRenderer.invoke("get-custom-transcription-key"),
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 52741693c..08edc340c 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -225,9 +225,6 @@ interface TranscriptionSectionProps {
}) => void;
}
-// Providers that forward the live-preview flag (see STREAMING_PROVIDERS in audioManager.js).
-const CLOUD_PREVIEW_PROVIDERS = new Set(["tinfoil"]);
-
function TranscriptionSection({
isSignedIn,
startOnboarding,
@@ -373,12 +370,7 @@ function TranscriptionSection({
onSelect={handleTranscriptionModeSelect}
/>
- {transcriptionMode === "providers" && (
- <>
- {renderTranscriptionPicker("cloud")}
- {CLOUD_PREVIEW_PROVIDERS.has(cloudTranscriptionProvider) && renderPreviewToggle()}
- </>
- )}
+ {transcriptionMode === "providers" && renderTranscriptionPicker("cloud")}
{transcriptionMode === "local" && (
<>
{renderTranscriptionPicker("local")}
diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsx
index c85d08c5c..1d9095a4c 100644
--- a/src/components/TranscriptionModelPicker.tsx
+++ b/src/components/TranscriptionModelPicker.tsx
@@ -26,6 +26,7 @@ import {
} from "../utils/modelPickerStyles";
import { useSettingsStore } from "../stores/settingsStore";
import { getRemoteProviderIcon } from "../utils/providerIcons";
+import { createExternalLinkHandler } from "../utils/externalLinks";
import { API_ENDPOINTS, normalizeBaseUrl } from "../config/constants";
import { GetApiKeyLink } from "./ui/GetApiKeyLink";
import { getCachedPlatform } from "../utils/platform";
@@ -276,6 +277,8 @@ const PROVIDER_CREDENTIALS: Record<
const VALID_CLOUD_PROVIDER_IDS = CLOUD_PROVIDER_TABS.map((p) => p.id);
+const TINFOIL_AUDIO_DOCS_URL = "https://docs.tinfoil.sh/models/audio";
+
const LOCAL_PROVIDER_TABS: Array<{ id: string; name: string; disabled?: boolean }> = [
{ id: "whisper", name: "OpenAI" },
{ id: "nvidia", name: "NVIDIA" },
@@ -1026,6 +1029,18 @@ export default function TranscriptionModelPicker({
onModelSelect={onCloudModelSelect}
colorScheme="purple"
/>
+ {selectedCloudProvider === "tinfoil" && (
+ <p className="text-xs text-muted-foreground/70">
+ {t("transcription.tinfoil.transportNote")}{" "}
+ <a
+ href={TINFOIL_AUDIO_DOCS_URL}
+ onClick={createExternalLinkHandler(TINFOIL_AUDIO_DOCS_URL)}
+ className="text-primary/70 hover:text-primary transition-colors"
+ >
+ {t("transcription.tinfoil.docsLink")}
+ </a>
+ </p>
+ )}
</div>
</div>
)}
diff --git a/src/components/notes/UploadAudioView.tsx b/src/components/notes/UploadAudioView.tsx
index baeea4591..09724d239 100644
--- a/src/components/notes/UploadAudioView.tsx
+++ b/src/components/notes/UploadAudioView.tsx
@@ -21,7 +21,7 @@ import { useUsage } from "../../hooks/useUsage";
import { useSettings } from "../../hooks/useSettings";
import { useStartOnboarding } from "../../hooks/useStartOnboarding";
import { withSessionRefresh } from "../../lib/auth";
-import { getAllReasoningModels } from "../../models/ModelRegistry";
+import { getAllReasoningModels, getBatchTranscriptionModel } from "../../models/ModelRegistry";
import {
useSettingsStore,
selectIsCloudCleanupMode,
@@ -84,8 +84,14 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
const usage = useUsage();
const isProUser = usage?.isSubscribed || usage?.isTrial;
- const { openaiApiKey, groqApiKey, xaiApiKey, mistralApiKey, customTranscriptionApiKey } =
- useSettings();
+ const {
+ openaiApiKey,
+ groqApiKey,
+ xaiApiKey,
+ mistralApiKey,
+ tinfoilApiKey,
+ customTranscriptionApiKey,
+ } = useSettings();
const {
useLocalWhisper,
@@ -187,7 +193,9 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
? xaiApiKey
: cloudTranscriptionProvider === "mistral"
? mistralApiKey
- : customTranscriptionApiKey;
+ : cloudTranscriptionProvider === "tinfoil"
+ ? tinfoilApiKey
+ : customTranscriptionApiKey;
if (!cancelled) setProviderReady(!!key);
}
return;
@@ -220,6 +228,7 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
groqApiKey,
xaiApiKey,
mistralApiKey,
+ tinfoilApiKey,
customTranscriptionApiKey,
cortiClientId,
cortiClientSecret,
@@ -236,7 +245,8 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
cloudTranscriptionProvider === "custom"
? t("notes.upload.custom")
: cloudTranscriptionProvider.charAt(0).toUpperCase() + cloudTranscriptionProvider.slice(1);
- return `${name} · ${cloudTranscriptionModel}`;
+ const model = getBatchTranscriptionModel(cloudTranscriptionProvider) ?? cloudTranscriptionModel;
+ return `${name} · ${model}`;
};
const getActiveApiKey = (): string => {
@@ -249,6 +259,8 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
return xaiApiKey;
case "mistral":
return mistralApiKey;
+ case "tinfoil":
+ return tinfoilApiKey;
case "custom":
return customTranscriptionApiKey || "";
default:
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 294d474a0..360903e5b 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -23,12 +23,13 @@ import {
isCloudCleanupMode,
isCloudDictationAgentMode,
} from "../stores/settingsStore";
-import { getTranscriptionProvider } from "../models/ModelRegistry";
+import { getBatchTranscriptionModel, getTranscriptionProvider } from "../models/ModelRegistry";
import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";
import {
isSelfHostedTranscription,
resolveSelfHostedTranscriptionModel,
} from "./selfHostedTranscription";
+import { resolveStreamingFallbackTarget } from "./transcriptionFallback";
import { detectAgentName } from "../config/agentDetection";
import { resolveDictationRouteKind, resolveDictationAgentReachability } from "./dictationRouting";
import { resolvePrompt } from "../config/prompts";
@@ -171,13 +172,13 @@ const STREAMING_PROVIDERS = {
window.electronAPI.dictationRealtimeWarmup({
...opts,
provider: "tinfoil-realtime",
- preview: getSettings().showTranscriptionPreview,
+ preview: true,
}),
start: (opts) =>
window.electronAPI.dictationRealtimeStart({
...opts,
provider: "tinfoil-realtime",
- preview: getSettings().showTranscriptionPreview,
+ preview: true,
}),
send: (buf) => window.electronAPI.dictationRealtimeSend(buf),
stop: () => window.electronAPI.dictationRealtimeStop(),
@@ -1694,6 +1695,41 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
const apiKey = await this.getAPIKey();
const optimizedAudio = audioBlob;
+ // Dispatch before endpoint resolution (which defaults to OpenAI and would leak
+ // the key). Self-hosted wins, so a leftover "tinfoil" provider isn't diverted here.
+ if (provider === "tinfoil" && !isSelfHostedTranscription(apiSettings)) {
+ if (!window.electronAPI?.proxyTinfoilTranscription) {
+ throw new Error("Tinfoil transcription is unavailable in this window");
+ }
+ const dictionaryPrompt = this.getCustomDictionaryPrompt();
+ const apiCallStart = performance.now();
+ const result = await window.electronAPI.proxyTinfoilTranscription({
+ audioBuffer: await optimizedAudio.arrayBuffer(),
+ language,
+ prompt: dictionaryPrompt || undefined,
+ });
+ if (result?.error) {
+ const err = new Error(result.error);
+ if (result.code) err.code = result.code;
+ if (result.messageKey) err.messageKey = result.messageKey;
+ throw err;
+ }
+ const proxyText = result?.text;
+ if (!proxyText?.trim()) {
+ throw new Error("No text transcribed - Tinfoil response was empty");
+ }
+ if (this.isDictionaryEcho(proxyText)) {
+ throw new Error("No audio detected");
+ }
+ timings.transcriptionProcessingDurationMs = Math.round(performance.now() - apiCallStart);
+ const reasoningStart = performance.now();
+ const text = await this.processTranscription(proxyText, "tinfoil");
+ timings.reasoningProcessingDurationMs = Math.round(performance.now() - reasoningStart);
+
+ const source = (await this.isReasoningAvailable()) ? "tinfoil-reasoned" : "tinfoil";
+ return { success: true, text, rawText: proxyText, source, timings };
+ }
+
const formData = new FormData();
// Determine the correct file extension based on the blob type
const mimeType = optimizedAudio.type || "audio/webm";
@@ -2101,6 +2137,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
return trimmedModel || "whisper-1";
}
+ if (provider === "tinfoil") {
+ return getBatchTranscriptionModel("tinfoil");
+ }
+
// Validate model matches provider to handle settings migration
if (trimmedModel) {
const isGroqModel = trimmedModel.startsWith("whisper-large-v3");
@@ -2137,6 +2177,13 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
getTranscriptionEndpoint(deploymentName = "") {
const s = getSettings();
const currentProvider = s.cloudTranscriptionProvider || "openai";
+
+ // Backstop against the OpenAI-default leak: Tinfoil goes through the main-process
+ // proxy, never here — except self-hosted, which resolves its remote URL below.
+ if (currentProvider === "tinfoil" && !isSelfHostedTranscription(s)) {
+ throw new Error("Tinfoil transcription must go through the attested main-process proxy");
+ }
+
const currentBaseUrl = s.cloudTranscriptionBaseUrl || "";
const transcriptionMode = s.transcriptionMode || "";
const remoteUrl = (s.remoteTranscriptionUrl || "").trim();
@@ -3087,28 +3134,39 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
}
}
- // If streaming produced no text, fall back to batch transcription
- // (batch fallback records usage server-side via /api/transcribe)
+ // If streaming produced no text, fall back to batch — routed so BYOK audio
+ // and cloud audio never cross over (see resolveStreamingFallbackTarget).
let usedBatchFallback = false;
let batchWarning = null;
if (!finalText && durationSeconds > 2 && fallbackBlob?.size > 0) {
- logger.info(
- "Streaming produced no text, falling back to batch transcription",
- { durationSeconds, blobSize: fallbackBlob.size },
- "streaming"
- );
- try {
- const batchResult = await this.processWithOpenWhisprCloud(fallbackBlob, {
- durationSeconds,
- });
- if (batchResult?.text) {
- finalText = batchResult.text;
- usedBatchFallback = true;
- batchWarning = batchResult.warning || null;
- logger.info("Batch fallback succeeded", { textLength: finalText.length }, "streaming");
+ const target = resolveStreamingFallbackTarget(getSettings());
+ if (target === "skip") {
+ logger.warn(
+ "Skipping batch fallback: OpenWhispr Cloud session signed out",
+ {},
+ "streaming"
+ );
+ } else {
+ logger.info(
+ "Streaming produced no text, falling back to batch transcription",
+ { durationSeconds, blobSize: fallbackBlob.size, target },
+ "streaming"
+ );
+ try {
+ // Cloud records usage server-side via /api/transcribe; BYOK has no metering.
+ const batchResult =
+ target === "cloud"
+ ? await this.processWithOpenWhisprCloud(fallbackBlob, { durationSeconds })
+ : await this.processWithOpenAIAPI(fallbackBlob, { durationSeconds });
+ if (batchResult?.text) {
+ finalText = batchResult.text;
+ usedBatchFallback = true;
+ batchWarning = batchResult.warning || null;
+ logger.info("Batch fallback succeeded", { textLength: finalText.length }, "streaming");
+ }
+ } catch (fallbackErr) {
+ logger.error("Batch fallback failed", { error: fallbackErr.message }, "streaming");
}
- } catch (fallbackErr) {
- logger.error("Batch fallback failed", { error: fallbackErr.message }, "streaming");
}
}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index ff7c2ea00..6096c0913 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -17,6 +17,7 @@ const OpenAIRealtimeStreaming = require("./openaiRealtimeStreaming");
const { getCortiToken } = require("./cortiAuth");
const { createTinfoilRealtimeSocket } = require("./tinfoilSecureClient");
const { getTinfoilChatModels } = require("./tinfoilCatalog");
+const { transcribeWithTinfoil } = require("./tinfoilTranscription");
const AudioStorageManager = require("./audioStorage");
// Tinfoil's only realtime STT model — fallback when the renderer omits one.
@@ -824,8 +825,6 @@ class IPCHandlers {
return this.windowManager.resizeMainWindow(sizeKey);
});
- // Uniform BYOK key channels (get-<base>-key / save-<base>-key) from the
- // shared manifest — adding a provider needs no handler here.
for (const k of BYOK_API_KEYS) {
ipcMain.handle(`get-${k.base}-key`, () => this.environmentManager[k.get]());
ipcMain.handle(`save-${k.base}-key`, (event, key) => this.environmentManager[k.save](key));
@@ -2750,6 +2749,27 @@ class IPCHandlers {
return getTinfoilChatModels();
});
+ // Enclave attestation is Node-only, so batch transcription is proxied through main.
+ ipcMain.handle(
+ "proxy-tinfoil-transcription",
+ async (event, { audioBuffer, language, prompt }) => {
+ try {
+ return await transcribeWithTinfoil({
+ audioBuffer: Buffer.from(audioBuffer),
+ fileName: "audio.webm",
+ contentType: "audio/webm",
+ language,
+ prompt,
+ apiKey: this.environmentManager.getTinfoilKey(),
+ });
+ } catch (error) {
+ // ipcMain.handle keeps only the message when a promise rejects, dropping
+ // custom props — return the code so the renderer can rebuild the error.
+ return { error: error.message, code: error.code, messageKey: error.messageKey };
+ }
+ }
+ );
+
ipcMain.handle("get-custom-transcription-key", async () => {
return this.environmentManager.getCustomTranscriptionKey();
});
@@ -3985,6 +4005,16 @@ class IPCHandlers {
}
}
}
+ } else if (settings?.cloudTranscriptionProvider === "tinfoil") {
+ // Attested transport, so this can't reuse the generic fetch below.
+ const { text, model } = await transcribeWithTinfoil({
+ audioBuffer: buffer,
+ fileName: "audio.webm",
+ contentType: "audio/webm",
+ language,
+ apiKey: this.environmentManager.getTinfoilKey(),
+ });
+ if (text) result = { text, source: "tinfoil", model };
} else {
const provider = settings?.cloudTranscriptionProvider || "openai";
const model = this._resolveByokModel(provider, settings?.cloudTranscriptionModel);
@@ -6855,6 +6885,18 @@ class IPCHandlers {
return { success: true, text };
}
+ if (provider === "tinfoil") {
+ const ext = path.extname(filePath).toLowerCase().replace(".", "");
+ const { text } = await transcribeWithTinfoil({
+ audioBuffer: fs.readFileSync(filePath),
+ fileName: path.basename(filePath),
+ contentType: AUDIO_MIME_TYPES[ext] || "audio/mpeg",
+ language,
+ apiKey: this.environmentManager.getTinfoilKey(),
+ });
+ return { success: true, text };
+ }
+
if (!apiKey) throw new Error("No API key configured. Add your key in Settings.");
if (!baseUrl && provider !== "xai") {
throw new Error("No transcription endpoint configured.");
diff --git a/src/helpers/tinfoilTranscription.js b/src/helpers/tinfoilTranscription.js
new file mode 100644
index 000000000..7f931b058
--- /dev/null
+++ b/src/helpers/tinfoilTranscription.js
@@ -0,0 +1,74 @@
+const debugLogger = require("./debugLogger");
+const modelRegistryData = require("../models/modelRegistryData.json");
+const { tinfoilSecureFetch } = require("./tinfoilSecureClient");
+
+const TINFOIL_TRANSCRIPTION_PATH = "/v1/audio/transcriptions";
+
+// "Voxtral" is one picker choice but two Tinfoil models: the realtime one streams
+// over /v1/realtime; this batch model handles every non-streaming path.
+function getBatchModel() {
+ const provider = (modelRegistryData.transcriptionProviders || []).find((p) => p.id === "tinfoil");
+ const model = provider?.batchModel;
+ if (!model) {
+ throw new Error("No batch transcription model configured for Tinfoil");
+ }
+ return model;
+}
+
+// Batch transcription over the attested transport, sharing the per-session
+// SecureClient with realtime dictation so the enclave is verified once.
+async function transcribeWithTinfoil({
+ audioBuffer,
+ fileName,
+ contentType,
+ language,
+ prompt,
+ apiKey,
+}) {
+ if (!apiKey?.trim()) {
+ const error = new Error("Tinfoil API key not configured. Add your key in Settings.");
+ error.code = "API_KEY_MISSING";
+ throw error;
+ }
+
+ const model = getBatchModel();
+ const formData = new FormData();
+ formData.append("file", new Blob([audioBuffer], { type: contentType }), fileName);
+ formData.append("model", model);
+ if (language && language !== "auto") {
+ formData.append("language", language);
+ }
+ if (prompt?.trim()) {
+ formData.append("prompt", prompt.trim());
+ }
+
+ debugLogger.debug("Tinfoil batch transcription starting", { model, language }, "transcription");
+
+ const response = await tinfoilSecureFetch(TINFOIL_TRANSCRIPTION_PATH, {
+ method: "POST",
+ headers: { Authorization: `Bearer ${apiKey}` },
+ body: formData,
+ });
+
+ if (response.status === 401) {
+ const error = new Error("Invalid Tinfoil API key. Check your key in Settings.");
+ error.code = "INVALID_KEY";
+ throw error;
+ }
+ if (!response.ok) {
+ const errorText = await response.text().catch(() => "");
+ const error = new Error(`Tinfoil API Error: ${response.status} ${errorText}`.trim());
+ if (response.status === 429) {
+ error.code = "PROVIDER_RATE_LIMITED";
+ error.messageKey = "hooks.audioRecording.errorDescriptions.providerRateLimited";
+ } else if (response.status >= 500) {
+ error.code = "SERVER_ERROR";
+ }
+ throw error;
+ }
+
+ const data = await response.json();
+ return { text: data?.text || "", model };
+}
+
+module.exports = { transcribeWithTinfoil };
diff --git a/src/helpers/transcriptionFallback.js b/src/helpers/transcriptionFallback.js
new file mode 100644
index 000000000..75f3d0d23
--- /dev/null
+++ b/src/helpers/transcriptionFallback.js
@@ -0,0 +1,11 @@
+// Where a streaming session's batch fallback goes. "skip" keeps a signed-out
+// cloud user's audio from being diverted to a leftover BYOK provider.
+export function resolveStreamingFallbackTarget({
+ useLocalWhisper,
+ cloudTranscriptionMode,
+ isSignedIn,
+}) {
+ const isCloudMode = !useLocalWhisper && cloudTranscriptionMode === "openwhispr";
+ if (isCloudMode) return isSignedIn ? "cloud" : "skip";
+ return "byok";
+}
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 2e802bce9..928477d52 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Client-Secret",
"environment": "Datenregion",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil streamt mit Voxtral Mini 4B und verarbeitet Batches mit Voxtral Small 24B.",
+ "docsLink": "Zur Dokumentation"
}
},
"hooks": {
@@ -1888,7 +1892,7 @@
"mistral_voxtral_mini_latest": "Schnelle mehrsprachige Transkription",
"corti_transcribe": "Medizinische Transkription in klinischer Qualität",
"xai_grok_stt": "Hochpräzise Spracherkennung von xAI",
- "tinfoil_voxtral_mini_realtime": "Nachweisbar private Streaming-Transkription"
+ "tinfoil_voxtral": "Nachweisbar private Transkription"
},
"cloud": {
"openai_gpt_5_2": "Starkes Reasoning-Modell",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index a88caa28a..464af1dca 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Client Secret",
"environment": "Data Region",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil streams using Voxtral Mini 4B, and batches with Voxtral Small 24B.",
+ "docsLink": "Read the docs"
}
},
"hooks": {
@@ -1980,7 +1984,7 @@
"mistral_voxtral_mini_latest": "Fast multilingual transcription",
"corti_transcribe": "Clinical-grade medical transcription",
"xai_grok_stt": "High-accuracy speech recognition by xAI",
- "tinfoil_voxtral_mini_realtime": "Verifiably private streaming transcription"
+ "tinfoil_voxtral": "Verifiably private transcription"
},
"cloud": {
"openai_gpt_5_2": "Strong reasoning model",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index c748578f5..8ec520702 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Secreto de cliente",
"environment": "Región de datos",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil transmite con Voxtral Mini 4B y procesa por lotes con Voxtral Small 24B.",
+ "docsLink": "Ver la documentación"
}
},
"hooks": {
@@ -1936,7 +1940,7 @@
"mistral_voxtral_mini_latest": "Transcripción multilingüe rápida",
"corti_transcribe": "Transcripción médica de nivel clínico",
"xai_grok_stt": "Reconocimiento de voz de alta precisión por xAI",
- "tinfoil_voxtral_mini_realtime": "Transcripción en streaming verificablemente privada"
+ "tinfoil_voxtral": "Transcripción verificablemente privada"
},
"cloud": {
"openai_gpt_5_2": "Modelo fuerte de razonamiento",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index b13063373..cc880f747 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Secret client",
"environment": "Région des données",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil diffuse avec Voxtral Mini 4B et traite les lots avec Voxtral Small 24B.",
+ "docsLink": "Voir la documentation"
}
},
"hooks": {
@@ -1936,7 +1940,7 @@
"mistral_voxtral_mini_latest": "Transcription multilingue rapide",
"corti_transcribe": "Transcription médicale de qualité clinique",
"xai_grok_stt": "Reconnaissance vocale haute précision par xAI",
- "tinfoil_voxtral_mini_realtime": "Transcription en streaming vérifiablement privée"
+ "tinfoil_voxtral": "Transcription vérifiablement privée"
},
"cloud": {
"openai_gpt_5_2": "Modèle de raisonnement performant",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index aec16145d..c61085ee5 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Client secret",
"environment": "Regione dei dati",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil trasmette con Voxtral Mini 4B ed elabora i batch con Voxtral Small 24B.",
+ "docsLink": "Leggi la documentazione"
}
},
"hooks": {
@@ -1888,7 +1892,7 @@
"mistral_voxtral_mini_latest": "Trascrizione multilingue veloce",
"corti_transcribe": "Trascrizione medica di livello clinico",
"xai_grok_stt": "Riconoscimento vocale ad alta precisione di xAI",
- "tinfoil_voxtral_mini_realtime": "Trascrizione in streaming verificabilmente privata"
+ "tinfoil_voxtral": "Trascrizione verificabilmente privata"
},
"cloud": {
"openai_gpt_5_2": "Modello di ragionamento potente",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index f8ba262b7..397ef9202 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "クライアントシークレット",
"environment": "データリージョン",
"tenant": "テナント"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil はストリーミングに Voxtral Mini 4B を、バッチ処理に Voxtral Small 24B を使用します。",
+ "docsLink": "ドキュメントを見る"
}
},
"hooks": {
@@ -1888,7 +1892,7 @@
"mistral_voxtral_mini_latest": "高速多言語文字起こし",
"corti_transcribe": "臨床グレードの医療文字起こし",
"xai_grok_stt": "xAIによる高精度音声認識",
- "tinfoil_voxtral_mini_realtime": "検証可能なプライベート・ストリーミング文字起こし"
+ "tinfoil_voxtral": "検証可能なプライベート文字起こし"
},
"cloud": {
"openai_gpt_5_2": "強力な推論モデル",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index eb121d367..515011657 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -520,6 +520,10 @@
"clientSecret": "Segredo do cliente",
"environment": "Região de dados",
"tenant": "Tenant"
+ },
+ "tinfoil": {
+ "transportNote": "O Tinfoil transmite com o Voxtral Mini 4B e processa em lote com o Voxtral Small 24B.",
+ "docsLink": "Ver a documentação"
}
},
"hooks": {
@@ -1867,7 +1871,7 @@
"mistral_voxtral_mini_latest": "Transcrição multilíngue rápida",
"corti_transcribe": "Transcrição médica de nível clínico",
"xai_grok_stt": "Reconhecimento de voz de alta precisão pela xAI",
- "tinfoil_voxtral_mini_realtime": "Transcrição em streaming verificavelmente privada"
+ "tinfoil_voxtral": "Transcrição verificavelmente privada"
},
"cloud": {
"openai_gpt_5_2": "Modelo forte de raciocínio",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index ef3931e39..379925268 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "Секрет клиента",
"environment": "Регион данных",
"tenant": "Тенант"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil использует Voxtral Mini 4B для потоковой обработки и Voxtral Small 24B для пакетной.",
+ "docsLink": "Открыть документацию"
}
},
"hooks": {
@@ -1888,7 +1892,7 @@
"mistral_voxtral_mini_latest": "Быстрая многоязычная транскрипция",
"corti_transcribe": "Медицинская транскрипция клинического уровня",
"xai_grok_stt": "Высокоточное распознавание речи от xAI",
- "tinfoil_voxtral_mini_realtime": "Проверяемо приватная потоковая транскрипция"
+ "tinfoil_voxtral": "Проверяемо приватная транскрипция"
},
"cloud": {
"openai_gpt_5_2": "Сильная модель рассуждения",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 4b017e085..0877000ac 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "客户端密钥",
"environment": "数据区域",
"tenant": "租户"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil 流式转录使用 Voxtral Mini 4B,批量转录使用 Voxtral Small 24B。",
+ "docsLink": "查看文档"
}
},
"hooks": {
@@ -1883,7 +1887,7 @@
"mistral_voxtral_mini_latest": "快速多语言转录",
"corti_transcribe": "临床级医疗转录",
"xai_grok_stt": "xAI 高精度语音识别",
- "tinfoil_voxtral_mini_realtime": "可验证的私密流式转录"
+ "tinfoil_voxtral": "可验证的私密转录"
},
"cloud": {
"openai_gpt_5_2": "强大的推理模型",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 7469d9abf..c8485b01e 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -541,6 +541,10 @@
"clientSecret": "用戶端密鑰",
"environment": "資料區域",
"tenant": "租戶"
+ },
+ "tinfoil": {
+ "transportNote": "Tinfoil 串流轉錄使用 Voxtral Mini 4B,批次轉錄使用 Voxtral Small 24B。",
+ "docsLink": "查看文件"
}
},
"hooks": {
@@ -1883,7 +1887,7 @@
"mistral_voxtral_mini_latest": "快速多語言轉錄",
"corti_transcribe": "臨床級醫療轉錄",
"xai_grok_stt": "xAI 高精度語音辨識",
- "tinfoil_voxtral_mini_realtime": "可驗證的私密串流轉錄"
+ "tinfoil_voxtral": "可驗證的私密轉錄"
},
"cloud": {
"openai_gpt_5_2": "強大的推理模型",
diff --git a/src/models/ModelRegistry.ts b/src/models/ModelRegistry.ts
index 0962a9ade..1ea9aa31f 100644
--- a/src/models/ModelRegistry.ts
+++ b/src/models/ModelRegistry.ts
@@ -68,6 +68,8 @@ export interface TranscriptionProviderData {
name: string;
baseUrl: string;
models: TranscriptionModelDefinition[];
+ /** Allows for a stream/batch split */
+ batchModel?: string;
}
export interface WhisperModelInfo {
@@ -401,6 +403,10 @@ export function getTranscriptionModels(providerId: string): TranscriptionModelDe
return provider?.models || [];
}
+export function getBatchTranscriptionModel(providerId: string): string | undefined {
+ return getTranscriptionProvider(providerId)?.batchModel;
+}
+
export function getDefaultTranscriptionModel(providerId: string): string {
const models = getTranscriptionModels(providerId);
return models[0]?.id || "gpt-4o-mini-transcribe";
diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.json
index 3a329719f..95fca37d0 100644
--- a/src/models/modelRegistryData.json
+++ b/src/models/modelRegistryData.json
@@ -223,12 +223,13 @@
"id": "tinfoil",
"name": "Tinfoil",
"baseUrl": "https://inference.tinfoil.sh/v1",
+ "batchModel": "voxtral-small-24b",
"models": [
{
"id": "voxtral-mini-4b-realtime",
- "name": "Voxtral Mini Realtime",
- "description": "Verifiably private streaming transcription",
- "descriptionKey": "models.descriptions.transcription.tinfoil_voxtral_mini_realtime",
+ "name": "Voxtral",
+ "description": "Verifiably private transcription",
+ "descriptionKey": "models.descriptions.transcription.tinfoil_voxtral",
"streaming": true
}
]
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 009c8a80e..f138c0b96 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1055,6 +1055,13 @@ declare global {
getTinfoilKey?: () => Promise<string | null>;
saveTinfoilKey?: (key: string) => Promise<void>;
getTinfoilChatModels?: () => Promise<TinfoilCatalogModel[]>;
+ proxyTinfoilTranscription?: (data: {
+ audioBuffer: ArrayBuffer;
+ language?: string;
+ prompt?: string;
+ }) => Promise<
+ { text: string; model: string } | { error: string; code?: string; messageKey?: string }
+ >;
// Custom endpoint API keys
getCustomTranscriptionKey?: () => Promise<string | null>;
diff --git a/test/helpers/tinfoilTranscription.test.js b/test/helpers/tinfoilTranscription.test.js
new file mode 100644
index 000000000..2480dc51d
--- /dev/null
+++ b/test/helpers/tinfoilTranscription.test.js
@@ -0,0 +1,149 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const Module = require("node:module");
+
+const transcriptionModulePath = require.resolve("../../src/helpers/tinfoilTranscription.js");
+const originalLoad = Module._load;
+
+function loadTranscription(fetchImpl) {
+ delete require.cache[transcriptionModulePath];
+
+ Module._load = function loadWithMocks(request, parent, isMain) {
+ if (request === "./tinfoilSecureClient") {
+ return { tinfoilSecureFetch: fetchImpl };
+ }
+ if (request === "./debugLogger") {
+ return { debug() {} };
+ }
+ return originalLoad.call(this, request, parent, isMain);
+ };
+
+ try {
+ return require(transcriptionModulePath);
+ } finally {
+ Module._load = originalLoad;
+ }
+}
+
+function okResponse(text) {
+ return { ok: true, status: 200, json: async () => ({ text }) };
+}
+
+const AUDIO = {
+ audioBuffer: Buffer.from("fake audio"),
+ fileName: "audio.webm",
+ contentType: "audio/webm",
+ apiKey: "tk_test",
+};
+
+test("posts to the attested transcriptions path with the registry's batch model", async () => {
+ const calls = [];
+ const { transcribeWithTinfoil } = loadTranscription(async (path, init) => {
+ calls.push({ path, init });
+ return okResponse("hello world");
+ });
+
+ const result = await transcribeWithTinfoil({ ...AUDIO, language: "en" });
+
+ assert.equal(result.text, "hello world");
+ assert.equal(result.model, "voxtral-small-24b");
+ assert.equal(calls.length, 1);
+ assert.equal(calls[0].path, "/v1/audio/transcriptions");
+ assert.equal(calls[0].init.method, "POST");
+ assert.equal(calls[0].init.headers.Authorization, "Bearer tk_test");
+
+ const form = calls[0].init.body;
+ assert.equal(form.get("model"), "voxtral-small-24b");
+ assert.equal(form.get("language"), "en");
+});
+
+test("never sends the realtime model, which only serves /v1/realtime", async () => {
+ let sentModel;
+ const { transcribeWithTinfoil } = loadTranscription(async (_path, init) => {
+ sentModel = init.body.get("model");
+ return okResponse("x");
+ });
+
+ await transcribeWithTinfoil(AUDIO);
+
+ assert.notEqual(sentModel, "voxtral-mini-4b-realtime");
+});
+
+test("omits language when auto-detecting", async () => {
+ let form;
+ const { transcribeWithTinfoil } = loadTranscription(async (_path, init) => {
+ form = init.body;
+ return okResponse("x");
+ });
+
+ await transcribeWithTinfoil({ ...AUDIO, language: "auto" });
+
+ assert.equal(form.get("language"), null);
+});
+
+test("a missing key fails before any request is made", async () => {
+ let called = false;
+ const { transcribeWithTinfoil } = loadTranscription(async () => {
+ called = true;
+ return okResponse("x");
+ });
+
+ await assert.rejects(() => transcribeWithTinfoil({ ...AUDIO, apiKey: " " }), {
+ code: "API_KEY_MISSING",
+ });
+ assert.equal(called, false);
+});
+
+test("401 surfaces as INVALID_KEY", async () => {
+ const { transcribeWithTinfoil } = loadTranscription(async () => ({
+ ok: false,
+ status: 401,
+ text: async () => "unauthorized",
+ }));
+
+ await assert.rejects(() => transcribeWithTinfoil(AUDIO), { code: "INVALID_KEY" });
+});
+
+test("other failures carry the status and body", async () => {
+ const { transcribeWithTinfoil } = loadTranscription(async () => ({
+ ok: false,
+ status: 404,
+ text: async () => "The model does not exist.",
+ }));
+
+ await assert.rejects(() => transcribeWithTinfoil(AUDIO), {
+ message: "Tinfoil API Error: 404 The model does not exist.",
+ });
+});
+
+test("429 surfaces as PROVIDER_RATE_LIMITED, 5xx as SERVER_ERROR", async () => {
+ const rateLimited = loadTranscription(async () => ({
+ ok: false,
+ status: 429,
+ text: async () => "slow down",
+ }));
+ await assert.rejects(() => rateLimited.transcribeWithTinfoil(AUDIO), {
+ code: "PROVIDER_RATE_LIMITED",
+ });
+
+ const serverError = loadTranscription(async () => ({
+ ok: false,
+ status: 503,
+ text: async () => "unavailable",
+ }));
+ await assert.rejects(() => serverError.transcribeWithTinfoil(AUDIO), { code: "SERVER_ERROR" });
+});
+
+test("forwards the dictionary prompt, and omits it when blank", async () => {
+ let form;
+ const { transcribeWithTinfoil } = loadTranscription(async (_path, init) => {
+ form = init.body;
+ return okResponse("x");
+ });
+
+ await transcribeWithTinfoil({ ...AUDIO, prompt: "Qdrant, Voxtral" });
+ assert.equal(form.get("prompt"), "Qdrant, Voxtral");
+
+ await transcribeWithTinfoil({ ...AUDIO, prompt: " " });
+ assert.equal(form.get("prompt"), null);
+});
diff --git a/test/helpers/transcriptionFallback.test.js b/test/helpers/transcriptionFallback.test.js
new file mode 100644
index 000000000..7b1014105
--- /dev/null
+++ b/test/helpers/transcriptionFallback.test.js
@@ -0,0 +1,40 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+const load = () => import("../../src/helpers/transcriptionFallback.js");
+
+test("signed-in OpenWhispr Cloud falls back to cloud", async () => {
+ const { resolveStreamingFallbackTarget } = await load();
+ assert.equal(
+ resolveStreamingFallbackTarget({
+ useLocalWhisper: false,
+ cloudTranscriptionMode: "openwhispr",
+ isSignedIn: true,
+ }),
+ "cloud"
+ );
+});
+
+test("signed-out OpenWhispr Cloud skips rather than diverting to a leftover BYOK provider", async () => {
+ const { resolveStreamingFallbackTarget } = await load();
+ assert.equal(
+ resolveStreamingFallbackTarget({
+ useLocalWhisper: false,
+ cloudTranscriptionMode: "openwhispr",
+ isSignedIn: false,
+ }),
+ "skip"
+ );
+});
+
+test("BYOK mode falls back to the user's own provider", async () => {
+ const { resolveStreamingFallbackTarget } = await load();
+ assert.equal(
+ resolveStreamingFallbackTarget({
+ useLocalWhisper: false,
+ cloudTranscriptionMode: "byok",
+ isSignedIn: false,
+ }),
+ "byok"
+ );
+});