Skip to content

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

feat(transcription): Deepgram and AssemblyAI as streaming-only BYOK providers (#2063)

Gabriel Stein82742ae05846
diff --git a/docs/network-allowlist.md b/docs/network-allowlist.md
index 94a601bf0..761b5b08e 100644
--- a/docs/network-allowlist.md
+++ b/docs/network-allowlist.md
@@ -76,6 +76,9 @@ provider. Skip any provider not in use.
| `api.groq.com` | HTTPS | 443 | Groq API key configured. |
| `atc.tinfoil.sh`, `*.tinfoil.sh` | WSS, HTTPS | 443 | Tinfoil API key configured. `atc.tinfoil.sh` serves the enclave attestation bundle (verified locally against an embedded sigstore root). Inference and realtime transcription connect to an enclave host assigned dynamically at runtime (e.g. `inference.tinfoil.sh`, `router.infN.tinfoil.sh`), so allowlist `*.tinfoil.sh` rather than pinning hosts. |
| `api.mistral.ai` | HTTPS | 443 | Mistral API key configured. |
+| `api.deepgram.com` | WSS, HTTPS | 443 | Deepgram API key configured. Realtime-only: dictation and note recording open a WSS session (there is no file-upload or retry path); the Settings connection test calls `/v1/models` over HTTPS. |
+| `streaming.assemblyai.com` | WSS, HTTPS | 443 | AssemblyAI API key configured. `/v3/token` mints the short-lived session token over HTTPS; the live session is WSS. Realtime-only, like Deepgram. |
+| `api.assemblyai.com` | HTTPS | 443 | AssemblyAI API key configured. Credential check when the key is tested in Settings (`/v2/transcript`). |
| `openrouter.ai` | HTTPS | 443 | OpenRouter selected as a reasoning provider (`/api/v1/models` is fetched even without a key). |
## Notes
diff --git a/preload.js b/preload.js
index 1619de8f5..53134e757 100644
--- a/preload.js
+++ b/preload.js
@@ -14,6 +14,8 @@ const BYOK_KEY_BRIDGES = [
{ base: "openrouter", get: "getOpenrouterKey", save: "saveOpenrouterKey" },
{ base: "tinfoil", get: "getTinfoilKey", save: "saveTinfoilKey" },
{ base: "corti", get: "getCortiKey", save: "saveCortiKey" },
+ { base: "deepgram", get: "getDeepgramKey", save: "saveDeepgramKey" },
+ { base: "assemblyai", get: "getAssemblyAIKey", save: "saveAssemblyAIKey" },
{
base: "note-formatting-custom",
get: "getNoteFormattingCustomKey",
diff --git a/scripts/stt-canary.mjs b/scripts/stt-canary.mjs
index 37a2c4524..50dfe729b 100644
--- a/scripts/stt-canary.mjs
+++ b/scripts/stt-canary.mjs
@@ -26,25 +26,40 @@ import tokenProviders from "../src/helpers/realtimeTokenProviders.js";
import audioUtils from "../src/utils/audioUtils.js";
import geminiTranscription from "../src/helpers/geminiTranscription.js";
import geminiLive from "../src/helpers/geminiLiveStreaming.js";
+import AssemblyAiStreaming from "../src/helpers/assemblyAiStreaming.js";
+import modelRegistryData from "../src/models/modelRegistryData.json" with { type: "json" };
const { fetchRealtimeTokenForProvider } = tokenProviders;
const { pcm16ToWav } = audioUtils;
const { transcribeWithGemini } = geminiTranscription;
const { GeminiLiveStreaming } = geminiLive;
+// The registry's first model is what a fresh AssemblyAI selection dictates with
+// (ModelRegistry.getDefaultTranscriptionModel), so that is the id to probe.
+const ASSEMBLYAI_DEFAULT_MODEL = modelRegistryData.transcriptionProviders.find(
+ (provider) => provider.id === "assemblyai"
+).models[0].id;
+
const HANDSHAKE_TIMEOUT_MS = 15000;
// Half a second of 16 kHz mono silence: enough for a provider to accept and
// decode the container, short enough to stay far inside every request cap.
const SILENT_WAV = () => pcm16ToWav(Buffer.alloc(16000));
// Mirrors the app's dial: openaiRealtimeStreaming.js connects with a bare
-// Bearer header; deepgramStreaming.js passes the key as the bearer token.
+// Bearer header; deepgramStreaming.js passes the key as the bearer token; a
+// null token means the credential already rides in the URL (AssemblyAI).
// `awaitServerEvent` is for providers that authenticate AFTER the upgrade:
// OpenAI opens the socket for any key and only then sends an `error` event
// for a bad one, so resolving on `open` validates nothing (#1624 class).
-function probeWebSocket(url, token, { awaitServerEvent = false } = {}) {
+// `verifyServerEvent` inspects that first event and returns a failure detail,
+// or null to accept — for servers that acknowledge the requested configuration
+// rather than reject a bad one.
+function probeWebSocket(url, token, { awaitServerEvent = false, verifyServerEvent = null } = {}) {
return new Promise((resolve) => {
- const ws = new WebSocket(url, { headers: { Authorization: `Bearer ${token}` } });
+ const ws = new WebSocket(
+ url,
+ token ? { headers: { Authorization: `Bearer ${token}` } } : undefined
+ );
const timer = setTimeout(() => {
ws.terminate();
resolve({ ok: false, detail: `no handshake within ${HANDSHAKE_TIMEOUT_MS}ms` });
@@ -67,9 +82,10 @@ function probeWebSocket(url, token, { awaitServerEvent = false } = {}) {
}
if (event.type === "error") {
finish({ ok: false, detail: `server error event: ${event.error?.code ?? "unknown"}` });
- } else {
- finish({ ok: true });
+ return;
}
+ const detail = verifyServerEvent?.(event);
+ finish(detail ? { ok: false, detail } : { ok: true });
});
ws.on("close", (code) => {
if (awaitServerEvent)
@@ -228,13 +244,24 @@ const PROBES = [
{
id: "assemblyai-realtime",
keyEnv: "STT_CANARY_ASSEMBLYAI_KEY",
- // AssemblyAI's byok path mints a real short-lived streaming token, so the
- // registry call itself is the live probe.
+ // Dials the exact URL the client builds (token, encoding, speech_model).
+ // AssemblyAI ignores query params it does not recognise instead of
+ // rejecting them, so a retired or misspelt default model would silently
+ // downgrade every session — only Begin's echoed configuration.model proves
+ // the requested model was applied.
run: async (key) => {
const token = await fetchRealtimeTokenForProvider("assemblyai-realtime", tokenDeps(key), {
mode: "byok",
});
- return token ? { ok: true } : { ok: false, detail: "empty token" };
+ const model = ASSEMBLYAI_DEFAULT_MODEL;
+ const url = new AssemblyAiStreaming().buildWebSocketUrl({ token, model });
+ return probeWebSocket(url, null, {
+ awaitServerEvent: true,
+ verifyServerEvent: (event) =>
+ event.type === "Begin" && event.configuration?.model === model
+ ? null
+ : `expected Begin with model ${model}, got ${event.type ?? "unknown"} (model ${event.configuration?.model ?? "none"})`,
+ });
},
},
{
diff --git a/src/assets/icons/providers/assemblyai.svg b/src/assets/icons/providers/assemblyai.svg
new file mode 100644
index 000000000..5bf58f477
--- /dev/null
+++ b/src/assets/icons/providers/assemblyai.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -2 32 32" fill="none">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M14.079 0C12.0495 0 10.2323 1.25675 9.50206 3.15886L0 27.8693H7.21783L14.6989 8.42363C14.8857 7.9481 15.3443 7.61693 15.8792 7.61693C16.4142 7.61693 16.8727 7.9481 17.0595 8.42363H18.0531V4.47505H16.2019L17.9257 0H14.0705L14.079 0Z" fill="#1D1B16"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5016 3.15886C10.2064 1.33317 11.9132 0.101899 13.8323 0H14.0786H17.8148C19.8443 0 21.6615 1.25675 22.3918 3.15886L31.8939 27.8693H24.5486L15.3353 3.91461C14.8088 2.74277 13.637 1.92758 12.2783 1.92758C10.9197 1.92758 9.73937 2.75127 9.21289 3.9231L9.5016 3.16735V3.15886Z" fill="#777673"/>
+</svg>
diff --git a/src/assets/icons/providers/deepgram.svg b/src/assets/icons/providers/deepgram.svg
new file mode 100644
index 000000000..988a37743
--- /dev/null
+++ b/src/assets/icons/providers/deepgram.svg
@@ -0,0 +1 @@
+<svg fill="#13EF93" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Deepgram</title><path d="M11.203 24H1.517a.364.364 0 0 1-.258-.62l6.239-6.275a.366.366 0 0 1 .259-.108h3.52c2.723 0 5.025-2.127 5.107-4.845a5.004 5.004 0 0 0-4.999-5.148H7.613v4.646c0 .2-.164.364-.365.364H.968a.365.365 0 0 1-.363-.364V.364C.605.164.768 0 .969 0h10.416c6.684 0 12.111 5.485 12.01 12.187C23.293 18.77 17.794 24 11.202 24z"/></svg>
\ No newline at end of file
diff --git a/src/components/TranscriptionModelPicker.tsx b/src/components/TranscriptionModelPicker.tsx
index a989a8860..42b97e3eb 100644
--- a/src/components/TranscriptionModelPicker.tsx
+++ b/src/components/TranscriptionModelPicker.tsx
@@ -35,6 +35,7 @@ import {
type TranscriptionPolicyContext,
} from "../stores/policyRules";
import { usePolicySnapshot } from "../hooks/usePolicy";
+import { STREAMING_ONLY_PROVIDERS } from "../helpers/transcriptionRoute";
import { getRemoteProviderIcon } from "../utils/providerIcons";
import { createExternalLinkHandler } from "../utils/externalLinks";
import { API_ENDPOINTS, normalizeBaseUrl } from "../config/constants";
@@ -226,6 +227,8 @@ const CLOUD_PROVIDER_TABS = [
{ id: "gemini", name: "Gemini" },
{ id: "corti", name: "Corti" },
{ id: "tinfoil", name: "Tinfoil" },
+ { id: "deepgram", name: "Deepgram" },
+ { id: "assemblyai", name: "AssemblyAI" },
{ id: "custom", name: "Custom" },
];
@@ -240,7 +243,9 @@ interface ProviderCredentialField {
| "cortiClientSecret"
| "cortiEnvironment"
| "cortiTenant"
- | "tinfoilApiKey";
+ | "tinfoilApiKey"
+ | "deepgramApiKey"
+ | "assemblyaiApiKey";
input: "secret" | "text" | "select";
labelKey?: string;
placeholder?: string;
@@ -297,6 +302,14 @@ const PROVIDER_CREDENTIALS: Record<
consoleUrl: "https://tinfoil.sh/inference?utm_source=referral&utm_campaign=openwhispr",
fields: [{ key: "tinfoilApiKey", input: "secret" }],
},
+ deepgram: {
+ consoleUrl: "https://console.deepgram.com/",
+ fields: [{ key: "deepgramApiKey", input: "secret" }],
+ },
+ assemblyai: {
+ consoleUrl: "https://www.assemblyai.com/dashboard/api-keys",
+ fields: [{ key: "assemblyaiApiKey", input: "secret" }],
+ },
};
const TINFOIL_AUDIO_DOCS_URL = "https://docs.tinfoil.sh/models/audio";
@@ -386,6 +399,10 @@ export default function TranscriptionModelPicker({
const setCortiTenant = useSettingsStore((s) => s.setCortiTenant);
const tinfoilApiKey = useSettingsStore((s) => s.tinfoilApiKey);
const setTinfoilApiKey = useSettingsStore((s) => s.setTinfoilApiKey);
+ const deepgramApiKey = useSettingsStore((s) => s.deepgramApiKey);
+ const setDeepgramApiKey = useSettingsStore((s) => s.setDeepgramApiKey);
+ const assemblyaiApiKey = useSettingsStore((s) => s.assemblyaiApiKey);
+ const setAssemblyaiApiKey = useSettingsStore((s) => s.setAssemblyaiApiKey);
const customTranscriptionApiKey = useSettingsStore((s) => s.customTranscriptionApiKey);
const setCustomTranscriptionApiKey = useSettingsStore((s) => s.setCustomTranscriptionApiKey);
const isSignedIn = useSettingsStore((s) => s.isSignedIn);
@@ -465,11 +482,14 @@ export default function TranscriptionModelPicker({
);
// streamingOnly is Note Recording's picker, so it offers the streaming
// providers note recording can actually run — not every streaming provider.
- const availableCloudProviders = useMemo(
- () =>
- streamingOnly ? getMeetingStreamingTranscriptionProviders() : getTranscriptionProviders(),
- [streamingOnly]
- );
+ // Upload is always http-batch, and the realtime-only providers have no batch
+ // route at all (transcriptionRoute fails them closed), so they are hidden there.
+ const availableCloudProviders = useMemo(() => {
+ if (streamingOnly) return getMeetingStreamingTranscriptionProviders();
+ const providers = getTranscriptionProviders();
+ if (transcriptionContext !== "upload") return providers;
+ return providers.filter((provider) => !STREAMING_ONLY_PROVIDERS.has(provider.id));
+ }, [streamingOnly, transcriptionContext]);
const cloudProviders = useMemo(
() => filterByokProviderOptionsByPolicy(availableCloudProviders, "transcription", policyState),
[availableCloudProviders, policyState]
@@ -562,11 +582,12 @@ export default function TranscriptionModelPicker({
}, []);
const effectiveCloudSelection = useMemo(() => {
- // Every provider's URL counts as known, including policy-blocked ones:
- // otherwise a blocked provider's stored URL reads as a custom endpoint and
- // reconciliation would keep pointing "custom" at what policy just denied.
+ // Every provider's URL counts as known, including policy-blocked ones and
+ // the ones this scope does not offer: otherwise such a provider's stored URL
+ // reads as a custom endpoint and reconciliation would keep pointing "custom"
+ // at what policy — or this scope — just denied.
const knownProviderUrls = new Set(
- availableCloudProviders.map((provider) => normalizeBaseUrl(provider.baseUrl))
+ getTranscriptionProviders().map((provider) => normalizeBaseUrl(provider.baseUrl))
);
const normalizedBaseUrl = normalizeBaseUrl(cloudTranscriptionBaseUrl);
const hasCustomUrl = Boolean(
@@ -590,7 +611,6 @@ export default function TranscriptionModelPicker({
}
);
}, [
- availableCloudProviders,
cloudProviders,
cloudTranscriptionBaseUrl,
browsedCloudProvider,
@@ -939,6 +959,8 @@ export default function TranscriptionModelPicker({
cortiEnvironment,
cortiTenant,
tinfoilApiKey,
+ deepgramApiKey,
+ assemblyaiApiKey,
};
const credentialSetters: Record<ProviderCredentialField["key"], (value: string) => void> = {
openaiApiKey: setOpenaiApiKey,
@@ -951,6 +973,8 @@ export default function TranscriptionModelPicker({
cortiEnvironment: setCortiEnvironment,
cortiTenant: setCortiTenant,
tinfoilApiKey: setTinfoilApiKey,
+ deepgramApiKey: setDeepgramApiKey,
+ assemblyaiApiKey: setAssemblyaiApiKey,
};
const cloudModelOptions = useMemo(() => {
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index 17f7ded1c..e2550de50 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -250,14 +250,21 @@ export function ChatInput({
) : isIdle ? (
<button
onClick={voice.start}
+ disabled={voice.streamingOnlyProvider}
aria-label={t("notes.editor.transcribe")}
- title={t("notes.editor.transcribe")}
+ title={
+ voice.streamingOnlyProvider
+ ? t("agentMode.input.voiceDraftStreamingOnly")
+ : t("notes.editor.transcribe")
+ }
className={cn(
"flex items-center justify-center w-7 h-7 rounded-full shrink-0",
GRADIENT_CIRCLE,
- "hover:brightness-110 active:scale-95",
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30",
- "transition-all duration-100"
+ "transition-all duration-100",
+ voice.streamingOnlyProvider
+ ? "opacity-30 saturate-0 cursor-default"
+ : "hover:brightness-110 active:scale-95"
)}
>
<Mic size={14} />
diff --git a/src/components/chat/useVoiceDraft.ts b/src/components/chat/useVoiceDraft.ts
index 2c216e2b6..8695dca9a 100644
--- a/src/components/chat/useVoiceDraft.ts
+++ b/src/components/chat/useVoiceDraft.ts
@@ -6,6 +6,7 @@ import { getBaseLanguageCode } from "../../utils/languageSupport";
import {
transcribeFile,
getTranscriptionApiKey,
+ resolveFileTranscriptionRoute,
type FileTranscriptionConfig,
} from "../../services/fileTranscription";
import { analyserRms } from "../../utils/audioLevel";
@@ -74,6 +75,17 @@ export function useVoiceDraft({ onTranscript, onError }: UseVoiceDraftOptions) {
remoteTranscriptionModel,
});
+ // The chat mic always takes the batch file path, which a realtime-only
+ // provider cannot serve; the caller disables the mic rather than letting a
+ // take record straight into that failure.
+ const config = buildConfig();
+ const route =
+ config.isOpenWhisprCloud || config.useLocalWhisper
+ ? null
+ : resolveFileTranscriptionRoute(config);
+ const streamingOnlyProvider =
+ route?.transport === "error" && route.code === "STREAMING_ONLY_PROVIDER";
+
// Latest-value refs so the recorder's onstop (bound at start time) uses
// current settings and callbacks.
const buildConfigRef = useRef(buildConfig);
@@ -190,5 +202,5 @@ export function useVoiceDraft({ onTranscript, onError }: UseVoiceDraftOptions) {
[]
);
- return { status, elapsed, readLevel, start, stop, cancel };
+ return { status, elapsed, readLevel, start, stop, cancel, streamingOnlyProvider };
}
diff --git a/src/components/notes/UploadAudioView.tsx b/src/components/notes/UploadAudioView.tsx
index 9dbf68afe..d48ec46c4 100644
--- a/src/components/notes/UploadAudioView.tsx
+++ b/src/components/notes/UploadAudioView.tsx
@@ -275,6 +275,8 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
mistralApiKey,
geminiApiKey,
tinfoilApiKey,
+ deepgramApiKey,
+ assemblyaiApiKey,
customTranscriptionApiKey,
} = apiKeys;
const policyState = usePolicySnapshot();
@@ -441,6 +443,8 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
mistralApiKey,
geminiApiKey,
tinfoilApiKey,
+ deepgramApiKey,
+ assemblyaiApiKey,
customTranscriptionApiKey,
})
);
@@ -480,6 +484,8 @@ export default function UploadAudioView({ onNoteCreated, onOpenSettings }: Uploa
mistralApiKey,
geminiApiKey,
tinfoilApiKey,
+ deepgramApiKey,
+ assemblyaiApiKey,
customTranscriptionApiKey,
cortiClientId,
cortiClientSecret,
diff --git a/src/components/notes/shared.ts b/src/components/notes/shared.ts
index ee23442fe..13dd57b0a 100644
--- a/src/components/notes/shared.ts
+++ b/src/components/notes/shared.ts
@@ -33,6 +33,7 @@ const TRANSCRIPTION_ERROR_KEYS: Record<string, string> = {
NO_SPEECH_DETECTED: "noSpeechDetected",
CHUNK_LOSS_EXCEEDED: "chunkLossExceeded",
CUSTOM_ENDPOINT_INVALID: "customEndpointInvalid",
+ STREAMING_ONLY_PROVIDER: "streamingOnlyProvider",
};
// A coded failure arrives either as a returned result (BYOK, local) or as a
diff --git a/src/components/onboarding/ProviderSetupStep.tsx b/src/components/onboarding/ProviderSetupStep.tsx
index fc5f54993..3b3ac41c5 100644
--- a/src/components/onboarding/ProviderSetupStep.tsx
+++ b/src/components/onboarding/ProviderSetupStep.tsx
@@ -210,6 +210,10 @@ function providerCredential(provider: string, store: ReturnType<typeof useSettin
return { value: store.tinfoilApiKey, set: store.setTinfoilApiKey };
case "corti":
return { value: store.cortiApiKey, set: store.setCortiApiKey };
+ case "deepgram":
+ return { value: store.deepgramApiKey, set: store.setDeepgramApiKey };
+ case "assemblyai":
+ return { value: store.assemblyaiApiKey, set: store.setAssemblyaiApiKey };
default:
return { value: "", set: (_value: string) => undefined };
}
diff --git a/src/config/secretKeys.js b/src/config/secretKeys.js
index db548828c..2a8d3bf9e 100644
--- a/src/config/secretKeys.js
+++ b/src/config/secretKeys.js
@@ -64,6 +64,22 @@ const BYOK_API_KEYS = [
save: "saveCortiKey",
storeKey: "cortiApiKey",
},
+ // `get`/`save` are taken verbatim, never derived from `base`, so these keep
+ // the capitalisation realtimeTokenProviders.js already calls them by.
+ {
+ base: "deepgram",
+ env: "DEEPGRAM_API_KEY",
+ get: "getDeepgramKey",
+ save: "saveDeepgramKey",
+ storeKey: "deepgramApiKey",
+ },
+ {
+ base: "assemblyai",
+ env: "ASSEMBLYAI_API_KEY",
+ get: "getAssemblyAIKey",
+ save: "saveAssemblyAIKey",
+ storeKey: "assemblyaiApiKey",
+ },
// Per-scope Custom-endpoint keys. Dictation cleanup's counterpart predates
// this manifest and keeps its bespoke accessors (CUSTOM_CLEANUP_API_KEY).
{
diff --git a/src/helpers/assemblyAiStreaming.js b/src/helpers/assemblyAiStreaming.js
index 3a6b79988..d846bf138 100644
--- a/src/helpers/assemblyAiStreaming.js
+++ b/src/helpers/assemblyAiStreaming.js
@@ -32,10 +32,12 @@ class AssemblyAiStreaming {
this.terminationResolve = null;
this.cachedToken = null;
this.tokenFetchedAt = null;
+ this.mode = null;
this.warmConnection = null;
this.warmConnectionReady = false;
this.warmConnectionOptions = null;
this.warmSessionId = null;
+ this.requestedModel = null;
this.rewarmAttempts = 0;
this.rewarmTimer = null;
this.keepAliveInterval = null;
@@ -54,6 +56,7 @@ class AssemblyAiStreaming {
format_turns: "true",
token: options.token,
});
+ this.requestedModel = options.model || null;
if (options.model) {
params.set("speech_model", options.model);
}
@@ -75,6 +78,23 @@ class AssemblyAiStreaming {
debugLogger.debug("AssemblyAI token cached", { expiresIn: TOKEN_EXPIRY_MS });
}
+ // BYOK and managed dictation share one client instance, so a token or warm
+ // socket minted under one credential kind must never serve the other. Callers
+ // that read the cache before connecting must adopt the mode first.
+ adoptMode(options) {
+ const mode = options.mode === "byok" ? "byok" : "openwhispr";
+ if (this.mode !== null && this.mode !== mode) {
+ debugLogger.debug("AssemblyAI credential mode changed, dropping cached session state", {
+ from: this.mode,
+ to: mode,
+ });
+ this.cachedToken = null;
+ this.tokenFetchedAt = null;
+ this.cleanupWarmConnection();
+ }
+ this.mode = mode;
+ }
+
isTokenValid() {
if (!this.cachedToken || !this.tokenFetchedAt) return false;
const age = Date.now() - this.tokenFetchedAt;
@@ -114,6 +134,7 @@ class AssemblyAiStreaming {
throw new Error("Streaming token is required for warmup");
}
+ this.adoptMode(options);
if (this.warmConnection) {
debugLogger.debug(
this.warmConnectionReady
@@ -324,6 +345,21 @@ class AssemblyAiStreaming {
this.turns = [];
this.connectionLossNotified = false;
+ this.adoptMode(options);
+ // The server pins speech_model at Begin, so a warm socket opened for another
+ // model would keep that model for the whole session — and the Begin mismatch
+ // warning could never fire for the model actually requested.
+ if (
+ this.hasWarmConnection() &&
+ (this.warmConnectionOptions.model || null) !== (options.model || null)
+ ) {
+ debugLogger.debug("AssemblyAI warm connection model differs, cold-starting", {
+ warm: this.warmConnectionOptions.model || null,
+ requested: options.model || null,
+ });
+ this.cleanupWarmConnection();
+ }
+
// Try to use pre-warmed connection for instant start
if (this.hasWarmConnection()) {
if (this.useWarmConnection()) {
@@ -410,6 +446,19 @@ class AssemblyAiStreaming {
this.isConnected = true;
clearTimeout(this.connectionTimeout);
debugLogger.debug("AssemblyAI session started", { sessionId: this.sessionId });
+ // AssemblyAI ignores unrecognized query params instead of rejecting them,
+ // so a bad speech_model silently downgrades the session.
+ if (
+ message.configuration?.model &&
+ this.requestedModel &&
+ message.configuration.model !== this.requestedModel
+ ) {
+ debugLogger.warn(
+ "AssemblyAI applied a different speech model than requested",
+ { requested: this.requestedModel, applied: message.configuration.model },
+ "transcription"
+ );
+ }
if (this.pendingResolve) {
this.pendingResolve();
this.pendingResolve = null;
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 055fb8e54..d7ebb4942 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -63,11 +63,16 @@ import {
isSherpaLocalProvider,
} from "../models/ModelRegistry";
import { TINFOIL_PROXY_REQUIRED_ERROR } from "../services/transcriptionBaseUrl";
-import { resolveByokModel, resolveTranscriptionRoute } from "./transcriptionRoute.ts";
+import {
+ resolveByokModel,
+ resolveTranscriptionRoute,
+ STREAMING_ONLY_PROVIDERS,
+} from "./transcriptionRoute.ts";
import {
getManagedTranscriptionResolution,
isManagedTranscriptionActive,
} from "../services/managedTranscription.ts";
+import { getTranscriptionApiKey } from "../services/fileTranscription";
import { shouldSkipTranscriptionApiKey } from "./transcriptionAuth";
import {
isSelfHostedTranscription,
@@ -3442,6 +3447,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
});
}
+ // Route before reading a key: the resolver's fail-closed guards name the
+ // real problem (a realtime-only provider, or its missing key), whereas the
+ // key read blames the OpenAI key for a provider that never uses it.
+ const route = managedResolution ? null : this.resolveBatchRoute(apiSettings, model);
const apiKey = managedResolution ? null : await this.getAPIKey();
const optimizedAudio = audioBlob;
@@ -3518,7 +3527,7 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
formData.append("language", language);
}
- const endpoint = this.getTranscriptionEndpoint(model);
+ const endpoint = this.getTranscriptionEndpoint(route);
// Prompt budgets follow each provider's real limit (see dictionaryPromptCap):
// Groq's 896-char request cap, the Whisper decoders' window, and a far
@@ -3811,11 +3820,14 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
// Local-vs-cloud is decided upstream, so useLocalWhisper is forced off here:
// the local→cloud fallback resolves its cloud endpoint through this too.
- getTranscriptionEndpoint(deploymentName = "") {
+ resolveBatchRoute(settings, deploymentName = "") {
const route = resolveTranscriptionRoute({
- settings: { ...getSettings(), useLocalWhisper: false },
+ settings: { ...settings, useLocalWhisper: false },
policy: usePolicyStore.getState(),
providers: getTranscriptionProviders(),
+ hasProviderKey: Boolean(
+ getTranscriptionApiKey(settings.cloudTranscriptionProvider || "openai", settings)
+ ),
request: { model: deploymentName },
});
if (route.transport === "error") {
@@ -3824,6 +3836,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
if (route.messageKey) error.messageKey = route.messageKey;
throw error;
}
+ return route;
+ }
+
+ getTranscriptionEndpoint(route) {
if (route.transport !== "http-batch") {
// Proxied providers are dispatched before endpoint resolution; reaching
// here means that guard was bypassed — never fall open to a default.
@@ -4065,6 +4081,16 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
return !!(isSignedInOverride ?? s.isSignedIn);
}
+ // Realtime-only providers (BYOK) stream over their own WSS and have no batch
+ // endpoint at all — transcriptionRoute fails those closed — so gate on the
+ // key instead of letting them fall through to the HTTP path.
+ if (
+ s.cloudTranscriptionMode === "byok" &&
+ STREAMING_ONLY_PROVIDERS.has(s.cloudTranscriptionProvider)
+ ) {
+ return Boolean(getTranscriptionApiKey(s.cloudTranscriptionProvider, s));
+ }
+
// The managed-cloud bootstrap only controls OpenWhispr Cloud. A user's
// BYOK realtime model must not be downgraded because managed dictation is
// configured for batch processing.
diff --git a/src/helpers/deepgramStreaming.js b/src/helpers/deepgramStreaming.js
index 3275c107a..c258c9824 100644
--- a/src/helpers/deepgramStreaming.js
+++ b/src/helpers/deepgramStreaming.js
@@ -88,6 +88,7 @@ class DeepgramStreaming {
this.closeResolve = null;
this.cachedToken = null;
this.tokenFetchedAt = null;
+ this.mode = null;
this.warmConnection = null;
this.warmConnectionReady = false;
this.warmConnectionOptions = null;
@@ -123,6 +124,9 @@ class DeepgramStreaming {
const lang = options.language && options.language !== "auto" ? options.language : null;
const baseLang = lang ? lang.split("-")[0].toLowerCase() : null;
const useNova3 = !lang || NOVA3_LANGUAGES.has(lang) || NOVA3_LANGUAGES.has(baseLang);
+ // options.model is intentionally ignored: the registry only offers nova-3,
+ // and honouring a user-pinned family would defeat the nova-2 downgrade that
+ // keeps languages outside NOVA3_LANGUAGES working.
const model = useNova3 ? "nova-3" : "nova-2";
this.currentModel = model;
@@ -157,6 +161,23 @@ class DeepgramStreaming {
debugLogger.debug("Deepgram token cached", { expiresIn: TOKEN_EXPIRY_MS });
}
+ // BYOK and managed dictation share one client instance, so a token or warm
+ // socket minted under one credential kind must never serve the other. Callers
+ // that read the cache before connecting must adopt the mode first.
+ adoptMode(options) {
+ const mode = options.mode === "byok" ? "byok" : "openwhispr";
+ if (this.mode !== null && this.mode !== mode) {
+ debugLogger.debug("Deepgram credential mode changed, dropping cached session state", {
+ from: this.mode,
+ to: mode,
+ });
+ this.cachedToken = null;
+ this.tokenFetchedAt = null;
+ this.cleanupWarmConnection();
+ }
+ this.mode = mode;
+ }
+
isTokenValid() {
if (!this.cachedToken || !this.tokenFetchedAt) return false;
const age = Date.now() - this.tokenFetchedAt;
@@ -209,6 +230,7 @@ class DeepgramStreaming {
throw new Error("Streaming token is required for warmup");
}
+ this.adoptMode(options);
if (this.warmConnection) {
debugLogger.debug(
this.warmConnectionReady
@@ -557,10 +579,12 @@ class DeepgramStreaming {
return;
}
+ this.adoptMode(options);
this.connectionOptions = {
sampleRate: options.sampleRate,
language: options.language,
keyterms: options.keyterms,
+ mode: options.mode,
};
this.accumulatedText = "";
this.finalSegments = [];
diff --git a/src/helpers/dictationStreamingRouting.js b/src/helpers/dictationStreamingRouting.js
index be156522c..663075377 100644
--- a/src/helpers/dictationStreamingRouting.js
+++ b/src/helpers/dictationStreamingRouting.js
@@ -4,6 +4,7 @@
// call sites is what broke default dictation in 1.8.2 (#1624: the
// openai-realtime entry never sent `provider`, and the hardened main-process
// allowlist rejected undefined). Pure module, mirrors meetingTranscriptionRouting.
+import { STREAMING_ONLY_PROVIDERS } from "./transcriptionRoute.ts";
export const REALTIME_MODELS = new Set(["gpt-4o-mini-transcribe", "gpt-4o-transcribe"]);
@@ -32,6 +33,16 @@ export function resolveStreamingProviderName({ settings, context, sttConfig }) {
) {
return "gemini";
}
+ // Realtime-only providers have no batch endpoint, so BYOK selection alone
+ // routes them, and their renderer channel name is the bare provider id. Ahead
+ // of the REALTIME_MODELS check so a stale OpenAI model id in settings can't
+ // hijack the provider, matching the tinfoil/corti precedent above.
+ if (
+ settings.cloudTranscriptionMode === "byok" &&
+ STREAMING_ONLY_PROVIDERS.has(settings.cloudTranscriptionProvider)
+ ) {
+ return settings.cloudTranscriptionProvider;
+ }
if (REALTIME_MODELS.has(settings.cloudTranscriptionModel)) {
return "openai-realtime";
}
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index a519287c2..d717e9afa 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -9,8 +9,6 @@ const { BYOK_API_KEYS } = require("../config/secretKeys");
const SECRET_KEYS = [
...BYOK_API_KEYS.map((k) => k.env),
- "ASSEMBLYAI_API_KEY",
- "DEEPGRAM_API_KEY",
"CORTI_CLIENT_ID",
"CORTI_CLIENT_SECRET",
"CUSTOM_TRANSCRIPTION_API_KEY",
@@ -265,22 +263,6 @@ class EnvironmentManager {
return { success: true };
}
- getAssemblyAIKey() {
- return this._getKey("ASSEMBLYAI_API_KEY");
- }
-
- saveAssemblyAIKey(key) {
- return this._saveKey("ASSEMBLYAI_API_KEY", key);
- }
-
- getDeepgramKey() {
- return this._getKey("DEEPGRAM_API_KEY");
- }
-
- saveDeepgramKey(key) {
- return this._saveKey("DEEPGRAM_API_KEY", key);
- }
-
getCortiClientId() {
return this._getKey("CORTI_CLIENT_ID");
}
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 4c12f4a83..8ab6c3c57 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -10211,26 +10211,37 @@ class IPCHandlers {
return token;
};
+ // BYOK dictation mints through the shared realtime-token table instead of the
+ // account-scoped server endpoint, so it needs neither an API URL nor a
+ // session. The client's token cache is deliberately bypassed on that path:
+ // AssemblyAI's BYOK grant lives 60 seconds against a 5-minute cache window,
+ // and a cache shared across modes would replay a managed token as a BYOK one.
+ const fetchAssemblyAiToken = (event, byok) =>
+ byok
+ ? fetchRealtimeToken(event, { mode: "byok", provider: "assemblyai-realtime" })
+ : fetchStreamingToken(event);
+
ipcMain.handle("assemblyai-streaming-warmup", async (event, options = {}) => {
try {
- const apiUrl = getApiUrl();
- if (!apiUrl) {
+ const byok = options.mode === "byok";
+ if (!byok && !getApiUrl()) {
return { success: false, error: "API not configured", code: "NO_API" };
}
if (!this.assemblyAiStreaming) {
this.assemblyAiStreaming = new AssemblyAiStreaming();
}
+ this.assemblyAiStreaming.adoptMode(options);
if (this.assemblyAiStreaming.hasWarmConnection()) {
debugLogger.debug("AssemblyAI connection already warm", {}, "streaming");
return { success: true, alreadyWarm: true };
}
- let token = this.assemblyAiStreaming.getCachedToken();
+ let token = byok ? null : this.assemblyAiStreaming.getCachedToken();
if (!token) {
- debugLogger.debug("Fetching new streaming token for warmup", {}, "streaming");
- token = await fetchStreamingToken(event);
+ debugLogger.debug("Fetching new streaming token for warmup", { byok }, "streaming");
+ token = await fetchAssemblyAiToken(event, byok);
}
await this.assemblyAiStreaming.warmup({ ...options, token });
@@ -10253,8 +10264,8 @@ class IPCHandlers {
streamingStartInProgress = true;
try {
- const apiUrl = getApiUrl();
- if (!apiUrl) {
+ const byok = options.mode === "byok";
+ if (!byok && !getApiUrl()) {
return { success: false, error: "API not configured", code: "NO_API" };
}
@@ -10263,6 +10274,7 @@ class IPCHandlers {
if (!this.assemblyAiStreaming) {
this.assemblyAiStreaming = new AssemblyAiStreaming();
}
+ this.assemblyAiStreaming.adoptMode(options);
// Clean up any stale active connection (shouldn't happen normally)
if (this.assemblyAiStreaming.isConnected) {
@@ -10281,11 +10293,11 @@ class IPCHandlers {
"streaming"
);
- let token = this.assemblyAiStreaming.getCachedToken();
+ let token = byok ? null : this.assemblyAiStreaming.getCachedToken();
if (!token) {
- debugLogger.debug("Fetching streaming token from API", {}, "streaming");
- token = await fetchStreamingToken(event);
- this.assemblyAiStreaming.cacheToken(token);
+ debugLogger.debug("Fetching streaming token", { byok }, "streaming");
+ token = await fetchAssemblyAiToken(event, byok);
+ if (!byok) this.assemblyAiStreaming.cacheToken(token);
} else {
debugLogger.debug("Using cached streaming token", {}, "streaming");
}
@@ -10442,10 +10454,26 @@ class IPCHandlers {
return token;
};
+ // Same BYOK contract as AssemblyAI above, except the "token" is the raw
+ // long-lived Deepgram key. It still bypasses the client cache so a token
+ // minted in one mode can never be replayed in the other.
+ const DEEPGRAM_BYOK_TOKEN_OPTIONS = { mode: "byok", provider: "deepgram-realtime" };
+ const fetchDeepgramToken = (event, byok) =>
+ byok
+ ? fetchRealtimeToken(event, DEEPGRAM_BYOK_TOKEN_OPTIONS)
+ : fetchDeepgramStreamingToken(event);
+ const setDeepgramTokenRefreshFn = (event, byok) => {
+ this.deepgramStreaming.setTokenRefreshFn(async () => {
+ if (byok) return fetchRealtimeToken(event, DEEPGRAM_BYOK_TOKEN_OPTIONS);
+ if (!deepgramTokenWindowId) throw new Error("No window reference");
+ return fetchDeepgramStreamingTokenFromWindow(deepgramTokenWindowId);
+ });
+ };
+
ipcMain.handle("deepgram-streaming-warmup", async (event, options = {}) => {
try {
- const apiUrl = getApiUrl();
- if (!apiUrl) {
+ const byok = options.mode === "byok";
+ if (!byok && !getApiUrl()) {
return { success: false, error: "API not configured", code: "NO_API" };
}
@@ -10457,21 +10485,23 @@ class IPCHandlers {
if (!this.deepgramStreaming) {
this.deepgramStreaming = new DeepgramStreaming();
}
+ this.deepgramStreaming.adoptMode(options);
- this.deepgramStreaming.setTokenRefreshFn(async () => {
- if (!deepgramTokenWindowId) throw new Error("No window reference");
- return fetchDeepgramStreamingTokenFromWindow(deepgramTokenWindowId);
- });
+ setDeepgramTokenRefreshFn(event, byok);
if (this.deepgramStreaming.hasWarmConnection()) {
debugLogger.debug("Deepgram connection already warm", {}, "streaming");
return { success: true, alreadyWarm: true };
}
- let token = this.deepgramStreaming.getCachedToken();
+ let token = byok ? null : this.deepgramStreaming.getCachedToken();
if (!token) {
- debugLogger.debug("Fetching new Deepgram streaming token for warmup", {}, "streaming");
- token = await fetchDeepgramStreamingToken(event);
+ debugLogger.debug(
+ "Fetching new Deepgram streaming token for warmup",
+ { byok },
+ "streaming"
+ );
+ token = await fetchDeepgramToken(event, byok);
}
await this.deepgramStreaming.warmup({ ...options, token });
@@ -10499,8 +10529,8 @@ class IPCHandlers {
deepgramStreamingStartInProgress = true;
try {
- const apiUrl = getApiUrl();
- if (!apiUrl) {
+ const byok = options.mode === "byok";
+ if (!byok && !getApiUrl()) {
return { success: false, error: "API not configured", code: "NO_API" };
}
@@ -10512,11 +10542,9 @@ class IPCHandlers {
if (!this.deepgramStreaming) {
this.deepgramStreaming = new DeepgramStreaming();
}
+ this.deepgramStreaming.adoptMode(options);
- this.deepgramStreaming.setTokenRefreshFn(async () => {
- if (!deepgramTokenWindowId) throw new Error("No window reference");
- return fetchDeepgramStreamingTokenFromWindow(deepgramTokenWindowId);
- });
+ setDeepgramTokenRefreshFn(event, byok);
if (this.deepgramStreaming.isConnected) {
debugLogger.debug("Deepgram cleaning up stale connection before start", {}, "streaming");
@@ -10526,11 +10554,11 @@ class IPCHandlers {
const hasWarm = this.deepgramStreaming.hasWarmConnection();
debugLogger.debug("Deepgram streaming start", { hasWarmConnection: hasWarm }, "streaming");
- let token = this.deepgramStreaming.getCachedToken();
+ let token = byok ? null : this.deepgramStreaming.getCachedToken();
if (!token) {
- debugLogger.debug("Fetching Deepgram streaming token from API", {}, "streaming");
- token = await fetchDeepgramStreamingToken(event);
- this.deepgramStreaming.cacheToken(token);
+ debugLogger.debug("Fetching Deepgram streaming token", { byok }, "streaming");
+ token = await fetchDeepgramToken(event, byok);
+ if (!byok) this.deepgramStreaming.cacheToken(token);
} else {
debugLogger.debug("Using cached Deepgram streaming token", {}, "streaming");
}
diff --git a/src/helpers/policyValidation.js b/src/helpers/policyValidation.js
index 214cb2597..7f71461f0 100644
--- a/src/helpers/policyValidation.js
+++ b/src/helpers/policyValidation.js
@@ -17,12 +17,6 @@ const TRANSCRIPTION_MODES = new Set([
const LLM_MODES = TRANSCRIPTION_MODES;
// Enterprise clouds with a managed transcription implementation (Azure only for now).
const TRANSCRIPTION_ENTERPRISE_PROVIDERS = new Set(["azure"]);
-const TRANSCRIPTION_PROVIDERS = new Set(
- modelRegistryData.transcriptionProviders.map((provider) => provider.id).concat("custom")
-);
-const LLM_PROVIDERS = new Set(
- modelRegistryData.cloudProviders.map((provider) => provider.id).concat("custom", "openrouter")
-);
const ENTERPRISE_PROVIDERS = new Set(
modelRegistryData.enterpriseProviders.map((provider) => provider.id)
);
@@ -33,6 +27,14 @@ function isKnownList(value, known) {
return Array.isArray(value) && value.every((item) => typeof item === "string" && known.has(item));
}
+// Shape-only on purpose, like requiredLocalModels below: a provider id added
+// server-side must not make an older app discard the entire managed policy.
+// Unknown ids grant nothing — policyRules filters them at enforcement time.
+// Modes stay strict: an unknown mode has no fail-closed interpretation.
+function isProviderIdList(value) {
+ return Array.isArray(value) && value.every((item) => typeof item === "string" && item.length > 0);
+}
+
function isValidPolicyShape(policy) {
return (
Boolean(policy) &&
@@ -40,7 +42,7 @@ function isValidPolicyShape(policy) {
policy.version === 1 &&
POLICY_SCOPES.every((scope) => Boolean(policy[scope])) &&
isKnownList(policy.transcription.allowedModes, TRANSCRIPTION_MODES) &&
- isKnownList(policy.transcription.allowedByokProviders, TRANSCRIPTION_PROVIDERS) &&
+ isProviderIdList(policy.transcription.allowedByokProviders) &&
// Additive within policy version 1: absent (older server) means none.
(policy.transcription.allowedEnterpriseProviders === undefined ||
isKnownList(
@@ -48,7 +50,7 @@ function isValidPolicyShape(policy) {
TRANSCRIPTION_ENTERPRISE_PROVIDERS
)) &&
isKnownList(policy.llm.allowedModes, LLM_MODES) &&
- isKnownList(policy.llm.allowedByokProviders, LLM_PROVIDERS) &&
+ isProviderIdList(policy.llm.allowedByokProviders) &&
isKnownList(policy.llm.allowedEnterpriseProviders, ENTERPRISE_PROVIDERS) &&
typeof policy.features?.agentEnabled === "boolean" &&
typeof policy.features?.webSearchEnabled === "boolean" &&
@@ -61,9 +63,8 @@ function isValidPolicyShape(policy) {
(policy.dataRetention?.audioRetentionMaxDays === null ||
(Number.isSafeInteger(policy.dataRetention?.audioRetentionMaxDays) &&
policy.dataRetention.audioRetentionMaxDays > 0)) &&
- // Shape-only on purpose: a future model id added server-side must not make
- // an older app discard the entire managed policy. Unknown ids are filtered
- // at enforcement time instead (see policyRules.requiredLocalModelIds).
+ // Shape-only for the same reason as the BYOK provider lists; unknown ids
+ // are filtered at enforcement time (see policyRules.requiredLocalModelIds).
(policy.requiredLocalModels === undefined ||
(Array.isArray(policy.requiredLocalModels) &&
policy.requiredLocalModels.every((item) => typeof item === "string"))) &&
diff --git a/src/helpers/providerConnectionTest.js b/src/helpers/providerConnectionTest.js
index d729ad760..c014db101 100644
--- a/src/helpers/providerConnectionTest.js
+++ b/src/helpers/providerConnectionTest.js
@@ -8,8 +8,15 @@ const ENDPOINTS = {
openrouter: "https://openrouter.ai/api/v1/models",
corti: "https://ai.eu.corti.app/v1/models",
tinfoil: "https://inference.tinfoil.sh/v1/models",
+ deepgram: "https://api.deepgram.com/v1/models",
+ // AssemblyAI exposes no model list; listing transcripts is its 200-vs-401 probe.
+ assemblyai: "https://api.assemblyai.com/v2/transcript?limit=1",
};
+// Neither response is OpenAI-shaped — Deepgram's /v1/models is {stt,tts}-keyed
+// and AssemblyAI returns transcripts — so a 200 is the whole credential signal.
+const MODEL_LIST_UNVERIFIABLE = new Set(["deepgram", "assemblyai"]);
+
// Renderers translate errorCode via onboarding.rehaul.provider.errors.*; the
// English `error` string stays for logs and older callers.
class ConnectionTestError extends Error {
@@ -196,6 +203,10 @@ function resolveProviderRequest(config) {
headers["anthropic-version"] = "2023-06-01";
} else if (provider === "gemini") {
headers["x-goog-api-key"] = apiKey;
+ } else if (provider === "deepgram") {
+ headers.Authorization = `Token ${apiKey}`;
+ } else if (provider === "assemblyai") {
+ headers.Authorization = apiKey;
} else {
headers.Authorization = `Bearer ${apiKey}`;
}
@@ -293,6 +304,7 @@ async function testProviderConnection(config, fetchImpl = fetch) {
signal: controller.signal,
});
if (response.ok) {
+ if (MODEL_LIST_UNVERIFIABLE.has(provider)) return { success: true };
if (await responseOffersModel(response, model)) return { success: true };
failure = pickFailure(failure, {
errorCode: "modelNotFound",
diff --git a/src/helpers/transcriptionRoute.ts b/src/helpers/transcriptionRoute.ts
index 8b422a952..2eb5d9524 100644
--- a/src/helpers/transcriptionRoute.ts
+++ b/src/helpers/transcriptionRoute.ts
@@ -43,6 +43,22 @@ const CUSTOM_ENDPOINT_INVALID_MESSAGE_KEY =
const MANAGED_TRANSCRIPTION_UNAVAILABLE_MESSAGE_KEY =
"hooks.audioRecording.errorDescriptions.managedTranscriptionUnavailable";
+const STREAMING_ONLY_PROVIDER_MESSAGE_KEY =
+ "hooks.audioRecording.errorDescriptions.streamingOnlyProvider";
+
+const PROVIDER_KEY_MISSING_MESSAGE_KEY =
+ "hooks.audioRecording.errorDescriptions.providerKeyMissing";
+
+// Deepgram and AssemblyAI have no OpenAI-compatible /audio/transcriptions, so
+// they exist only as realtime providers. A batch/upload/retry request for them
+// has to fail closed: the fall-through at the end of resolveTranscriptionRoute
+// would otherwise POST the user's audio to api.openai.com with their OpenAI key.
+// Hand-maintained rather than derived from the registry: Corti's only model is
+// realtime too, yet it batches through the proxy. Every other "realtime-only"
+// decision (dictationStreamingRouting, audioManager.shouldUseStreaming, the
+// upload picker and selector) derives from this set.
+export const STREAMING_ONLY_PROVIDERS = new Set(["deepgram", "assemblyai"]);
+
export interface TranscriptionRouteSettings {
transcriptionMode?: string;
useLocalWhisper?: boolean;
@@ -79,6 +95,13 @@ export interface TranscriptionRouteInput {
providers?: readonly TranscriptionProviderBaseUrl[];
/** Managed enterprise STT outcome; when present it outranks every personal setting. */
managed?: ManagedTranscriptionResolution | null;
+ /**
+ * Whether the selected provider's BYOK key is present — a presence flag, never
+ * the key. Consulted only for realtime-only providers: the recorder skips
+ * streaming when their key is missing, and the batch guard below would then
+ * blame the transport instead of the key. Omit when unknown (retry, upload).
+ */
+ hasProviderKey?: boolean;
request?: {
/** Explicit model override; doubles as the Azure deployment name. */
model?: string;
@@ -162,7 +185,10 @@ export function resolveByokModel(provider: string, configuredModel?: string): st
(provider === "openai" && (trimmed.startsWith("gpt-4o") || trimmed === "whisper-1")) ||
(provider === "mistral" && trimmed.startsWith("voxtral-")) ||
(provider === "corti" && trimmed.startsWith("corti-")) ||
- (provider === "gemini" && trimmed.startsWith("gemini-"));
+ (provider === "gemini" && trimmed.startsWith("gemini-")) ||
+ (provider === "deepgram" && (trimmed.startsWith("nova-") || trimmed.startsWith("flux-"))) ||
+ (provider === "assemblyai" &&
+ (trimmed.startsWith("universal-") || trimmed.startsWith("slam-")));
if (matchesProvider) return trimmed;
}
if (provider === "groq") return "whisper-large-v3-turbo";
@@ -170,6 +196,8 @@ export function resolveByokModel(provider: string, configuredModel?: string): st
if (provider === "mistral") return "voxtral-mini-latest";
if (provider === "corti") return "corti-transcribe";
if (provider === "gemini") return "gemini-3.5-transcribe";
+ if (provider === "deepgram") return "nova-3";
+ if (provider === "assemblyai") return "universal-3-5-pro";
return "gpt-4o-mini-transcribe";
}
@@ -208,6 +236,7 @@ export function resolveTranscriptionRoute({
policy,
providers = [],
managed: managedResolution,
+ hasProviderKey,
request,
}: TranscriptionRouteInput): TranscriptionRoute {
const s = settings || {};
@@ -362,6 +391,21 @@ export function resolveTranscriptionRoute({
};
}
+ if (STREAMING_ONLY_PROVIDERS.has(provider)) {
+ if (hasProviderKey === false) {
+ return error(
+ `No ${provider} API key configured. Add your key in Settings.`,
+ "API_KEY_MISSING",
+ PROVIDER_KEY_MISSING_MESSAGE_KEY
+ );
+ }
+ return error(
+ "This provider only supports live transcription. Choose another provider for file uploads and retries.",
+ "STREAMING_ONLY_PROVIDER",
+ STREAMING_ONLY_PROVIDER_MESSAGE_KEY
+ );
+ }
+
const isGroq = provider === "groq";
return {
transport: "http-batch",
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 9fe74d363..53a6620aa 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -88,6 +88,8 @@ export interface ApiKeySettings {
cortiClientSecret: string;
cortiApiKey: string;
tinfoilApiKey: string;
+ deepgramApiKey: string;
+ assemblyaiApiKey: string;
customTranscriptionApiKey: string;
cleanupCustomApiKey: string;
}
@@ -297,6 +299,8 @@ function useSettingsInternal() {
mistralApiKey: store.mistralApiKey,
openrouterApiKey: store.openrouterApiKey,
tinfoilApiKey: store.tinfoilApiKey,
+ deepgramApiKey: store.deepgramApiKey,
+ assemblyaiApiKey: store.assemblyaiApiKey,
dictationKey: store.dictationKey,
meetingKey: store.meetingKey,
voiceAgentKey: store.voiceAgentKey,
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 8e0276c4f..ca33bc20e 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "Ihr benutzerdefinierter Transkriptionsendpunkt ist nicht konfiguriert oder seine URL ist ungültig. Aktualisieren Sie ihn unter Einstellungen → Sprache zu Text.",
"managedTranscriptionUnavailable": "Die verwaltete Transkription ist derzeit nicht verfügbar. Versuchen Sie es gleich noch einmal.",
"managedRouteInvalid": "Die verwaltete Transkription konnte aufgrund einer Konfigurationsabweichung nicht gestartet werden. Versuchen Sie es erneut oder wenden Sie sich an Ihren Administrator.",
- "managedAuthRejected": "Die verwalteten Transkriptions-Anmeldedaten Ihrer Organisation wurden abgelehnt. Wenden Sie sich an Ihren Administrator."
+ "managedAuthRejected": "Die verwalteten Transkriptions-Anmeldedaten Ihrer Organisation wurden abgelehnt. Wenden Sie sich an Ihren Administrator.",
+ "streamingOnlyProvider": "Dieser Anbieter unterstützt nur Live-Transkription. Wähle für Datei-Uploads und Wiederholungen einen anderen Anbieter.",
+ "streamingOnlyProvider": "Dieser Anbieter unterstützt nur Live-Transkription. Wähle für Datei-Uploads und Wiederholungen einen anderen Anbieter.",
+ "providerKeyMissing": "Für Ihren Transkriptionsanbieter ist kein API-Schlüssel hinterlegt. Fügen Sie ihn unter Einstellungen → Sprache zu Text hinzu."
},
"translationFallback": {
"unreachableTitle": "Übersetzung nicht verfügbar",
@@ -2628,7 +2631,11 @@
"gemini_3_5_transcribe_live": "Spracherkennung per Echtzeit-Streaming",
"corti_transcribe": "Medizinische Transkription in klinischer Qualität",
"xai_grok_stt": "Hochpräzise Spracherkennung von xAI",
- "tinfoil_voxtral": "Nachweisbar private Transkription"
+ "tinfoil_voxtral": "Nachweisbar private Transkription",
+ "deepgram_nova_3": "Deepgrams genauestes Echtzeitmodell",
+ "assemblyai_universal_streaming_english": "Unveränderliche Echtzeit-Transkripte, Englisch",
+ "assemblyai_universal_streaming_multilingual": "Unveränderliche Echtzeit-Transkripte, mehrsprachig",
+ "assemblyai_universal_3_5_pro": "Höchste Genauigkeit in Echtzeit, 18 Sprachen"
},
"cloud": {
"openai_gpt_5_2": "Starkes Reasoning-Modell",
@@ -3317,7 +3324,8 @@
"queueFailed": "{{n}} fehlgeschlagen",
"urlFileTooLarge": "Die Datei ist zu groß zum Herunterladen. Die maximale Größe beträgt 500 MB.",
"urlYoutubeBlocked": "YouTube blockiert Downloads aus Ihrem Netzwerk vorübergehend. Versuchen Sie es später erneut.",
- "customEndpointInvalid": "Benutzerdefinierter Transkriptionsendpunkt ist nicht konfiguriert oder ungültig. Aktualisieren Sie ihn in den Einstellungen."
+ "customEndpointInvalid": "Benutzerdefinierter Transkriptionsendpunkt ist nicht konfiguriert oder ungültig. Aktualisieren Sie ihn in den Einstellungen.",
+ "streamingOnlyProvider": "Dieser Anbieter unterstützt nur Live-Transkription. Wähle für Datei-Uploads und Wiederholungen einen anderen Anbieter."
},
"meeting": {
"title": "Besprechungsnotizen",
@@ -3718,7 +3726,8 @@
"transcribing": "Transkribiert...",
"thinking": "Denkt nach...",
"typeMessage": "Nachricht eingeben...",
- "send": "Senden"
+ "send": "Senden",
+ "voiceDraftStreamingOnly": "Spracheingabe ist mit Ihrem Transkriptionsanbieter nicht verfügbar: Er unterstützt nur Live-Diktat. Wählen Sie unter Einstellungen → Sprache zu Text einen anderen Anbieter."
},
"tools": {
"search_notesName": "Notizen durchsuchen",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 0df61238d..7061c564d 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "Your custom transcription endpoint is not configured or its URL is invalid. Update it in Settings → Speech to Text.",
"managedTranscriptionUnavailable": "Managed transcription is not available right now. Try again in a moment.",
"managedRouteInvalid": "Managed transcription couldn't start due to a configuration mismatch. Try again or contact your administrator.",
- "managedAuthRejected": "Your organization's managed transcription credentials were rejected. Contact your administrator."
+ "managedAuthRejected": "Your organization's managed transcription credentials were rejected. Contact your administrator.",
+ "streamingOnlyProvider": "This provider only supports live transcription. Choose another provider for file uploads and retries.",
+ "streamingOnlyProvider": "This provider only supports live transcription. Choose another provider for file uploads and retries.",
+ "providerKeyMissing": "No API key is set for your transcription provider. Add it in Settings → Speech to Text."
},
"translationFallback": {
"unreachableTitle": "Translation unavailable",
@@ -2628,7 +2631,11 @@
"gemini_3_5_transcribe_live": "Realtime streaming speech-to-text",
"corti_transcribe": "Clinical-grade medical transcription",
"xai_grok_stt": "High-accuracy speech recognition by xAI",
- "tinfoil_voxtral": "Verifiably private transcription"
+ "tinfoil_voxtral": "Verifiably private transcription",
+ "deepgram_nova_3": "Deepgram's most accurate realtime model",
+ "assemblyai_universal_streaming_english": "Immutable realtime transcripts, English",
+ "assemblyai_universal_streaming_multilingual": "Immutable realtime transcripts, multilingual",
+ "assemblyai_universal_3_5_pro": "Highest accuracy realtime, 18 languages"
},
"cloud": {
"openai_gpt_5_2": "Strong reasoning model",
@@ -3317,7 +3324,8 @@
"queueFailed": "{{n}} failed",
"urlFileTooLarge": "File is too large to download. The maximum size is 500 MB.",
"urlYoutubeBlocked": "YouTube is temporarily blocking downloads from your network. Try again in a little while.",
- "customEndpointInvalid": "Custom transcription endpoint is not configured or invalid. Update it in Settings."
+ "customEndpointInvalid": "Custom transcription endpoint is not configured or invalid. Update it in Settings.",
+ "streamingOnlyProvider": "This provider only supports live transcription. Choose another provider for file uploads and retries."
},
"meeting": {
"title": "Meeting Notes",
@@ -3718,7 +3726,8 @@
"transcribing": "Transcribing...",
"thinking": "Thinking...",
"typeMessage": "Type a message...",
- "send": "Send"
+ "send": "Send",
+ "voiceDraftStreamingOnly": "Voice input isn't available with your transcription provider: it only supports live dictation. Choose another provider in Settings → Speech to Text."
},
"tools": {
"search_notesName": "Search notes",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 4bd80ff3c..866de3237 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "Tu endpoint de transcripción personalizado no está configurado o su URL no es válida. Actualízalo en Ajustes → Voz a texto.",
"managedTranscriptionUnavailable": "La transcripción gestionada no está disponible en este momento. Inténtalo de nuevo en un momento.",
"managedRouteInvalid": "La transcripción gestionada no pudo iniciarse debido a una discrepancia de configuración. Inténtalo de nuevo o contacta a tu administrador.",
- "managedAuthRejected": "Las credenciales de transcripción gestionada de tu organización fueron rechazadas. Contacta a tu administrador."
+ "managedAuthRejected": "Las credenciales de transcripción gestionada de tu organización fueron rechazadas. Contacta a tu administrador.",
+ "streamingOnlyProvider": "Este proveedor solo admite transcripción en directo. Elige otro proveedor para subir archivos y reintentos.",
+ "streamingOnlyProvider": "Este proveedor solo admite transcripción en directo. Elige otro proveedor para subir archivos y reintentos.",
+ "providerKeyMissing": "No hay ninguna clave de API configurada para tu proveedor de transcripción. Añádela en Ajustes → Voz a texto."
},
"translationFallback": {
"unreachableTitle": "Traducción no disponible",
@@ -2583,7 +2586,11 @@
"gemini_3_5_transcribe_live": "Voz a texto en streaming en tiempo real",
"corti_transcribe": "Transcripción médica de nivel clínico",
"xai_grok_stt": "Reconocimiento de voz de alta precisión por xAI",
- "tinfoil_voxtral": "Transcripción verificablemente privada"
+ "tinfoil_voxtral": "Transcripción verificablemente privada",
+ "deepgram_nova_3": "El modelo en tiempo real más preciso de Deepgram",
+ "assemblyai_universal_streaming_english": "Transcripciones en tiempo real inmutables, en inglés",
+ "assemblyai_universal_streaming_multilingual": "Transcripciones en tiempo real inmutables, multilingües",
+ "assemblyai_universal_3_5_pro": "Máxima precisión en tiempo real, 18 idiomas"
},
"cloud": {
"openai_gpt_5_2": "Modelo fuerte de razonamiento",
@@ -3027,7 +3034,8 @@
"queueFailed": "{{n}} con error",
"urlFileTooLarge": "El archivo es demasiado grande para descargar. El tamaño máximo es 500 MB.",
"urlYoutubeBlocked": "YouTube está bloqueando temporalmente las descargas desde tu red. Inténtalo de nuevo más tarde.",
- "customEndpointInvalid": "El endpoint de transcripción personalizado no está configurado o no es válido. Actualízalo en Ajustes."
+ "customEndpointInvalid": "El endpoint de transcripción personalizado no está configurado o no es válido. Actualízalo en Ajustes.",
+ "streamingOnlyProvider": "Este proveedor solo admite transcripción en directo. Elige otro proveedor para subir archivos y reintentos."
},
"meeting": {
"title": "Notas de reunión",
@@ -3601,7 +3609,8 @@
"transcribing": "Transcribiendo...",
"thinking": "Pensando...",
"typeMessage": "Escribe un mensaje...",
- "send": "Enviar"
+ "send": "Enviar",
+ "voiceDraftStreamingOnly": "La entrada de voz no está disponible con tu proveedor de transcripción: solo admite dictado en directo. Elige otro proveedor en Ajustes → Voz a texto."
},
"tools": {
"search_notesName": "Buscar notas",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 2d816a927..71ff7efa7 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "Votre point de terminaison de transcription personnalisé n'est pas configuré ou son URL est invalide. Mettez-le à jour dans Réglages → Parole en texte.",
"managedTranscriptionUnavailable": "La transcription gérée n'est pas disponible pour le moment. Réessayez dans un instant.",
"managedRouteInvalid": "La transcription gérée n'a pas pu démarrer en raison d'une incohérence de configuration. Réessayez ou contactez votre administrateur.",
- "managedAuthRejected": "Les identifiants de transcription gérée de votre organisation ont été refusés. Contactez votre administrateur."
+ "managedAuthRejected": "Les identifiants de transcription gérée de votre organisation ont été refusés. Contactez votre administrateur.",
+ "streamingOnlyProvider": "Ce fournisseur ne prend en charge que la transcription en direct. Choisissez un autre fournisseur pour les imports de fichiers et les nouvelles tentatives.",
+ "streamingOnlyProvider": "Ce fournisseur ne prend en charge que la transcription en direct. Choisissez un autre fournisseur pour les imports de fichiers et les nouvelles tentatives.",
+ "providerKeyMissing": "Aucune clé API n'est définie pour votre fournisseur de transcription. Ajoutez-la dans Réglages → Parole en texte."
},
"translationFallback": {
"unreachableTitle": "Traduction indisponible",
@@ -2628,7 +2631,11 @@
"gemini_3_5_transcribe_live": "Reconnaissance vocale en streaming temps réel",
"corti_transcribe": "Transcription médicale de qualité clinique",
"xai_grok_stt": "Reconnaissance vocale haute précision par xAI",
- "tinfoil_voxtral": "Transcription vérifiablement privée"
+ "tinfoil_voxtral": "Transcription vérifiablement privée",
+ "deepgram_nova_3": "Le modèle temps réel le plus précis de Deepgram",
+ "assemblyai_universal_streaming_english": "Transcriptions temps réel immuables, anglais",
+ "assemblyai_universal_streaming_multilingual": "Transcriptions temps réel immuables, multilingues",
+ "assemblyai_universal_3_5_pro": "Précision maximale en temps réel, 18 langues"
},
"cloud": {
"openai_gpt_5_2": "Modèle de raisonnement performant",
@@ -3317,7 +3324,8 @@
"queueFailed": "{{n}} en échec",
"urlFileTooLarge": "Le fichier est trop volumineux pour être téléchargé. La taille maximale est de 500 Mo.",
"urlYoutubeBlocked": "YouTube bloque temporairement les téléchargements depuis votre réseau. Réessayez dans un moment.",
- "customEndpointInvalid": "Le point de terminaison de transcription personnalisé n'est pas configuré ou est invalide. Mettez-le à jour dans les réglages."
+ "customEndpointInvalid": "Le point de terminaison de transcription personnalisé n'est pas configuré ou est invalide. Mettez-le à jour dans les réglages.",
+ "streamingOnlyProvider": "Ce fournisseur ne prend en charge que la transcription en direct. Choisissez un autre fournisseur pour les imports de fichiers et les nouvelles tentatives."
},
"meeting": {
"title": "Notes de réunion",
@@ -3718,7 +3726,8 @@
"transcribing": "Transcription...",
"thinking": "Réflexion...",
"typeMessage": "Écrivez un message...",
- "send": "Envoyer"
+ "send": "Envoyer",
+ "voiceDraftStreamingOnly": "La saisie vocale n'est pas disponible avec votre fournisseur de transcription : il ne prend en charge que la dictée en direct. Choisissez un autre fournisseur dans Réglages → Parole en texte."
},
"tools": {
"search_notesName": "Rechercher des notes",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index a4583499a..45eed020b 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "L'endpoint di trascrizione personalizzato non è configurato o il suo URL non è valido. Aggiornalo in Impostazioni → Da voce a testo.",
"managedTranscriptionUnavailable": "La trascrizione gestita non è disponibile al momento. Riprova tra un momento.",
"managedRouteInvalid": "La trascrizione gestita non è potuta partire per un'incoerenza di configurazione. Riprova o contatta l'amministratore.",
- "managedAuthRejected": "Le credenziali di trascrizione gestita della tua organizzazione sono state rifiutate. Contatta l'amministratore."
+ "managedAuthRejected": "Le credenziali di trascrizione gestita della tua organizzazione sono state rifiutate. Contatta l'amministratore.",
+ "streamingOnlyProvider": "Questo provider supporta solo la trascrizione dal vivo. Scegli un altro provider per i caricamenti di file e i nuovi tentativi.",
+ "streamingOnlyProvider": "Questo provider supporta solo la trascrizione dal vivo. Scegli un altro provider per i caricamenti di file e i nuovi tentativi.",
+ "providerKeyMissing": "Nessuna chiave API impostata per il tuo provider di trascrizione. Aggiungila in Impostazioni → Da voce a testo."
},
"translationFallback": {
"unreachableTitle": "Traduzione non disponibile",
@@ -2535,7 +2538,11 @@
"gemini_3_5_transcribe_live": "Riconoscimento vocale in streaming in tempo reale",
"corti_transcribe": "Trascrizione medica di livello clinico",
"xai_grok_stt": "Riconoscimento vocale ad alta precisione di xAI",
- "tinfoil_voxtral": "Trascrizione verificabilmente privata"
+ "tinfoil_voxtral": "Trascrizione verificabilmente privata",
+ "deepgram_nova_3": "Il modello in tempo reale più accurato di Deepgram",
+ "assemblyai_universal_streaming_english": "Trascrizioni in tempo reale immutabili, inglese",
+ "assemblyai_universal_streaming_multilingual": "Trascrizioni in tempo reale immutabili, multilingue",
+ "assemblyai_universal_3_5_pro": "Massima precisione in tempo reale, 18 lingue"
},
"cloud": {
"openai_gpt_5_2": "Modello di ragionamento potente",
@@ -2979,7 +2986,8 @@
"queueFailed": "{{n}} non riusciti",
"urlFileTooLarge": "Il file è troppo grande per essere scaricato. La dimensione massima è 500 MB.",
"urlYoutubeBlocked": "YouTube sta bloccando temporaneamente i download dalla tua rete. Riprova tra poco.",
- "customEndpointInvalid": "L'endpoint di trascrizione personalizzato non è configurato o non è valido. Aggiornalo nelle Impostazioni."
+ "customEndpointInvalid": "L'endpoint di trascrizione personalizzato non è configurato o non è valido. Aggiornalo nelle Impostazioni.",
+ "streamingOnlyProvider": "Questo provider supporta solo la trascrizione dal vivo. Scegli un altro provider per i caricamenti di file e i nuovi tentativi."
},
"meeting": {
"title": "Note delle riunioni",
@@ -3553,7 +3561,8 @@
"transcribing": "Trascrizione...",
"thinking": "Pensiero...",
"typeMessage": "Scrivi un messaggio...",
- "send": "Invia"
+ "send": "Invia",
+ "voiceDraftStreamingOnly": "L'input vocale non è disponibile con il tuo provider di trascrizione: supporta solo la dettatura dal vivo. Scegli un altro provider in Impostazioni → Da voce a testo."
},
"tools": {
"search_notesName": "Cerca nelle note",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 68ed615dc..c922e1b03 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "カスタム文字起こしエンドポイントが未設定か、URLが無効です。設定 → 音声テキスト変換 から更新してください。",
"managedTranscriptionUnavailable": "マネージド文字起こしは現在利用できません。しばらくしてからもう一度お試しください。",
"managedRouteInvalid": "設定の不一致により、マネージド文字起こしを開始できませんでした。もう一度お試しいただくか、管理者にお問い合わせください。",
- "managedAuthRejected": "組織のマネージド文字起こしの認証情報が拒否されました。管理者にお問い合わせください。"
+ "managedAuthRejected": "組織のマネージド文字起こしの認証情報が拒否されました。管理者にお問い合わせください。",
+ "streamingOnlyProvider": "このプロバイダーはライブ文字起こしのみに対応しています。ファイルのアップロードや再実行には別のプロバイダーを選択してください。",
+ "streamingOnlyProvider": "このプロバイダーはライブ文字起こしのみに対応しています。ファイルのアップロードや再実行には別のプロバイダーを選択してください。",
+ "providerKeyMissing": "文字起こしプロバイダーのAPIキーが設定されていません。設定 → 音声テキスト変換 から追加してください。"
},
"translationFallback": {
"unreachableTitle": "翻訳を利用できません",
@@ -2535,7 +2538,11 @@
"gemini_3_5_transcribe_live": "リアルタイムストリーミング文字起こし",
"corti_transcribe": "臨床グレードの医療文字起こし",
"xai_grok_stt": "xAIによる高精度音声認識",
- "tinfoil_voxtral": "検証可能なプライベート文字起こし"
+ "tinfoil_voxtral": "検証可能なプライベート文字起こし",
+ "deepgram_nova_3": "Deepgram で最も高精度なリアルタイムモデル",
+ "assemblyai_universal_streaming_english": "変化しないリアルタイム文字起こし(英語)",
+ "assemblyai_universal_streaming_multilingual": "変化しないリアルタイム文字起こし(多言語)",
+ "assemblyai_universal_3_5_pro": "最高精度のリアルタイム、18言語"
},
"cloud": {
"openai_gpt_5_2": "強力な推論モデル",
@@ -2963,7 +2970,8 @@
"queueFailed": "{{n}}件失敗",
"urlFileTooLarge": "ファイルが大きすぎてダウンロードできません。最大サイズは500 MBです。",
"urlYoutubeBlocked": "YouTubeがお使いのネットワークからのダウンロードを一時的にブロックしています。しばらくしてからもう一度お試しください。",
- "customEndpointInvalid": "カスタム文字起こしエンドポイントが未設定か無効です。設定から更新してください。"
+ "customEndpointInvalid": "カスタム文字起こしエンドポイントが未設定か無効です。設定から更新してください。",
+ "streamingOnlyProvider": "このプロバイダーはライブ文字起こしのみに対応しています。ファイルのアップロードや再実行には別のプロバイダーを選択してください。"
},
"meeting": {
"title": "議事録",
@@ -3553,7 +3561,8 @@
"transcribing": "文字起こし中...",
"thinking": "考え中...",
"typeMessage": "メッセージを入力...",
- "send": "送信"
+ "send": "送信",
+ "voiceDraftStreamingOnly": "現在の文字起こしプロバイダーはライブ音声入力のみに対応しているため、音声入力は利用できません。設定 → 音声テキスト変換 で別のプロバイダーを選択してください。"
},
"tools": {
"search_notesName": "ノートを検索",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 4ad5644ff..d3c509170 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -884,7 +884,10 @@
"customEndpointInvalid": "Seu endpoint de transcrição personalizado não está configurado ou a URL é inválida. Atualize-o em Configurações → Fala para texto.",
"managedTranscriptionUnavailable": "A transcrição gerenciada não está disponível no momento. Tente novamente em instantes.",
"managedRouteInvalid": "A transcrição gerenciada não pôde ser iniciada devido a uma incompatibilidade de configuração. Tente novamente ou entre em contato com o administrador.",
- "managedAuthRejected": "As credenciais de transcrição gerenciada da sua organização foram rejeitadas. Entre em contato com o administrador."
+ "managedAuthRejected": "As credenciais de transcrição gerenciada da sua organização foram rejeitadas. Entre em contato com o administrador.",
+ "streamingOnlyProvider": "Este provedor só suporta transcrição ao vivo. Escolha outro provedor para uploads de arquivos e novas tentativas.",
+ "streamingOnlyProvider": "Este provedor só suporta transcrição ao vivo. Escolha outro provedor para uploads de arquivos e novas tentativas.",
+ "providerKeyMissing": "Nenhuma chave de API definida para seu provedor de transcrição. Adicione-a em Configurações → Fala para texto."
},
"translationFallback": {
"unreachableTitle": "Tradução indisponível",
@@ -2514,7 +2517,11 @@
"gemini_3_5_transcribe_live": "Fala para texto em streaming em tempo real",
"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": "Transcrição verificavelmente privada"
+ "tinfoil_voxtral": "Transcrição verificavelmente privada",
+ "deepgram_nova_3": "O modelo em tempo real mais preciso da Deepgram",
+ "assemblyai_universal_streaming_english": "Transcrições em tempo real imutáveis, em inglês",
+ "assemblyai_universal_streaming_multilingual": "Transcrições em tempo real imutáveis, multilíngues",
+ "assemblyai_universal_3_5_pro": "Máxima precisão em tempo real, 18 idiomas"
},
"cloud": {
"openai_gpt_5_2": "Modelo forte de raciocínio",
@@ -2979,7 +2986,8 @@
"queueFailed": "{{n}} com falha",
"urlFileTooLarge": "O arquivo é grande demais para baixar. O tamanho máximo é 500 MB.",
"urlYoutubeBlocked": "O YouTube está bloqueando temporariamente downloads da sua rede. Tente novamente em instantes.",
- "customEndpointInvalid": "O endpoint de transcrição personalizado não está configurado ou é inválido. Atualize-o nas Configurações."
+ "customEndpointInvalid": "O endpoint de transcrição personalizado não está configurado ou é inválido. Atualize-o nas Configurações.",
+ "streamingOnlyProvider": "Este provedor só suporta transcrição ao vivo. Escolha outro provedor para uploads de arquivos e novas tentativas."
},
"meeting": {
"title": "Notas de reunião",
@@ -3553,7 +3561,8 @@
"transcribing": "Transcrevendo...",
"thinking": "Pensando...",
"typeMessage": "Digite uma mensagem...",
- "send": "Enviar"
+ "send": "Enviar",
+ "voiceDraftStreamingOnly": "A entrada por voz não está disponível com seu provedor de transcrição: ele só suporta ditado ao vivo. Escolha outro provedor em Configurações → Fala para texto."
},
"tools": {
"search_notesName": "Pesquisar notas",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 46bfe4e75..23ac5f627 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "Пользовательская конечная точка транскрипции не настроена или её URL недействителен. Обновите её в Настройках → Речь в текст.",
"managedTranscriptionUnavailable": "Управляемая транскрипция сейчас недоступна. Повторите попытку через некоторое время.",
"managedRouteInvalid": "Не удалось запустить управляемую транскрипцию из-за несоответствия конфигурации. Повторите попытку или обратитесь к администратору.",
- "managedAuthRejected": "Учётные данные управляемой транскрипции вашей организации отклонены. Обратитесь к администратору."
+ "managedAuthRejected": "Учётные данные управляемой транскрипции вашей организации отклонены. Обратитесь к администратору.",
+ "streamingOnlyProvider": "Этот провайдер поддерживает только транскрипцию в реальном времени. Для загрузки файлов и повторных попыток выберите другого провайдера.",
+ "streamingOnlyProvider": "Этот провайдер поддерживает только транскрипцию в реальном времени. Для загрузки файлов и повторных попыток выберите другого провайдера.",
+ "providerKeyMissing": "Для вашего провайдера транскрипции не задан API-ключ. Добавьте его в Настройках → Речь в текст."
},
"translationFallback": {
"unreachableTitle": "Перевод недоступен",
@@ -2551,7 +2554,11 @@
"gemini_3_5_transcribe_live": "Распознавание речи в реальном времени",
"corti_transcribe": "Медицинская транскрипция клинического уровня",
"xai_grok_stt": "Высокоточное распознавание речи от xAI",
- "tinfoil_voxtral": "Проверяемо приватная транскрипция"
+ "tinfoil_voxtral": "Проверяемо приватная транскрипция",
+ "deepgram_nova_3": "Самая точная модель Deepgram для реального времени",
+ "assemblyai_universal_streaming_english": "Неизменяемые расшифровки в реальном времени, английский",
+ "assemblyai_universal_streaming_multilingual": "Неизменяемые расшифровки в реальном времени, многоязычные",
+ "assemblyai_universal_3_5_pro": "Максимальная точность в реальном времени, 18 языков"
},
"cloud": {
"openai_gpt_5_2": "Сильная модель рассуждения",
@@ -3001,7 +3008,8 @@
"queueFailed": "{{n}} с ошибкой",
"urlFileTooLarge": "Файл слишком большой для загрузки. Максимальный размер — 500 МБ.",
"urlYoutubeBlocked": "YouTube временно блокирует загрузки из вашей сети. Попробуйте снова чуть позже.",
- "customEndpointInvalid": "Пользовательская конечная точка транскрипции не настроена или недействительна. Обновите её в Настройках."
+ "customEndpointInvalid": "Пользовательская конечная точка транскрипции не настроена или недействительна. Обновите её в Настройках.",
+ "streamingOnlyProvider": "Этот провайдер поддерживает только транскрипцию в реальном времени. Для загрузки файлов и повторных попыток выберите другого провайдера."
},
"meeting": {
"title": "Заметки со встреч",
@@ -3599,7 +3607,8 @@
"transcribing": "Транскрибирую...",
"thinking": "Думаю...",
"typeMessage": "Введите сообщение...",
- "send": "Отправить"
+ "send": "Отправить",
+ "voiceDraftStreamingOnly": "Голосовой ввод недоступен с вашим провайдером транскрипции: он поддерживает только живую диктовку. Выберите другого провайдера в Настройках → Речь в текст."
},
"tools": {
"search_notesName": "Поиск заметок",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 8b0c9dc03..5b485ef08 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "自定义转写端点未配置或其 URL 无效。请在“设置 → 语音转文字”中更新。",
"managedTranscriptionUnavailable": "托管转录目前不可用。请稍候再试。",
"managedRouteInvalid": "由于配置不匹配,托管转录无法启动。请重试或联系管理员。",
- "managedAuthRejected": "您组织的托管转录凭证被拒绝。请联系管理员。"
+ "managedAuthRejected": "您组织的托管转录凭证被拒绝。请联系管理员。",
+ "streamingOnlyProvider": "该服务商仅支持实时转录。请为文件上传和重试选择其他服务商。",
+ "streamingOnlyProvider": "该服务商仅支持实时转录。请为文件上传和重试选择其他服务商。",
+ "providerKeyMissing": "尚未为您的转录服务商设置 API 密钥。请在“设置 → 语音转文字”中添加。"
},
"translationFallback": {
"unreachableTitle": "翻译不可用",
@@ -2535,7 +2538,11 @@
"gemini_3_5_transcribe_live": "实时流式语音转文字",
"corti_transcribe": "临床级医疗转录",
"xai_grok_stt": "xAI 高精度语音识别",
- "tinfoil_voxtral": "可验证的私密转录"
+ "tinfoil_voxtral": "可验证的私密转录",
+ "deepgram_nova_3": "Deepgram 最精准的实时模型",
+ "assemblyai_universal_streaming_english": "不会变动的实时转录(英语)",
+ "assemblyai_universal_streaming_multilingual": "不会变动的实时转录(多语言)",
+ "assemblyai_universal_3_5_pro": "最高精度实时转录,支持 18 种语言"
},
"cloud": {
"openai_gpt_5_2": "强大的推理模型",
@@ -2979,7 +2986,8 @@
"queueFailed": "{{n}} 个失败",
"urlFileTooLarge": "文件过大,无法下载。最大大小为 500 MB。",
"urlYoutubeBlocked": "YouTube 暂时阻止了来自您网络的下载。请稍后重试。",
- "customEndpointInvalid": "自定义转写端点未配置或无效。请在设置中更新。"
+ "customEndpointInvalid": "自定义转写端点未配置或无效。请在设置中更新。",
+ "streamingOnlyProvider": "该服务商仅支持实时转录。请为文件上传和重试选择其他服务商。"
},
"meeting": {
"title": "会议笔记",
@@ -3553,7 +3561,8 @@
"transcribing": "正在转录...",
"thinking": "正在思考...",
"typeMessage": "输入消息...",
- "send": "发送"
+ "send": "发送",
+ "voiceDraftStreamingOnly": "当前转录服务商仅支持实时听写,因此无法使用语音输入。请在“设置 → 语音转文字”中选择其他服务商。"
},
"tools": {
"search_notesName": "搜索笔记",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 056778382..404f29ce5 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -905,7 +905,10 @@
"customEndpointInvalid": "自訂轉錄端點未設定或其 URL 無效。請在「設定 → 語音轉文字」中更新。",
"managedTranscriptionUnavailable": "託管轉錄目前無法使用。請稍候再試。",
"managedRouteInvalid": "由於設定不符,託管轉錄無法啟動。請重試或聯絡管理員。",
- "managedAuthRejected": "您組織的託管轉錄憑證遭拒。請聯絡管理員。"
+ "managedAuthRejected": "您組織的託管轉錄憑證遭拒。請聯絡管理員。",
+ "streamingOnlyProvider": "此服務商僅支援即時轉錄。請為檔案上傳與重試選擇其他服務商。",
+ "streamingOnlyProvider": "此服務商僅支援即時轉錄。請為檔案上傳與重試選擇其他服務商。",
+ "providerKeyMissing": "尚未為您的轉錄服務商設定 API 金鑰。請在「設定 → 語音轉文字」中新增。"
},
"translationFallback": {
"unreachableTitle": "翻譯無法使用",
@@ -2535,7 +2538,11 @@
"gemini_3_5_transcribe_live": "即時串流語音轉文字",
"corti_transcribe": "臨床級醫療轉錄",
"xai_grok_stt": "xAI 高精度語音辨識",
- "tinfoil_voxtral": "可驗證的私密轉錄"
+ "tinfoil_voxtral": "可驗證的私密轉錄",
+ "deepgram_nova_3": "Deepgram 最精準的即時模型",
+ "assemblyai_universal_streaming_english": "不會變動的即時轉錄(英文)",
+ "assemblyai_universal_streaming_multilingual": "不會變動的即時轉錄(多語言)",
+ "assemblyai_universal_3_5_pro": "最高精度即時轉錄,支援 18 種語言"
},
"cloud": {
"openai_gpt_5_2": "強大的推理模型",
@@ -2979,7 +2986,8 @@
"queueFailed": "{{n}} 個失敗",
"urlFileTooLarge": "檔案過大,無法下載。大小上限為 500 MB。",
"urlYoutubeBlocked": "YouTube 暫時封鎖了來自您網路的下載。請稍後再試。",
- "customEndpointInvalid": "自訂轉錄端點未設定或無效。請在設定中更新。"
+ "customEndpointInvalid": "自訂轉錄端點未設定或無效。請在設定中更新。",
+ "streamingOnlyProvider": "此服務商僅支援即時轉錄。請為檔案上傳與重試選擇其他服務商。"
},
"meeting": {
"title": "會議筆記",
@@ -3553,7 +3561,8 @@
"transcribing": "正在轉錄...",
"thinking": "正在思考...",
"typeMessage": "輸入訊息...",
- "send": "傳送"
+ "send": "傳送",
+ "voiceDraftStreamingOnly": "目前的轉錄服務商僅支援即時聽寫,因此無法使用語音輸入。請在「設定 → 語音轉文字」中選擇其他服務商。"
},
"tools": {
"search_notesName": "搜尋筆記",
diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.json
index 1029caa62..616f2cd61 100644
--- a/src/models/modelRegistryData.json
+++ b/src/models/modelRegistryData.json
@@ -322,6 +322,48 @@
"streaming": true
}
]
+ },
+ {
+ "id": "deepgram",
+ "name": "Deepgram",
+ "baseUrl": "https://api.deepgram.com/v1",
+ "models": [
+ {
+ "id": "nova-3",
+ "name": "Nova-3",
+ "description": "Deepgram's most accurate realtime model",
+ "descriptionKey": "models.descriptions.transcription.deepgram_nova_3",
+ "streaming": true
+ }
+ ]
+ },
+ {
+ "id": "assemblyai",
+ "name": "AssemblyAI",
+ "baseUrl": "https://api.assemblyai.com/v2",
+ "models": [
+ {
+ "id": "universal-3-5-pro",
+ "name": "Universal-3.5 Pro",
+ "description": "Highest accuracy realtime, 18 languages",
+ "descriptionKey": "models.descriptions.transcription.assemblyai_universal_3_5_pro",
+ "streaming": true
+ },
+ {
+ "id": "universal-streaming-english",
+ "name": "Universal Streaming (English)",
+ "description": "Immutable realtime transcripts, English",
+ "descriptionKey": "models.descriptions.transcription.assemblyai_universal_streaming_english",
+ "streaming": true
+ },
+ {
+ "id": "universal-streaming-multilingual",
+ "name": "Universal Streaming (Multilingual)",
+ "description": "Immutable realtime transcripts, multilingual",
+ "descriptionKey": "models.descriptions.transcription.assemblyai_universal_streaming_multilingual",
+ "streaming": true
+ }
+ ]
}
],
"cloudProviders": [
diff --git a/src/services/fileTranscription.ts b/src/services/fileTranscription.ts
index dfd778624..5de41f085 100644
--- a/src/services/fileTranscription.ts
+++ b/src/services/fileTranscription.ts
@@ -1,5 +1,9 @@
import { withSessionRefresh } from "../lib/auth";
-import { resolveTranscriptionRoute } from "../helpers/transcriptionRoute";
+import {
+ resolveTranscriptionRoute,
+ type ManagedTranscriptionResolution,
+ type TranscriptionRoute,
+} from "../helpers/transcriptionRoute";
import {
getManagedTranscriptionResolution,
isManagedTranscriptionActive,
@@ -61,6 +65,8 @@ export interface TranscriptionApiKeys {
mistralApiKey: string;
geminiApiKey: string;
tinfoilApiKey: string;
+ deepgramApiKey: string;
+ assemblyaiApiKey: string;
customTranscriptionApiKey?: string;
}
@@ -78,6 +84,10 @@ export function getTranscriptionApiKey(provider: string, keys: TranscriptionApiK
return keys.geminiApiKey;
case "tinfoil":
return keys.tinfoilApiKey;
+ case "deepgram":
+ return keys.deepgramApiKey;
+ case "assemblyai":
+ return keys.assemblyaiApiKey;
case "custom":
return keys.customTranscriptionApiKey || "";
default:
@@ -85,6 +95,31 @@ export function getTranscriptionApiKey(provider: string, keys: TranscriptionApiK
}
}
+// Pre-flight through the shared resolver: code-carrying errors (incl. the
+// Tinfoil-URL and fail-closed custom guards) surface here without an IPC
+// round-trip; the main-process handler re-resolves the same fields as
+// defense in depth.
+export function resolveFileTranscriptionRoute(
+ cfg: FileTranscriptionConfig,
+ managed: ManagedTranscriptionResolution | null = null
+): TranscriptionRoute {
+ return resolveTranscriptionRoute({
+ settings: {
+ transcriptionMode: cfg.transcriptionMode,
+ remoteTranscriptionUrl: cfg.remoteTranscriptionUrl,
+ remoteTranscriptionModel: cfg.remoteTranscriptionModel,
+ cloudTranscriptionProvider: cfg.cloudTranscriptionProvider,
+ cloudTranscriptionModel: cfg.cloudTranscriptionModel,
+ cloudTranscriptionBaseUrl: cfg.cloudTranscriptionBaseUrl,
+ cortiEnvironment: cfg.cortiEnvironment,
+ cortiTenant: cfg.cortiTenant,
+ },
+ providers: getTranscriptionProviders(),
+ managed,
+ request: { effectiveLanguage: cfg.language || undefined },
+ });
+}
+
// Single provider dispatch shared by the single-file flow and the batch queue,
// so BYOK providers receive identical options in both.
export async function transcribeFile(
@@ -134,25 +169,7 @@ export async function transcribeFile(
});
}
- // Pre-flight through the shared resolver: code-carrying errors (incl. the
- // Tinfoil-URL and fail-closed custom guards) surface here without an IPC
- // round-trip; the main-process handler re-resolves the same fields as
- // defense in depth.
- const route = resolveTranscriptionRoute({
- settings: {
- transcriptionMode: cfg.transcriptionMode,
- remoteTranscriptionUrl: cfg.remoteTranscriptionUrl,
- remoteTranscriptionModel: cfg.remoteTranscriptionModel,
- cloudTranscriptionProvider: cfg.cloudTranscriptionProvider,
- cloudTranscriptionModel: cfg.cloudTranscriptionModel,
- cloudTranscriptionBaseUrl: cfg.cloudTranscriptionBaseUrl,
- cortiEnvironment: cfg.cortiEnvironment,
- cortiTenant: cfg.cortiTenant,
- },
- providers: getTranscriptionProviders(),
- managed,
- request: { effectiveLanguage: cfg.language || undefined },
- });
+ const route = resolveFileTranscriptionRoute(cfg, managed);
if (route.transport === "error") {
return {
success: false,
diff --git a/src/stores/policyRules.ts b/src/stores/policyRules.ts
index ca18411f3..89b9db45a 100644
--- a/src/stores/policyRules.ts
+++ b/src/stores/policyRules.ts
@@ -19,6 +19,39 @@ function managedPolicy(state: PolicyDecisionSnapshot): OrgPolicy | null {
return state.status === "managed" && state.policy ? state.policy : null;
}
+const KNOWN_BYOK_PROVIDER_IDS: Record<PolicyScope, ReadonlySet<string>> = {
+ transcription: new Set([
+ ...modelRegistryData.transcriptionProviders.map((provider) => provider.id),
+ "custom",
+ ]),
+ llm: new Set([
+ ...modelRegistryData.cloudProviders.map((provider) => provider.id),
+ "custom",
+ "openrouter",
+ ]),
+};
+
+const warnedUnknownByokProviderIds = new Set<string>();
+
+/**
+ * The scope's BYOK allowlist, filtered to provider ids this build knows. The
+ * field is validated shape-only, so an id from a newer server reaches here and
+ * is dropped with a warning instead of invalidating the whole policy — it can
+ * grant nothing an older app could act on. Mirrors requiredLocalModelIds.
+ */
+function allowedByokProviderIds(policy: OrgPolicy, scope: PolicyScope): string[] {
+ const known = KNOWN_BYOK_PROVIDER_IDS[scope];
+ return policy[scope].allowedByokProviders.filter((id) => {
+ if (known.has(id)) return true;
+ const key = `${scope}:${id}`;
+ if (!warnedUnknownByokProviderIds.has(key)) {
+ warnedUnknownByokProviderIds.add(key);
+ console.warn(`[policy] Ignoring unknown ${scope} BYOK provider id: ${id}`);
+ }
+ return false;
+ });
+}
+
export function isPolicyActionAllowed(state: PolicyDecisionSnapshot): boolean {
if (state.status === "idle" || state.status === "unmanaged") return true;
if (state.status !== "managed" || !state.policy) return false;
@@ -89,7 +122,7 @@ export function isProviderAllowedByPolicy(
providerId: string
): boolean {
return managedPolicyDecision(state, (policy) =>
- policy[scope].allowedByokProviders.includes(providerId)
+ allowedByokProviderIds(policy, scope).includes(providerId)
);
}
@@ -228,8 +261,9 @@ export function resolveEffectivePolicySelection(
const policy = managedPolicy(state);
if (!policy) return null;
+ const policyByokProviders = allowedByokProviderIds(policy, scope);
const allowedByokProviders = catalog.byokProviders.filter((provider) =>
- policy[scope].allowedByokProviders.includes(provider)
+ policyByokProviders.includes(provider)
);
const allowedEnterpriseProviders = (catalog.enterpriseProviders ?? []).filter((provider) =>
(policy[scope].allowedEnterpriseProviders ?? []).includes(provider)
@@ -419,11 +453,10 @@ function policyModeHasAvailableProvider(
providerCatalog?: Pick<PolicySelectionCatalog, "byokProviders" | "enterpriseProviders">
): boolean {
if (mode === "providers") {
+ const allowed = allowedByokProviderIds(policy, scope);
return providerCatalog
- ? providerCatalog.byokProviders.some((provider) =>
- policy[scope].allowedByokProviders.includes(provider)
- )
- : policy[scope].allowedByokProviders.length > 0;
+ ? providerCatalog.byokProviders.some((provider) => allowed.includes(provider))
+ : allowed.length > 0;
}
if (mode === "enterprise") {
const allowed = policy[scope].allowedEnterpriseProviders ?? [];
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index d5d11bf88..2dc800c4b 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -36,6 +36,7 @@ import { pickDefaultModelId } from "../models/providerDefaultModel";
import { readCachedTinfoilModels } from "../models/tinfoilModelCache";
import { recordTinfoilModelSwitch } from "./tinfoilModelSwitchStore";
import { MEETING_STREAMING_PROVIDER_IDS } from "../helpers/meetingTranscriptionRouting";
+import { STREAMING_ONLY_PROVIDERS } from "../helpers/transcriptionRoute";
import {
getTranscriptionSelection,
isScreenContextAllowed,
@@ -66,6 +67,8 @@ let _ReasoningService: typeof import("../services/ReasoningService").default | n
// store with partial window stubs that don't define it.
const isBrowser = typeof window !== "undefined" && typeof localStorage !== "undefined";
+const DEFAULT_CLOUD_TRANSCRIPTION_PROVIDER = "openai";
+
export const TRANSCRIPTION_POLICY_PROVIDER_IDS = [
...modelRegistryData.transcriptionProviders.map((provider) => provider.id),
"custom",
@@ -1039,6 +1042,8 @@ export interface SettingsState
setCortiClientSecret: (key: string) => void;
setCortiApiKey: (key: string) => void;
setTinfoilApiKey: (key: string) => void;
+ setDeepgramApiKey: (key: string) => void;
+ setAssemblyaiApiKey: (key: string) => void;
setCustomTranscriptionApiKey: (key: string) => void;
setCleanupCustomApiKey: (key: string) => void;
@@ -1277,6 +1282,8 @@ const SECRET_IPC_SAVERS = {
cortiClientSecret: "saveCortiClientSecret",
cortiApiKey: "saveCortiKey",
tinfoil: "saveTinfoilKey",
+ deepgram: "saveDeepgramKey",
+ assemblyai: "saveAssemblyAIKey",
customTranscription: "saveCustomTranscriptionKey",
cleanupCustom: "saveCleanupCustomKey",
noteFormattingCustom: "saveNoteFormattingCustomKey",
@@ -1324,6 +1331,8 @@ const STALE_SECRET_LOCALSTORAGE_KEYS = [
"cortiClientSecret",
"cortiApiKey",
"tinfoilApiKey",
+ "deepgramApiKey",
+ "assemblyaiApiKey",
"customTranscriptionApiKey",
"customReasoningApiKey",
"cleanupCustomApiKey",
@@ -1407,7 +1416,10 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
chineseScriptPreference: normalizeChineseScriptPreference(
readString("chineseScriptPreference", "as-transcribed")
),
- cloudTranscriptionProvider: readString("cloudTranscriptionProvider", "openai"),
+ cloudTranscriptionProvider: readString(
+ "cloudTranscriptionProvider",
+ DEFAULT_CLOUD_TRANSCRIPTION_PROVIDER
+ ),
cloudTranscriptionModel: readString("cloudTranscriptionModel", "gpt-4o-mini-transcribe"),
cloudTranscriptionBaseUrl: readString(
"cloudTranscriptionBaseUrl",
@@ -1451,6 +1463,8 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
cortiClientSecret: "",
cortiApiKey: "",
tinfoilApiKey: "",
+ deepgramApiKey: "",
+ assemblyaiApiKey: "",
customTranscriptionApiKey: "",
cleanupCustomApiKey: "",
@@ -2091,6 +2105,9 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
setCortiEnvironment: createStringSetter("cortiEnvironment"),
setCortiTenant: createStringSetter("cortiTenant"),
setTinfoilApiKey: createSecretSetter("tinfoilApiKey", "tinfoil", "tinfoil"),
+ // STT-only, so there is no ReasoningService key cache to invalidate.
+ setDeepgramApiKey: createSecretSetter("deepgramApiKey", "deepgram"),
+ setAssemblyaiApiKey: createSecretSetter("assemblyaiApiKey", "assemblyai"),
setCustomTranscriptionApiKey: (key: string) => {
set({ customTranscriptionApiKey: key });
debouncedSaveSecret("customTranscription", key);
@@ -2605,6 +2622,8 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({
if (keys.cortiClientSecret !== undefined) s.setCortiClientSecret(keys.cortiClientSecret);
if (keys.cortiApiKey !== undefined) s.setCortiApiKey(keys.cortiApiKey);
if (keys.tinfoilApiKey !== undefined) s.setTinfoilApiKey(keys.tinfoilApiKey);
+ if (keys.deepgramApiKey !== undefined) s.setDeepgramApiKey(keys.deepgramApiKey);
+ if (keys.assemblyaiApiKey !== undefined) s.setAssemblyaiApiKey(keys.assemblyaiApiKey);
if (keys.customTranscriptionApiKey !== undefined)
s.setCustomTranscriptionApiKey(keys.customTranscriptionApiKey);
if (keys.cleanupCustomApiKey !== undefined) s.setCleanupCustomApiKey(keys.cleanupCustomApiKey);
@@ -2697,22 +2716,33 @@ export interface ResolvedUploadTranscription {
// Audio upload is batch (not streaming), so unset values fall back to the base
// dictation settings — matching the behavior before upload had its own context.
+// A realtime-only dictation provider is the exception: it has no batch route, so
+// inheriting it would fail every upload closed. Uploads take the default provider
+// instead, and the dictation model stays behind with the provider it belongs to.
export const selectResolvedUploadTranscription = (
state: SettingsState
-): ResolvedUploadTranscription => ({
- useLocalWhisper: state.uploadUseLocalWhisper,
- whisperModel: state.uploadWhisperModel || state.whisperModel,
- localTranscriptionProvider: state.uploadLocalTranscriptionProvider,
- parakeetModel: state.uploadParakeetModel || state.parakeetModel,
- cohereModel: state.uploadCohereModel || state.cohereModel,
- cloudTranscriptionProvider:
- state.uploadCloudTranscriptionProvider || state.cloudTranscriptionProvider,
- cloudTranscriptionModel: state.uploadCloudTranscriptionModel || state.cloudTranscriptionModel,
- cloudTranscriptionBaseUrl:
- state.uploadCloudTranscriptionBaseUrl || state.cloudTranscriptionBaseUrl || "",
- cloudTranscriptionMode: state.uploadCloudTranscriptionMode || state.cloudTranscriptionMode,
- transcriptionMode: state.uploadTranscriptionMode,
-});
+): ResolvedUploadTranscription => {
+ const inheritsDictationProvider = !STREAMING_ONLY_PROVIDERS.has(state.cloudTranscriptionProvider);
+ return {
+ useLocalWhisper: state.uploadUseLocalWhisper,
+ whisperModel: state.uploadWhisperModel || state.whisperModel,
+ localTranscriptionProvider: state.uploadLocalTranscriptionProvider,
+ parakeetModel: state.uploadParakeetModel || state.parakeetModel,
+ cohereModel: state.uploadCohereModel || state.cohereModel,
+ cloudTranscriptionProvider:
+ state.uploadCloudTranscriptionProvider ||
+ (inheritsDictationProvider
+ ? state.cloudTranscriptionProvider
+ : DEFAULT_CLOUD_TRANSCRIPTION_PROVIDER),
+ cloudTranscriptionModel:
+ state.uploadCloudTranscriptionModel ||
+ (inheritsDictationProvider ? state.cloudTranscriptionModel : ""),
+ cloudTranscriptionBaseUrl:
+ state.uploadCloudTranscriptionBaseUrl || state.cloudTranscriptionBaseUrl || "",
+ cloudTranscriptionMode: state.uploadCloudTranscriptionMode || state.cloudTranscriptionMode,
+ transcriptionMode: state.uploadTranscriptionMode,
+ };
+};
export interface ResolvedNoteFormatting {
provider: string;
@@ -3146,6 +3176,8 @@ export async function initializeSettings(): Promise<void> {
bedrockSessionToken,
azureApiKey,
vertexApiKey,
+ deepgram,
+ assemblyai,
] = await Promise.all([
window.electronAPI.getOpenAIKey?.(),
window.electronAPI.getAnthropicKey?.(),
@@ -3170,6 +3202,8 @@ export async function initializeSettings(): Promise<void> {
window.electronAPI.getBedrockSessionToken?.(),
window.electronAPI.getAzureApiKey?.(),
window.electronAPI.getVertexApiKey?.(),
+ window.electronAPI.getDeepgramKey?.(),
+ window.electronAPI.getAssemblyAIKey?.(),
]);
useSettingsStore.setState({
@@ -3202,6 +3236,8 @@ export async function initializeSettings(): Promise<void> {
bedrockSessionToken: bedrockSessionToken || "",
azureApiKey: azureApiKey || "",
vertexApiKey: vertexApiKey || "",
+ deepgramApiKey: deepgram || "",
+ assemblyaiApiKey: assemblyai || "",
});
if (!localStorage.getItem("enterpriseSetupMode")) {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 9db8e295a..7f26905d5 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -2084,6 +2084,10 @@ declare global {
language?: string;
prompt?: string;
}) => Promise<ProxyTranscriptionResult>;
+ getDeepgramKey?: () => Promise<string | null>;
+ saveDeepgramKey?: (key: string) => Promise<void>;
+ getAssemblyAIKey?: () => Promise<string | null>;
+ saveAssemblyAIKey?: (key: string) => Promise<void>;
// Custom endpoint API keys
getCustomTranscriptionKey?: () => Promise<string | null>;
diff --git a/src/types/policy.ts b/src/types/policy.ts
index 51d7c7c2c..57437b738 100644
--- a/src/types/policy.ts
+++ b/src/types/policy.ts
@@ -4,8 +4,9 @@ import type { InferenceMode } from "./electron";
* Organization policy delivered by the OpenWhispr API and enforced by the app.
*
* Mirrors the canonical schema in `openwhispr-api/lib/policy-schema.ts` and
- * `openwhispr-admin/lib/policy-schema.ts` — keep the three in sync. Provider and
- * mode ids match the model registry exactly.
+ * `openwhispr-admin/lib/policy-schema.ts` — keep the three in sync. Mode ids are
+ * validated strictly; BYOK provider ids are validated shape-only (see
+ * `allowedByokProviders`) so the server enum can grow ahead of this build.
*/
export type LocalHistoryMode = "user_choice" | "always_on" | "always_off";
@@ -15,12 +16,18 @@ export interface OrgPolicy {
version: number;
transcription: {
allowedModes: InferenceMode[];
+ /**
+ * Registry provider ids plus "custom". Validated shape-only so a provider
+ * added server-side can't invalidate the policy on older builds; ids this
+ * build does not know are filtered out at enforcement time and grant nothing.
+ */
allowedByokProviders: string[];
/** Absent on servers that predate the field; absent means none. */
allowedEnterpriseProviders?: string[];
};
llm: {
allowedModes: InferenceMode[];
+ /** Registry provider ids plus "custom" and "openrouter"; same forward-compat rule as transcription. */
allowedByokProviders: string[];
allowedEnterpriseProviders: string[];
};
diff --git a/src/utils/providerIcons.ts b/src/utils/providerIcons.ts
index ae8a6303b..019bb3046 100644
--- a/src/utils/providerIcons.ts
+++ b/src/utils/providerIcons.ts
@@ -20,6 +20,8 @@ import xaiIcon from "@/assets/icons/providers/xai.svg";
import cortiIcon from "@/assets/icons/providers/corti.svg";
import openrouterIcon from "@/assets/icons/providers/openrouter.svg";
import tinfoilIcon from "@/assets/icons/providers/tinfoil.svg";
+import deepgramIcon from "@/assets/icons/providers/deepgram.svg";
+import assemblyaiIcon from "@/assets/icons/providers/assemblyai.svg";
export const PROVIDER_ICONS: Record<string, string> = {
openai: openaiIcon,
@@ -42,6 +44,8 @@ export const PROVIDER_ICONS: Record<string, string> = {
corti: cortiIcon,
openrouter: openrouterIcon,
tinfoil: tinfoilIcon,
+ deepgram: deepgramIcon,
+ assemblyai: assemblyaiIcon,
};
export function getProviderIcon(provider: string): string | undefined {
@@ -58,6 +62,7 @@ export const MONOCHROME_PROVIDERS = [
"corti",
"openrouter",
"tinfoil",
+ "assemblyai",
] as const;
export function isMonochromeProvider(provider: string): boolean {
diff --git a/test/helpers/assemblyAiStreaming.test.js b/test/helpers/assemblyAiStreaming.test.js
index f681fc473..8e376786e 100644
--- a/test/helpers/assemblyAiStreaming.test.js
+++ b/test/helpers/assemblyAiStreaming.test.js
@@ -18,20 +18,31 @@ async function withPrematureCloseServer(run) {
}
}
+// `connections` collects each accepted request URL so a test can count sockets
+// and read the query the client actually sent.
async function withBeginServer(run) {
const server = new WebSocketServer({ host: "127.0.0.1", port: 0 });
await new Promise((resolve) => server.once("listening", resolve));
- server.on("connection", (socket) => {
+ const connections = [];
+ server.on("connection", (socket, request) => {
+ connections.push(request.url);
socket.send(JSON.stringify({ type: "Begin", id: "test-session" }));
});
try {
- await run(`ws://127.0.0.1:${server.address().port}`);
+ await run(`ws://127.0.0.1:${server.address().port}`, connections);
} finally {
await new Promise((resolve) => server.close(resolve));
}
}
+// Keeps the real query string (speech_model, token) while dialing the loopback server.
+function dialLoopback(streaming, url) {
+ const buildRealUrl = streaming.buildWebSocketUrl.bind(streaming);
+ streaming.buildWebSocketUrl = (options) =>
+ buildRealUrl(options).replace("wss://streaming.assemblyai.com/v3/ws", url);
+}
+
test("warmup rejects when the socket closes before Begin", async () => {
await withPrematureCloseServer(async (url) => {
const streaming = new AssemblyAiStreaming();
@@ -89,3 +100,80 @@ test("connect resolves when the server sends Begin", async () => {
}
});
});
+
+test("a warm connection is reused only within the same credential mode", async () => {
+ await withBeginServer(async (url, connections) => {
+ const streaming = new AssemblyAiStreaming();
+ streaming.buildWebSocketUrl = () => url;
+
+ try {
+ await streaming.warmup({ token: "managed-token", mode: "openwhispr" });
+ assert.equal(streaming.getCachedToken(), "managed-token");
+
+ // The main-process singleton serves BYOK and managed dictation alike: a
+ // BYOK session must neither ride the managed socket nor see its token.
+ await streaming.connect({ token: "byok-key", mode: "byok" });
+
+ assert.equal(connections.length, 2, "the managed warm socket was not reused");
+ assert.equal(streaming.hasWarmConnection(), false);
+ assert.equal(streaming.getCachedToken(), null, "the managed token was dropped");
+ assert.equal(streaming.mode, "byok");
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+
+ await withBeginServer(async (url, connections) => {
+ const streaming = new AssemblyAiStreaming();
+ streaming.buildWebSocketUrl = () => url;
+
+ try {
+ await streaming.warmup({ token: "managed-token", mode: "openwhispr" });
+ await streaming.connect({ token: "managed-token", mode: "openwhispr" });
+
+ assert.equal(connections.length, 1, "same-mode start rides the warm socket");
+ assert.equal(streaming.isConnected, true);
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+});
+
+test("a warm connection opened for another speech model is not reused", async () => {
+ await withBeginServer(async (url, connections) => {
+ const streaming = new AssemblyAiStreaming();
+ dialLoopback(streaming, url);
+
+ try {
+ await streaming.warmup({
+ token: "byok-key",
+ mode: "byok",
+ model: "universal-streaming-english",
+ });
+ // The server pins speech_model at Begin; reusing this socket would keep the
+ // warm model for the whole session and hide the downgrade from the user.
+ await streaming.connect({ token: "byok-key", mode: "byok", model: "universal-3-5-pro" });
+
+ assert.equal(connections.length, 2);
+ assert.match(connections[0], /speech_model=universal-streaming-english/);
+ assert.match(connections[1], /speech_model=universal-3-5-pro/);
+ assert.equal(streaming.requestedModel, "universal-3-5-pro");
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+
+ await withBeginServer(async (url, connections) => {
+ const streaming = new AssemblyAiStreaming();
+ dialLoopback(streaming, url);
+
+ try {
+ await streaming.warmup({ token: "byok-key", mode: "byok", model: "universal-3-5-pro" });
+ await streaming.connect({ token: "byok-key", mode: "byok", model: "universal-3-5-pro" });
+
+ assert.equal(connections.length, 1, "same model rides the warm socket");
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+});
diff --git a/test/helpers/audioManagerBatchRouteGuard.test.js b/test/helpers/audioManagerBatchRouteGuard.test.js
new file mode 100644
index 000000000..c69ec33e1
--- /dev/null
+++ b/test/helpers/audioManagerBatchRouteGuard.test.js
@@ -0,0 +1,67 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { loadAudioManager } = require("./harness/audioManager");
+
+// A realtime-only BYOK provider reaches the batch path only when streaming was
+// skipped (no key) — the route guard must speak first, because the key read
+// that used to run ahead of it falls into the OpenAI branch and blames a key
+// the provider never uses.
+
+async function loadManager(t) {
+ const { createManager } = await loadAudioManager(t, {
+ cachePrefix: "openwhispr-batch-route-guard-test-",
+ settingsKey: "__batchRouteGuardSettings",
+ });
+ return createManager();
+}
+
+function setSettings(overrides = {}) {
+ globalThis.__batchRouteGuardSettings = {
+ useLocalWhisper: false,
+ transcriptionMode: "providers",
+ remoteTranscriptionUrl: "",
+ cloudTranscriptionMode: "byok",
+ cloudTranscriptionProvider: "deepgram",
+ cloudTranscriptionModel: "nova-3",
+ deepgramApiKey: "",
+ openaiApiKey: "",
+ allowLocalFallback: false,
+ preferredLanguage: "en",
+ customDictionary: [],
+ ...overrides,
+ };
+}
+
+const audioBlob = () => new Blob([new Uint8Array(1600)], { type: "audio/webm" });
+
+test("batch dictation on a keyless realtime-only provider reports the missing key, not OpenAI's", async (t) => {
+ const manager = await loadManager(t);
+ setSettings();
+ let openAiKeyReads = 0;
+ globalThis.window.electronAPI.getOpenAIKey = async () => {
+ openAiKeyReads += 1;
+ return "";
+ };
+
+ await assert.rejects(manager.processWithOpenAIAPI(audioBlob()), (error) => {
+ assert.equal(error.code, "API_KEY_MISSING");
+ assert.equal(error.messageKey, "hooks.audioRecording.errorDescriptions.providerKeyMissing");
+ assert.doesNotMatch(error.message, /OpenAI/);
+ return true;
+ });
+ assert.equal(openAiKeyReads, 0, "the route guard runs before any key read");
+});
+
+test("batch dictation on a keyed realtime-only provider fails closed on the transport", async (t) => {
+ const manager = await loadManager(t);
+ setSettings({ deepgramApiKey: "dg-test" });
+ globalThis.window.electronAPI.getOpenAIKey = async () => {
+ throw new Error("must not read the OpenAI key");
+ };
+
+ await assert.rejects(manager.processWithOpenAIAPI(audioBlob()), (error) => {
+ assert.equal(error.code, "STREAMING_ONLY_PROVIDER");
+ assert.equal(error.messageKey, "hooks.audioRecording.errorDescriptions.streamingOnlyProvider");
+ return true;
+ });
+});
diff --git a/test/helpers/audioManagerDictionaryPromptCap.test.js b/test/helpers/audioManagerDictionaryPromptCap.test.js
index cc5790a4e..1cf92b5bc 100644
--- a/test/helpers/audioManagerDictionaryPromptCap.test.js
+++ b/test/helpers/audioManagerDictionaryPromptCap.test.js
@@ -139,6 +139,7 @@ test("custom dictionary prompt caps follow the provider's real limit", async (t)
useLocalWhisper: false,
allowLocalFallback: false,
cloudTranscriptionProvider: "custom",
+ cloudTranscriptionBaseUrl: "https://stt.internal.example/v1",
});
const prompts = capturePrompts(t);
// Self-hosted and custom endpoints take whatever model name the user typed;
diff --git a/test/helpers/audioManagerStreamingRouting.test.js b/test/helpers/audioManagerStreamingRouting.test.js
index 983cf0a62..837b44c62 100644
--- a/test/helpers/audioManagerStreamingRouting.test.js
+++ b/test/helpers/audioManagerStreamingRouting.test.js
@@ -120,6 +120,32 @@ test("Gemini streaming needs a streaming model, plus a key (byok) or an account
assert.equal(manager.shouldUseStreaming(), false);
});
+test("deepgram/assemblyai byok stream on the key alone, never on the batch path", async (t) => {
+ const manager = await loadManager(t);
+ // Batch dictation would otherwise win here; these providers have no batch route.
+ manager.sttConfig = { dictation: { mode: "batch" } };
+
+ for (const [provider, keyField, model] of [
+ ["deepgram", "deepgramApiKey", "nova-3"],
+ ["assemblyai", "assemblyaiApiKey", "universal-streaming-english"],
+ ]) {
+ setSettings({
+ cloudTranscriptionProvider: provider,
+ cloudTranscriptionModel: model,
+ [keyField]: "stt-test",
+ });
+ assert.equal(manager.shouldUseStreaming(), true, provider);
+ assert.equal(manager.getStreamingProviderName(), provider);
+
+ setSettings({
+ cloudTranscriptionProvider: provider,
+ cloudTranscriptionModel: model,
+ [keyField]: "",
+ });
+ assert.equal(manager.shouldUseStreaming(), false, `${provider} without a key`);
+ }
+});
+
test("managed OpenWhispr Cloud still respects its batch configuration", async (t) => {
const manager = await loadManager(t);
manager.sttConfig = { dictation: { mode: "batch" } };
diff --git a/test/helpers/azureTranscriptionUrl.test.js b/test/helpers/azureTranscriptionUrl.test.js
index a0f73415d..626382042 100644
--- a/test/helpers/azureTranscriptionUrl.test.js
+++ b/test/helpers/azureTranscriptionUrl.test.js
@@ -49,7 +49,7 @@ test("buildAzureTranscriptionUrl returns null when no deployment name is availab
assert.equal(buildAzureTranscriptionUrl("https://r.cognitiveservices.azure.com", ""), null);
});
-// getTranscriptionEndpoint feeds buildAzureTranscriptionUrl the raw base, not the
+// resolveTranscriptionRoute feeds buildAzureTranscriptionUrl the raw base, not the
// normalized one, because normalizeBaseUrl strips the /audio/transcriptions suffix
// that marks a deployment the user pinned by pasting their full Azure endpoint.
test("a pinned Azure endpoint survives base-URL normalization", async () => {
diff --git a/test/helpers/deepgramStreaming.test.js b/test/helpers/deepgramStreaming.test.js
new file mode 100644
index 000000000..70a553be9
--- /dev/null
+++ b/test/helpers/deepgramStreaming.test.js
@@ -0,0 +1,85 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { WebSocketServer } = require("ws");
+
+const DeepgramStreaming = require("../../src/helpers/deepgramStreaming");
+
+// Loopback Deepgram: warmup resolves on the socket opening, connect on the
+// first server message, so every accepted socket answers with Metadata.
+async function withMetadataServer(run) {
+ const server = new WebSocketServer({ host: "127.0.0.1", port: 0 });
+ await new Promise((resolve) => server.once("listening", resolve));
+ const connections = [];
+ server.on("connection", (socket, request) => {
+ connections.push(request.url);
+ socket.send(JSON.stringify({ type: "Metadata", request_id: `req-${connections.length}` }));
+ });
+
+ try {
+ await run(`ws://127.0.0.1:${server.address().port}`, connections);
+ } finally {
+ await new Promise((resolve) => server.close(resolve));
+ }
+}
+
+test("a warm connection is reused only within the same credential mode", async () => {
+ await withMetadataServer(async (url, connections) => {
+ const streaming = new DeepgramStreaming();
+ streaming.buildWebSocketUrl = () => url;
+
+ try {
+ await streaming.warmup({ token: "managed-token", mode: "openwhispr" });
+ assert.equal(streaming.getCachedToken(), "managed-token");
+
+ // The main-process singleton serves BYOK and managed dictation alike: a
+ // BYOK session must neither ride the managed socket nor see its token.
+ await streaming.connect({ token: "byok-key", mode: "byok" });
+
+ assert.equal(connections.length, 2, "the managed warm socket was not reused");
+ assert.equal(streaming.hasWarmConnection(), false);
+ assert.equal(streaming.getCachedToken(), null, "the managed token was dropped");
+ assert.equal(streaming.mode, "byok");
+ assert.equal(
+ streaming.connectionOptions.mode,
+ "byok",
+ "a liveness reconnect must stay in the session's mode"
+ );
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+
+ await withMetadataServer(async (url, connections) => {
+ const streaming = new DeepgramStreaming();
+ streaming.buildWebSocketUrl = () => url;
+
+ try {
+ await streaming.warmup({ token: "managed-token", mode: "openwhispr" });
+ await streaming.connect({ token: "managed-token", mode: "openwhispr" });
+
+ assert.equal(connections.length, 1, "same-mode start rides the warm socket");
+ assert.equal(streaming.isConnected, true);
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+});
+
+test("adopting a different mode before a warmup drops the other mode's token", async () => {
+ await withMetadataServer(async (url) => {
+ const streaming = new DeepgramStreaming();
+ streaming.buildWebSocketUrl = () => url;
+
+ try {
+ await streaming.warmup({ token: "byok-key", mode: "byok" });
+ // ipcHandlers adopts the incoming mode before consulting the token cache
+ // for a managed start, so the BYOK key can never be replayed as a token.
+ streaming.adoptMode({ mode: "openwhispr" });
+
+ assert.equal(streaming.getCachedToken(), null);
+ assert.equal(streaming.hasWarmConnection(), false);
+ } finally {
+ streaming.cleanupAll();
+ }
+ });
+});
diff --git a/test/helpers/dictationStreamingMatrix.test.js b/test/helpers/dictationStreamingMatrix.test.js
index 9eb576941..866e4735c 100644
--- a/test/helpers/dictationStreamingMatrix.test.js
+++ b/test/helpers/dictationStreamingMatrix.test.js
@@ -87,6 +87,44 @@ const RESOLUTION_MATRIX = [
},
"openai-realtime",
],
+ [
+ "deepgram byok streams over deepgram's own channels",
+ {
+ settings: settingsWith({
+ cloudTranscriptionProvider: "deepgram",
+ cloudTranscriptionModel: "nova-3",
+ cloudTranscriptionMode: "byok",
+ }),
+ },
+ "deepgram",
+ ],
+ [
+ "assemblyai byok streams over assemblyai's own channels",
+ {
+ settings: settingsWith({
+ cloudTranscriptionProvider: "assemblyai",
+ cloudTranscriptionModel: "universal-streaming-english",
+ cloudTranscriptionMode: "byok",
+ }),
+ },
+ "assemblyai",
+ ],
+ [
+ "a stale OpenAI realtime model cannot hijack a byok streaming-only provider",
+ {
+ settings: settingsWith({
+ cloudTranscriptionProvider: "deepgram",
+ cloudTranscriptionModel: "gpt-4o-mini-transcribe",
+ cloudTranscriptionMode: "byok",
+ }),
+ },
+ "deepgram",
+ ],
+ [
+ "deepgram on openwhispr cloud stays on the managed path",
+ { settings: settingsWith({ cloudTranscriptionProvider: "deepgram" }) },
+ "openai-realtime",
+ ],
[
"batch model in notes context defaults to deepgram",
{ settings: settingsWith({ cloudTranscriptionModel: "whisper-1" }), context: "notes" },
diff --git a/test/helpers/meetingStreamingProviders.test.js b/test/helpers/meetingStreamingProviders.test.js
index 0c82945ab..baae84469 100644
--- a/test/helpers/meetingStreamingProviders.test.js
+++ b/test/helpers/meetingStreamingProviders.test.js
@@ -62,10 +62,33 @@ test("a dictation-only streaming provider is not offered for note recording", as
assert.equal(meetingIds.includes("gemini"), false);
});
+// The intersection is an allow-list, so a new streaming provider is silently
+// excluded from note recording unless it is listed. Deepgram and AssemblyAI are
+// the managed note-recording providers and must stay admitted.
+test("deepgram and assemblyai are offered for note recording", async () => {
+ const { getMeetingStreamingTranscriptionProviders } =
+ await import("../../src/models/ModelRegistry.ts");
+
+ const meetingIds = getMeetingStreamingTranscriptionProviders().map((provider) => provider.id);
+ assert.ok(meetingIds.includes("deepgram"));
+ assert.ok(meetingIds.includes("assemblyai"));
+});
+
test("allow-list rejects unknown and batch-only providers", async () => {
const { ALLOWED_MEETING_PROVIDERS } = await load();
- for (const provider of ["tinfoil", "openai", "mistral-realtime", "grok-stt", "", undefined]) {
+ // The bare ids are live settings values now, so they must not be mistaken for
+ // meeting provider ids (which always carry the "-realtime" suffix).
+ for (const provider of [
+ "tinfoil",
+ "openai",
+ "deepgram",
+ "assemblyai",
+ "mistral-realtime",
+ "grok-stt",
+ "",
+ undefined,
+ ]) {
assert.equal(ALLOWED_MEETING_PROVIDERS.has(provider), false, `${provider} must be rejected`);
}
});
diff --git a/test/helpers/meetingTranscriptionRouting.test.js b/test/helpers/meetingTranscriptionRouting.test.js
index 08dc0bd9c..ce9063e83 100644
--- a/test/helpers/meetingTranscriptionRouting.test.js
+++ b/test/helpers/meetingTranscriptionRouting.test.js
@@ -21,6 +21,11 @@ const byokProviders = [
},
{ id: "corti", models: [{ id: "corti-transcribe" }] },
{ id: "tinfoil", models: [{ id: "voxtral-mini-4b-realtime" }] },
+ { id: "deepgram", models: [{ id: "nova-3", default: true }] },
+ {
+ id: "assemblyai",
+ models: [{ id: "universal-streaming-english", default: true }],
+ },
];
const baseOptions = {
@@ -54,6 +59,20 @@ test("providers mode routes Tinfoil through its realtime client", async () => {
});
});
+test("BYOK Deepgram and AssemblyAI route to their own realtime clients", async () => {
+ const { resolveMeetingTranscriptionOptions } = await load();
+
+ for (const [selectedProvider, model] of [
+ ["deepgram", "nova-3"],
+ ["assemblyai", "universal-streaming-english"],
+ ]) {
+ assert.deepEqual(
+ resolveMeetingTranscriptionOptions({ ...baseOptions, selectedProvider, selectedModel: "" }),
+ { provider: `${selectedProvider}-realtime`, model, mode: "byok", language: "en" }
+ );
+ }
+});
+
test("BYOK OpenAI never downgrades to managed cloud when its key is unavailable", async () => {
const { resolveMeetingTranscriptionOptions } = await load();
diff --git a/test/helpers/policyRules.test.js b/test/helpers/policyRules.test.js
index 748e8e035..23c010dc6 100644
--- a/test/helpers/policyRules.test.js
+++ b/test/helpers/policyRules.test.js
@@ -249,6 +249,80 @@ test("managed provider lists hide denied BYOK and enterprise providers", async (
assert.deepEqual(filterEnterpriseProviderOptionsByPolicy(enterpriseOptions, managed), []);
});
+test("unknown BYOK provider ids validate through but grant nothing", async () => {
+ const {
+ isProviderAllowedByPolicy,
+ filterByokProviderOptionsByPolicy,
+ filterModeOptionsByPolicy,
+ resolveEffectivePolicySelection,
+ } = await load();
+ const warnings = [];
+ const originalWarn = console.warn;
+ console.warn = (...args) => warnings.push(args.join(" "));
+ try {
+ const managed = {
+ status: "managed",
+ appVersion: "1.8.1",
+ policy: {
+ ...policy,
+ transcription: {
+ allowedModes: ["providers", "local"],
+ allowedByokProviders: ["future-stt", "openai"],
+ },
+ },
+ };
+
+ // Even asked about the unknown id directly — a stale synced selection — the
+ // answer is no, so the route resolver's fail-closed floor holds.
+ assert.equal(isProviderAllowedByPolicy(managed, "transcription", "future-stt"), false);
+ assert.equal(isProviderAllowedByPolicy(managed, "transcription", "openai"), true);
+ assert.deepEqual(
+ filterByokProviderOptionsByPolicy(
+ [{ id: "openai" }, { id: "future-stt" }, { id: "groq" }],
+ "transcription",
+ managed
+ ).map((option) => option.id),
+ ["openai"]
+ );
+ assert.deepEqual(
+ resolveEffectivePolicySelection(
+ managed,
+ "transcription",
+ { mode: "providers", provider: "future-stt" },
+ { modes: ["providers", "local"], byokProviders: ["openai", "groq"] }
+ ),
+ { mode: "providers", provider: "openai" }
+ );
+ assert.ok(
+ warnings.some((line) => line.includes("future-stt")),
+ "unknown ids are logged once so a newer server is diagnosable"
+ );
+
+ // A list made only of unknown ids leaves the BYOK mode with nothing to
+ // offer, catalog or not.
+ const unknownOnly = {
+ ...managed,
+ policy: {
+ ...managed.policy,
+ transcription: {
+ allowedModes: ["providers", "local"],
+ allowedByokProviders: ["future-stt"],
+ },
+ },
+ };
+ assert.deepEqual(
+ filterModeOptionsByPolicy(
+ [{ id: "providers" }, { id: "local" }],
+ "transcription",
+ unknownOnly
+ ).map((option) => option.id),
+ ["local"]
+ );
+ } finally {
+ console.warn = originalWarn;
+ }
+});
+
test("provider fallback preserves an allowed selection and chooses the first visible alternative", async () => {
const { reconcileProviderSelection } = await load();
const allowedProviders = [{ id: "bedrock" }, { id: "azure", disabled: true }];
@@ -825,10 +899,7 @@ test("missing required models is a pure set difference over disk truth", async (
assert.deepEqual(missingRequiredLocalModels([], []), []);
assert.deepEqual(missingRequiredLocalModels(["base"], []), ["base"]);
- assert.deepEqual(
- missingRequiredLocalModels(["base", "turbo"], ["turbo", "small"]),
- ["base"]
- );
+ assert.deepEqual(missingRequiredLocalModels(["base", "turbo"], ["turbo", "small"]), ["base"]);
assert.deepEqual(missingRequiredLocalModels(["base"], ["base"]), []);
});
@@ -839,19 +910,48 @@ test("enterprise transcription resolves through the transcription policy section
appVersion: "1.10.0",
policy: {
...policy,
- transcription: { allowedModes: ["enterprise"], allowedByokProviders: [], allowedEnterpriseProviders: ["azure"] },
+ transcription: {
+ allowedModes: ["enterprise"],
+ allowedByokProviders: [],
+ allowedEnterpriseProviders: ["azure"],
+ },
},
};
- const catalog = { modes: ["openwhispr", "providers", "local", "self-hosted", "enterprise"], byokProviders: ["openai"], enterpriseProviders: ["azure"] };
+ const catalog = {
+ modes: ["openwhispr", "providers", "local", "self-hosted", "enterprise"],
+ byokProviders: ["openai"],
+ enterpriseProviders: ["azure"],
+ };
assert.deepEqual(
- resolveEffectivePolicySelection(enterpriseOnly, "transcription", { mode: "openwhispr", provider: "" }, catalog),
+ resolveEffectivePolicySelection(
+ enterpriseOnly,
+ "transcription",
+ { mode: "openwhispr", provider: "" },
+ catalog
+ ),
{ mode: "enterprise", provider: "azure" }
);
- const options = filterModeOptionsByPolicy(catalog.modes.map((id) => ({ id })), "transcription", enterpriseOnly, catalog);
- assert.deepEqual(options.map((o) => o.id), ["enterprise"]);
+ const options = filterModeOptionsByPolicy(
+ catalog.modes.map((id) => ({ id })),
+ "transcription",
+ enterpriseOnly,
+ catalog
+ );
+ assert.deepEqual(
+ options.map((o) => o.id),
+ ["enterprise"]
+ );
// The meeting catalog has no enterprise lane, so meetings stay unresolvable (documented).
const meetingCatalog = { modes: ["openwhispr", "providers", "local"], byokProviders: ["openai"] };
- assert.equal(resolveEffectivePolicySelection(enterpriseOnly, "transcription", { mode: "local", provider: "" }, meetingCatalog), null);
+ assert.equal(
+ resolveEffectivePolicySelection(
+ enterpriseOnly,
+ "transcription",
+ { mode: "local", provider: "" },
+ meetingCatalog
+ ),
+ null
+ );
});
// Mirrors what TranscriptionSection/UploadTranscriptionPanel do: the
@@ -862,7 +962,12 @@ test("enterprise transcription resolves through the transcription policy section
// resolution, which then fails every dictation/upload closed.
test("the enterprise transcription tile is offered only to a managed policy snapshot", async () => {
const { isEnterpriseTranscriptionOfferable, filterModeOptionsByPolicy } = await load();
- const baseOptions = [{ id: "openwhispr" }, { id: "providers" }, { id: "local" }, { id: "self-hosted" }];
+ const baseOptions = [
+ { id: "openwhispr" },
+ { id: "providers" },
+ { id: "local" },
+ { id: "self-hosted" },
+ ];
const enterpriseOption = { id: "enterprise" };
const catalog = { byokProviders: ["openai"], enterpriseProviders: ["azure"] };
const buildOptions = (state) => [
@@ -904,11 +1009,8 @@ test("the enterprise transcription tile is offered only to a managed policy snap
managedEnterpriseAzure,
catalog
);
- assert.deepEqual(managedOptions.map((o) => o.id), [
- "openwhispr",
- "providers",
- "local",
- "self-hosted",
- "enterprise",
- ]);
+ assert.deepEqual(
+ managedOptions.map((o) => o.id),
+ ["openwhispr", "providers", "local", "self-hosted", "enterprise"]
+ );
});
diff --git a/test/helpers/policyValidation.test.js b/test/helpers/policyValidation.test.js
index 3d03ecc37..b8d3122b1 100644
--- a/test/helpers/policyValidation.test.js
+++ b/test/helpers/policyValidation.test.js
@@ -118,22 +118,17 @@ test("accepts empty allowlists", () => {
assert.equal(isValidPolicyShape(policy), true);
});
-test("rejects unknown modes and providers", () => {
+test("rejects unknown modes and enterprise providers", () => {
const cases = [
[
"transcription.allowedModes",
(policy) => policy.transcription.allowedModes.push("future-mode"),
],
["llm.allowedModes", (policy) => policy.llm.allowedModes.push("future-mode")],
- [
- "transcription.allowedByokProviders",
- (policy) => policy.transcription.allowedByokProviders.push("future-stt"),
- ],
[
"transcription.allowedEnterpriseProviders",
(policy) => (policy.transcription.allowedEnterpriseProviders = ["bedrock"]),
],
- ["llm.allowedByokProviders", (policy) => policy.llm.allowedByokProviders.push("future-llm")],
[
"llm.allowedEnterpriseProviders",
(policy) => policy.llm.allowedEnterpriseProviders.push("future-enterprise"),
@@ -159,6 +154,26 @@ test("enterprise transcription is additive within policy v1", () => {
assert.equal(isValidPolicyShape(withoutField), true);
});
+test("accepts unknown BYOK provider ids — shape-only forward compat", () => {
+ // The server enum can only grow once desktops in the field tolerate ids they
+ // do not know; discarding the whole policy here would fail cloud
+ // transcription closed for every managed user on the older build.
+ const policy = validPolicy();
+ policy.transcription.allowedByokProviders = ["openai", "future-stt"];
+ policy.llm.allowedByokProviders = ["future-llm"];
+ assert.equal(isValidPolicyShape(policy), true);
+});
+
+test("rejects malformed BYOK provider lists", () => {
+ for (const value of ["openai", [42], [null], [""], [{ id: "openai" }], {}]) {
+ for (const scope of ["transcription", "llm"]) {
+ const policy = validPolicy();
+ policy[scope].allowedByokProviders = value;
+ assert.equal(isValidPolicyShape(policy), false, `${scope}: ${JSON.stringify(value)}`);
+ }
+ }
+});
+
test("rejects a missing or non-object policy", () => {
assert.equal(isValidPolicyShape(undefined), false);
assert.equal(isValidPolicyShape(null), false);
diff --git a/test/helpers/providerConnectionTest.test.js b/test/helpers/providerConnectionTest.test.js
index af2bfce7f..e275ba8bb 100644
--- a/test/helpers/providerConnectionTest.test.js
+++ b/test/helpers/providerConnectionTest.test.js
@@ -21,6 +21,51 @@ test("honors OpenAI base URL overrides from the environment", () => {
}
});
+test("the realtime STT providers use their own auth schemes, not Bearer", () => {
+ const deepgram = resolveProviderRequest({ provider: "deepgram", apiKey: "dg-secret" });
+ assert.equal(deepgram.endpoint, "https://api.deepgram.com/v1/models");
+ assert.equal(deepgram.endpoint.includes("dg-secret"), false);
+ assert.equal(deepgram.headers.Authorization, "Token dg-secret");
+
+ const assemblyai = resolveProviderRequest({ provider: "assemblyai", apiKey: "aai-secret" });
+ assert.equal(assemblyai.endpoint, "https://api.assemblyai.com/v2/transcript?limit=1");
+ assert.equal(assemblyai.endpoint.includes("aai-secret"), false);
+ assert.equal(assemblyai.headers.Authorization, "aai-secret");
+});
+
+// Neither payload is OpenAI-shaped, so responseOffersModel would report
+// modelNotFound for a perfectly valid key.
+test("a 200 is the whole signal for providers with no OpenAI-shaped model list", async () => {
+ for (const [provider, model, payload] of [
+ ["deepgram", "nova-3", { stt: [{ name: "nova-3", canonical_name: "nova-3-general" }] }],
+ ["assemblyai", "universal-streaming-english", { transcripts: [], page_details: {} }],
+ ]) {
+ assert.deepEqual(
+ await testProviderConnection({ provider, apiKey: "k", model }, async () => ({
+ ok: true,
+ status: 200,
+ json: async () => payload,
+ })),
+ { success: true },
+ provider
+ );
+
+ assert.deepEqual(
+ await testProviderConnection({ provider, apiKey: "bad", model }, async () => ({
+ ok: false,
+ status: 401,
+ })),
+ {
+ success: false,
+ errorCode: "credentialsRejected",
+ error: "The provider rejected these credentials.",
+ status: 401,
+ },
+ provider
+ );
+ }
+});
+
test("normalizes custom compatible endpoints", () => {
assert.equal(
resolveProviderRequest({ provider: "custom", baseUrl: "localhost:11434/v1", apiKey: "" })
diff --git a/test/helpers/secretKeys.test.js b/test/helpers/secretKeys.test.js
index 0db76f844..6e385aa7f 100644
--- a/test/helpers/secretKeys.test.js
+++ b/test/helpers/secretKeys.test.js
@@ -63,6 +63,17 @@ test("openrouter is a first-class secret", () => {
assert.equal(env.getOpenrouterKey(), "sk-or-abc");
});
+// The accessor names come verbatim from the manifest rather than from `base`,
+// and realtimeTokenProviders.js / stt-canary.mjs call these exact spellings —
+// a base-derived rename would give getAssemblyaiKey and break them silently.
+test("the STT accessors keep the spellings their callers use", () => {
+ const env = new EnvironmentManager();
+ assert.equal(typeof env.getAssemblyAIKey, "function");
+ assert.equal(typeof env.saveAssemblyAIKey, "function");
+ assert.equal(typeof env.getDeepgramKey, "function");
+ assert.equal(typeof env.saveDeepgramKey, "function");
+});
+
test("preload BYOK_KEY_BRIDGES mirror the manifest exactly", () => {
// preload.js can't require the manifest under sandbox, so it inlines the
// {base, get, save} tuples. Assert they stay in lockstep with the manifest.
diff --git a/test/helpers/settingsStoreUploadTranscription.test.js b/test/helpers/settingsStoreUploadTranscription.test.js
new file mode 100644
index 000000000..4c8f7c0a5
--- /dev/null
+++ b/test/helpers/settingsStoreUploadTranscription.test.js
@@ -0,0 +1,54 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+// Upload inherits unset values from dictation, but a realtime-only dictation
+// provider has no batch route — inheriting it would fail every upload closed
+// on transcriptionRoute's guard. The picker hides those providers for the
+// upload scope and reconciles an unset selection to the first provider, so the
+// resolved value must land on the same default.
+test("upload transcription never inherits a realtime-only dictation provider", async (t) => {
+ installBrowserGlobals(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-upload-transcription-test-",
+ });
+ const { useSettingsStore, selectResolvedUploadTranscription } = await vite.ssrLoadModule(
+ "/stores/settingsStore.ts"
+ );
+ const { STREAMING_ONLY_PROVIDERS } = await vite.ssrLoadModule("/helpers/transcriptionRoute.ts");
+ const base = useSettingsStore.getState();
+
+ for (const provider of STREAMING_ONLY_PROVIDERS) {
+ const resolved = selectResolvedUploadTranscription({
+ ...base,
+ cloudTranscriptionProvider: provider,
+ cloudTranscriptionModel: "nova-3",
+ uploadCloudTranscriptionProvider: "",
+ uploadCloudTranscriptionModel: "",
+ });
+ assert.equal(resolved.cloudTranscriptionProvider, "openai", provider);
+ assert.equal(resolved.cloudTranscriptionModel, "", `${provider}'s model must not follow`);
+ }
+
+ // An explicit upload choice always wins, even a realtime-only one — the
+ // route guard then reports it truthfully instead of silently rerouting.
+ const explicit = selectResolvedUploadTranscription({
+ ...base,
+ cloudTranscriptionProvider: "deepgram",
+ uploadCloudTranscriptionProvider: "groq",
+ uploadCloudTranscriptionModel: "whisper-large-v3",
+ });
+ assert.equal(explicit.cloudTranscriptionProvider, "groq");
+ assert.equal(explicit.cloudTranscriptionModel, "whisper-large-v3");
+
+ // Batch-capable dictation providers keep inheriting provider and model.
+ const inherited = selectResolvedUploadTranscription({
+ ...base,
+ cloudTranscriptionProvider: "groq",
+ cloudTranscriptionModel: "whisper-large-v3-turbo",
+ uploadCloudTranscriptionProvider: "",
+ uploadCloudTranscriptionModel: "",
+ });
+ assert.equal(inherited.cloudTranscriptionProvider, "groq");
+ assert.equal(inherited.cloudTranscriptionModel, "whisper-large-v3-turbo");
+});
diff --git a/test/helpers/transcriptionRoute.test.js b/test/helpers/transcriptionRoute.test.js
index 41ef49b92..52a10ad90 100644
--- a/test/helpers/transcriptionRoute.test.js
+++ b/test/helpers/transcriptionRoute.test.js
@@ -160,6 +160,69 @@ test("custom requires a configured secure endpoint (empty, sentinel, garbage all
assert.deepEqual(localhost.auth, { scheme: "bearer", keyRef: "custom" });
});
+// The pre-guard fall-through returned an OpenAI http-batch route with
+// keyRef "openai" for any unrecognised provider, so selecting a realtime-only
+// provider and then uploading or retrying would have POSTed the user's audio to
+// api.openai.com under their OpenAI key.
+test("realtime-only providers fail closed instead of falling through to OpenAI", async () => {
+ const { STREAMING_ONLY_PROVIDERS } = await load();
+ assert.ok(STREAMING_ONLY_PROVIDERS.size > 0);
+
+ for (const provider of STREAMING_ONLY_PROVIDERS) {
+ for (const model of [undefined, "nova-3", "gpt-4o-mini-transcribe"]) {
+ const route = await resolve({
+ cloudTranscriptionProvider: provider,
+ cloudTranscriptionModel: model,
+ });
+ assert.equal(route.transport, "error", `${provider} must not produce a batch route`);
+ assert.equal(route.code, "STREAMING_ONLY_PROVIDER", provider);
+ assert.equal(
+ route.messageKey,
+ "hooks.audioRecording.errorDescriptions.streamingOnlyProvider"
+ );
+ assert.equal(route.provider, undefined, provider);
+ assert.equal(route.endpoint, undefined, provider);
+ assert.equal(
+ JSON.stringify(route).includes("openai.com"),
+ false,
+ `${provider} route leaked an OpenAI endpoint`
+ );
+ }
+ }
+});
+
+// Dictation only reaches the batch path for these providers when streaming was
+// skipped for want of a key, so the key — not the transport — is the diagnosis
+// there. Retry and upload cannot know about keys and keep the transport error.
+test("realtime-only providers report a missing key ahead of the transport limitation", async () => {
+ const { STREAMING_ONLY_PROVIDERS } = await load();
+
+ for (const provider of STREAMING_ONLY_PROVIDERS) {
+ const missingKey = await resolve(
+ { cloudTranscriptionProvider: provider },
+ { hasProviderKey: false }
+ );
+ assert.equal(missingKey.transport, "error", provider);
+ assert.equal(missingKey.code, "API_KEY_MISSING", provider);
+ assert.equal(
+ missingKey.messageKey,
+ "hooks.audioRecording.errorDescriptions.providerKeyMissing",
+ provider
+ );
+ assert.equal(JSON.stringify(missingKey).includes("openai.com"), false, provider);
+
+ for (const hasProviderKey of [true, undefined]) {
+ const route = await resolve({ cloudTranscriptionProvider: provider }, { hasProviderKey });
+ assert.equal(route.code, "STREAMING_ONLY_PROVIDER", `${provider} key=${hasProviderKey}`);
+ }
+ }
+
+ // The hint is only about realtime-only providers: batch providers diagnose
+ // their own missing key at the key read, with the store+env fallback.
+ const groq = await resolve({ cloudTranscriptionProvider: "groq" }, { hasProviderKey: false });
+ assert.equal(groq.transport, "http-batch");
+});
+
test("a custom URL pointing at Tinfoil's host must use the attested proxy", async () => {
const route = await resolve(
{
diff --git a/test/helpers/transcriptionRouteModelAgreement.test.js b/test/helpers/transcriptionRouteModelAgreement.test.js
index 96225b2be..b0b909a5b 100644
--- a/test/helpers/transcriptionRouteModelAgreement.test.js
+++ b/test/helpers/transcriptionRouteModelAgreement.test.js
@@ -11,7 +11,16 @@ const load = () => import("../../src/helpers/transcriptionRoute.ts");
//
// Tinfoil is excluded: its batch model comes from the registry directly
// (getBatchTranscriptionModel) and the route sends none.
-const PREFIX_VALIDATED_PROVIDERS = ["openai", "groq", "xai", "mistral", "corti", "gemini"];
+const PREFIX_VALIDATED_PROVIDERS = [
+ "openai",
+ "groq",
+ "xai",
+ "mistral",
+ "corti",
+ "gemini",
+ "deepgram",
+ "assemblyai",
+];
test("every shipping registry model survives resolveByokModel", async () => {
const { resolveByokModel } = await load();
@@ -73,4 +82,6 @@ test("a model belonging to another provider degrades to the provider default", a
assert.equal(resolveByokModel("mistral", "whisper-1"), "voxtral-mini-latest");
assert.equal(resolveByokModel("corti", "whisper-1"), "corti-transcribe");
assert.equal(resolveByokModel("gemini", "whisper-1"), "gemini-3.5-transcribe");
+ assert.equal(resolveByokModel("deepgram", "whisper-1"), "nova-3");
+ assert.equal(resolveByokModel("assemblyai", "nova-3"), "universal-3-5-pro");
});