Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
import type { InferenceProvider } from "./types";
import { buildApiUrl } from "../../../config/constants";
import { getSettings } from "../../../stores/settingsStore";
import logger from "../../../utils/logger";
import { resolveSelfHostedOpenAIBase } from "../openaiBase";
export const lanProvider: InferenceProvider = {
id: "lan",
async call({ text, model, agentName, config, ctx }) {
const isAgentCall = !!config.lanUrl;
const settings = getSettings();
const lanUrl = (config.lanUrl || settings.cleanupRemoteUrl).trim();
logger.logReasoning("LAN_START", { url: lanUrl, agentName, model });
try {
const baseUrl = resolveSelfHostedOpenAIBase(lanUrl);
const endpoint = buildApiUrl(baseUrl, "/chat/completions");
// Ask for the cleanup key at call time: the store copy in the dictation
// panel is only hydrated at startup, so a key saved in the control panel
// later would not be sent.
const apiKey =
config.customApiKey?.trim() || (isAgentCall ? "" : await ctx.getApiKey("custom"));
const resolvedModel = model?.trim() || "default";
return await ctx.callChatCompletionsApi(
endpoint,
apiKey,
resolvedModel,
text,
agentName,
config,
"LAN"
);
} catch (error) {
logger.logReasoning("LAN_ERROR", {
url: lanUrl,
error: (error as Error).message,
errorType: (error as Error).name,
});
throw error;
}
},
};