The AI-native screen recorder. Record your screen and talk; the people you share it with and your AI agents both get it.
Rust agent-readableai-agentsarecclaude-codecodexcursorlocal-firstmacosprivacyrustscreen-recorderscreen-recordingtauritranscriptiontypescriptwindows
Sync from upstream 36cfa25ea331
Shubham Agrawal002714a56710
diff --git a/desktop/README.md b/desktop/README.mdindex 9123e83..c479094 100644--- a/desktop/README.md+++ b/desktop/README.md@@ -229,11 +229,12 @@ Everything, unless you choose otherwise in Settings:| No model provider, on-device transcription | Nothing. || A model provider for spoken moments (OpenRouter, OpenAI, Gemini, Groq or a custom URL) | The transcript text, the labels of what you clicked and a bounded sample of pointer and key events go to that provider. Video and screenshots do not. With OpenRouter, requests also name the app (`HTTP-Referer: https://clipy.online`, `X-Title: Clipy`). || Ollama or LM Studio | Nothing: the model runs on your machine. |-| A transcription key (OpenRouter, OpenAI, Groq, Deepgram, AssemblyAI, ElevenLabs or Gemini; Windows) | The audio goes to that provider. With OpenRouter it goes to openrouter.ai, which passes it to the transcription model you name (Whisper large v3 turbo unless you pick another). |+| A transcription key (OpenRouter, OpenAI, Groq, Deepgram, AssemblyAI, ElevenLabs or Gemini) | The audio goes to that provider. With OpenRouter it goes to openrouter.ai, which passes it to the transcription model you name (Whisper large v3 turbo unless you pick another). |-macOS transcribes with Apple's on-device speech recognition; on macOS 26 and-later, macOS may download Apple's speech model for your language the first-time (no audio is sent). On Windows Clipy Local downloads its speech model by+macOS transcribes with Apple's on-device speech recognition unless you choose+a provider with your own key in Settings, Preferences, AI and transcription;+on macOS 26 and later, macOS may download Apple's speech model for your+language the first time (no audio is sent). On Windows Clipy Local downloads its speech model byitself, once, a few seconds after it first starts: "English, fast" (about104 MB, from GitHub) on a PC set to English, "All languages" (about 161 MB,from Hugging Face) on a PC set to another language. The download fetches thediff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.tomlindex beeafd4..f6705fc 100644--- a/desktop/src-tauri/Cargo.toml+++ b/desktop/src-tauri/Cargo.toml@@ -20,9 +20,9 @@ default = ["local"]cloud = []# What the local edition runs in place of Clipy's servers: moment selection on# this computer (plus an optional model provider of the user's own), local-# settings and keys, and on Windows own-key transcription (`clipy-local-stt`,-# the on-device engine, is in both editions on macOS and Windows, so it is not-# part of this feature). Build+# settings and keys, and own-key transcription (`clipy-local-stt`, the+# on-device engine and the providers, is in both editions on macOS and+# Windows, so it is not part of this feature). Build# the local edition with no flags; it is the default here.local = ["dep:clipy-local-moments",@@ -129,6 +129,8 @@ tokio-tungstenite = { version = "0.30", default-features = false, features = ["h# linked, Metal shaders embedded) for the `whisper-small` model, the one that# takes the transcription dictionary as its prompt.clipy-local-stt = { path = "crates/clipy-local-stt", default-features = false, features = ["local", "static", "whisper", "metal"] }+# Own-key transcription providers (OpenRouter, OpenAI, ...) in both editions.+clipy-local-edition = { path = "crates/clipy-local-edition", optional = true, features = ["stt"] }[target.'cfg(unix)'.dependencies]libc = "0.2"diff --git a/desktop/src-tauri/crates/clipy-local-edition/Cargo.toml b/desktop/src-tauri/crates/clipy-local-edition/Cargo.tomlindex 7868918..8581465 100644--- a/desktop/src-tauri/crates/clipy-local-edition/Cargo.toml+++ b/desktop/src-tauri/crates/clipy-local-edition/Cargo.toml@@ -13,9 +13,9 @@ publish = false[features]default = []-# Provider configs for clipy-local-stt (Windows transcription) built from the-# saved settings. The app turns it on for Windows only, where it links-# clipy-local-stt; the Mac never does.+# Provider configs for clipy-local-stt built from the saved settings: the+# own-key transcription providers. The app turns it on for macOS and Windows,+# where it links clipy-local-stt.stt = ["dep:clipy-local-stt"][dependencies]diff --git a/desktop/src-tauri/crates/clipy-local-edition/src/settings.rs b/desktop/src-tauri/crates/clipy-local-edition/src/settings.rsindex d4303dd..583086b 100644--- a/desktop/src-tauri/crates/clipy-local-edition/src/settings.rs+++ b/desktop/src-tauri/crates/clipy-local-edition/src/settings.rs@@ -182,12 +182,12 @@ impl TranscriptionKind {})}- /// Kinds this platform can run. The Mac transcribes with Apple Speech- /// only (the transcription crate is not in the Mac build); Windows has no- /// Apple Speech.+ /// Kinds this platform can run. The Mac transcribes with Apple Speech or+ /// a provider with the user's key (Clipy Local's Mac build has no+ /// downloaded models); Windows has no Apple Speech.pub fn allowed_on(self, platform: Platform) -> bool {match platform {- Platform::Mac => self == TranscriptionKind::Apple,+ Platform::Mac => self == TranscriptionKind::Apple || self.is_provider(),Platform::Windows => self != TranscriptionKind::Apple,Platform::Other => true,}@@ -382,7 +382,8 @@ impl StoredTranscription {TranscriptionKind::Local => {"Downloaded transcription models are only available on Windows.".into()}- _ => "This Mac transcribes on the device with Apple Speech.".into(),+ _ => "This Mac transcribes with Apple Speech, or with a provider and your own key."+ .into(),});}if self.kind == TranscriptionKind::Local && self.local_model.is_none() {@@ -1111,8 +1112,23 @@ mod tests {).unwrap_err().contains("Windows"));- assert!(apply_save(&mac, &keys, &req("deepgram", Value::Null), Platform::Mac).is_err());+ assert!(apply_save(&mac, &keys, &req("none", Value::Null), Platform::Mac).is_err());assert!(apply_save(&mac, &keys, &req("apple", Value::Null), Platform::Mac).is_ok());+ // A provider with the user's key works on the Mac too.+ for kind in [+ "openrouter",+ "openai",+ "groq",+ "deepgram",+ "assemblyai",+ "elevenlabs",+ "gemini",+ ] {+ assert!(+ apply_save(&mac, &keys, &req(kind, Value::Null), Platform::Mac).is_ok(),+ "{kind}"+ );+ }let win = windows();assert!(apply_save(&win, &keys, &req("apple", Value::Null), Platform::Windows)diff --git a/desktop/src-tauri/src/local/mod.rs b/desktop/src-tauri/src/local/mod.rsindex d8c4ce8..7c51833 100644--- a/desktop/src-tauri/src/local/mod.rs+++ b/desktop/src-tauri/src/local/mod.rs@@ -15,8 +15,13 @@ pub mod live_stt;#[cfg(any(target_os = "windows", target_os = "macos", test))]#[cfg_attr(all(target_os = "macos", not(test)), allow(dead_code))]mod media;-/// Local edition: the settings commands of `settings-api.ts`.+/// Local edition settings and keys, the commands of `settings-api.ts`. The+/// official app reads them too, for "Your own key" transcription (`own_key`).pub mod settings;+/// Transcription with a provider and the user's own key.+#[cfg(any(target_os = "macos", target_os = "windows"))]+#[cfg_attr(target_os = "windows", allow(dead_code))]+mod own_key;pub mod viewer;/// Saving a recording out of its folder: the video, or the whole take as a ZIP.mod export;@@ -758,6 +763,11 @@ pub async fn preflight<R: Runtime>(app: &AppHandle<R>) -> Result<()> {if crate::transcription_models::chosen_model(app).is_some() {return Ok(());}+ // A provider with the user's own key transcribes instead of Apple Speech.+ #[cfg(target_os = "macos")]+ if own_key::provider_chosen(app) {+ return Ok(());+ }let _ = app;tauri::async_runtime::spawn_blocking(|| -> Result<()> {native(json!({"op":"check", "authorize":true}))?;@@ -795,9 +805,12 @@ pub fn start<R: Runtime>(app: &AppHandle<R>, dir: PathBuf, new_take: bool) -> Re// Start consuming the microphone now, so recognition runs while the take// does and only the tail is left at Stop. A failure here is not fatal: the// processing thread falls back to transcribing the recording file.+ // Not when a provider with the user's own key transcribes the take.#[cfg(target_os = "macos")]- if let Err(error) = live_stt::begin() {- tracing::warn!("live transcription unavailable, using the recording file: {error:#}");+ if !own_key::provider_chosen(app) {+ if let Err(error) = live_stt::begin() {+ tracing::warn!("live transcription unavailable, using the recording file: {error:#}");+ }}let app = app.clone();let handle = tauri::async_runtime::handle();@@ -1120,6 +1133,18 @@ fn narration_moments(notes: &[NarrationNote], planned: &[Moment], duration_ms: uout}+/// Records where a take's audio is going with the user's own key, before it+/// is sent, and updates the AREC already on disk: the local edition's+/// disclosure record. (Clipy Local on Windows records it in+/// `edition::transcribe`.)+#[cfg(target_os = "macos")]+fn record_own_key_recipient(+ dir: &Path,+ recipient: &clipy_local_edition::disclosure::Recipient,+) -> Result<()> {+ edition::update_disclosure(dir, |d| d.add_audio(recipient.clone()))+}+fn process<R: Runtime>(app: &AppHandle<R>,dir: &Path,@@ -1135,39 +1160,58 @@ fn process<R: Runtime>(} else {Transcript::default()};+ // A provider with the user's own key replaces the built-in engine for+ // recordings (`own_key`). Clipy Local on Windows runs it inside+ // `edition::transcribe` instead.+ #[cfg(target_os = "macos")]+ let own = own_key::chosen(app);+ #[cfg(target_os = "macos")]+ let own_used = !matches!(own, own_key::OwnKey::Off);status(app, dir, "transcribing", &edition::transcribing_message(app))?;#[cfg(any(target_os = "macos", target_os = "windows"))]let video = dir.join("recording.mp4");#[cfg(target_os = "macos")]- let model = crate::transcription_models::chosen_model(app);- #[cfg(target_os = "windows")]- local_edition_transcribe(app, dir, cancel, handle, &video, &mut transcript, &transcript_path)?;- #[cfg(target_os = "macos")]- let apple_failed = resolve_apple_outcome(- model.is_some(),- cancel.load(Ordering::SeqCst),- transcribe_on_device(app, dir, cancel, &video, &mut transcript, &transcript_path),- )?;- // Apple Speech transcribes in the system language (SFSpeech uses the- // current locale, SpeechAnalyzer its supported equivalent). A downloaded- // model below replaces this with the language it reports.- #[cfg(target_os = "macos")]- if !apple_failed && transcript.language.is_none() {- transcript.language = apple_speech_locale();- }- #[cfg(target_os = "macos")]- if let Some(model) = model {- transcribe_with_model(+ if own_used {+ own_key::transcribe(app,dir,cancel,&video,&mut transcript,&transcript_path,- model,- apple_failed,+ own,+ |recipient| record_own_key_recipient(dir, recipient),)?;}+ #[cfg(target_os = "windows")]+ local_edition_transcribe(app, dir, cancel, handle, &video, &mut transcript, &transcript_path)?;+ #[cfg(target_os = "macos")]+ if !own_used {+ let model = crate::transcription_models::chosen_model(app);+ let apple_failed = resolve_apple_outcome(+ model.is_some(),+ cancel.load(Ordering::SeqCst),+ transcribe_on_device(app, dir, cancel, &video, &mut transcript, &transcript_path),+ )?;+ // Apple Speech transcribes in the system language (SFSpeech uses the+ // current locale, SpeechAnalyzer its supported equivalent). A+ // downloaded model below replaces this with the language it reports.+ if !apple_failed && transcript.language.is_none() {+ transcript.language = apple_speech_locale();+ }+ if let Some(model) = model {+ transcribe_with_model(+ app,+ dir,+ cancel,+ &video,+ &mut transcript,+ &transcript_path,+ model,+ apple_failed,+ )?;+ }+ }// Cleanup, then the dictionary's spelling pass, before the status leaves// "transcribing" (a talk take pastes the words as soon as it does). Agent// narration is never rewritten: on a retry the reloaded transcriptdiff --git a/desktop/src-tauri/src/local/own_key.rs b/desktop/src-tauri/src/local/own_key.rsnew file mode 100644index 0000000..0ad3d5b--- /dev/null+++ b/desktop/src-tauri/src/local/own_key.rs@@ -0,0 +1,212 @@+//! Transcription with a provider and the user's own key (OpenRouter, OpenAI,+//! Groq, Deepgram, AssemblyAI, ElevenLabs, Gemini), for a recording saved on+//! this computer. Chosen in the local edition's settings (`local_edition` in+//! settings.json, keys in `local-keys.json`), which both editions read: Clipy+//! Local offers it next to Apple Speech or the downloaded models, the+//! official app as "Your own key" in Settings, Transcription.+//!+//! When a provider is chosen it replaces the built-in engine for recordings+//! (Apple Speech or a downloaded model on the Mac, Clipy's server or a model+//! on Windows). Dictation keeps its own engine. The audio goes to that+//! provider only: a failure fails the take with Retry and never falls back+//! to another engine or to Clipy. Before any audio is sent, `before_send`+//! records where it is going, so the AREC never understates it.+//!+//! Clipy Local on Windows runs providers through `edition::transcribe`, which+//! predates this module; everything else comes here.++use clipy_local_edition::disclosure::Recipient;+use clipy_local_edition::settings::{stt_config, transcription_plan, TranscriptionPlan};+use tauri::{AppHandle, Runtime};++use super::settings::{load_keys, load_settings};++/// What the settings ask for.+pub(crate) enum OwnKey {+ /// No provider chosen: the built-in engine transcribes.+ Off,+ /// A provider is chosen but cannot run (no key). The take ends with a gap+ /// that says so, and Retry transcribes again once it is fixed.+ Unusable(String),+ /// A provider is chosen and has its key.+ Ready {+ config: clipy_local_stt::ProviderConfig,+ recipient: Recipient,+ },+}++/// The provider the settings choose for recordings, if any.+pub(crate) fn chosen<R: Runtime>(app: &AppHandle<R>) -> OwnKey {+ let settings = load_settings(app);+ match transcription_plan(&settings) {+ TranscriptionPlan::Provider { kind, recipient } => {+ let keys = load_keys(app);+ match stt_config(+ kind,+ settings.transcription.model.as_deref(),+ keys.transcription_key(kind),+ ) {+ Ok(config) => OwnKey::Ready { config, recipient },+ Err(message) => OwnKey::Unusable(message),+ }+ }+ _ => OwnKey::Off,+ }+}++/// Whether a provider is chosen for recordings (with or without its key).+/// Cheap: one settings read. The Mac uses it to skip Apple Speech.+#[cfg_attr(not(target_os = "macos"), allow(dead_code))]+pub(crate) fn provider_chosen<R: Runtime>(app: &AppHandle<R>) -> bool {+ matches!(+ transcription_plan(&load_settings(app)),+ TranscriptionPlan::Provider { .. }+ )+}++/// The status line while a take waits for its provider.+pub(crate) fn waiting_message(recipient: &Recipient) -> String {+ format!(+ "Waiting for the recording to finish, then transcribing with {} using your key",+ recipient.name+ )+}++/// Wait for the seal, then transcribe `video` with the chosen provider.+/// `before_send` runs once, before any audio leaves, and must record the+/// recipient; if it fails nothing is sent.+#[cfg(any(target_os = "macos", target_os = "windows"))]+#[allow(clippy::too_many_arguments)]+pub(crate) fn transcribe<R: Runtime>(+ app: &AppHandle<R>,+ dir: &std::path::Path,+ cancel: &std::sync::atomic::AtomicBool,+ video: &std::path::Path,+ transcript: &mut super::Transcript,+ transcript_path: &std::path::Path,+ choice: OwnKey,+ before_send: impl FnOnce(&Recipient) -> anyhow::Result<()>,+) -> anyhow::Result<()> {+ use std::sync::atomic::{AtomicBool, Ordering};+ use std::time::Duration;++ use anyhow::bail;+ use clipy_local_edition::transcript as gaps;+ use clipy_local_stt::{CancelToken, SttError};++ use super::{media, status, write_json, DEVICE};++ let cancelled = || format!("Local processing cancelled. Saved files remain on this {DEVICE}.");+ // The whole take is sent, so this waits for the seal.+ while !dir.join("metadata.json").exists() {+ if cancel.load(Ordering::SeqCst) {+ bail!(cancelled());+ }+ std::thread::sleep(Duration::from_secs(1));+ }+ let duration_ms = std::fs::read(dir.join("metadata.json"))+ .ok()+ .and_then(|bytes| serde_json::from_slice::<serde_json::Value>(&bytes).ok())+ .and_then(|metadata| metadata["duration_ms"].as_u64())+ .unwrap_or(0);+ // A retry after a finished transcript keeps it, unless it ended on a+ // setting the user has had the chance to fix.+ if duration_ms > 0+ && transcript.through_ms >= duration_ms+ && !gaps::needs_retry(&transcript.gaps)+ {+ return Ok(());+ }+ // Pieces are not resumable: start over.+ *transcript = super::Transcript::default();+ let finish = |transcript: &mut super::Transcript, gap: &str, through_ms: u64| {+ transcript.gaps.push(gap.to_string());+ transcript.through_ms = through_ms;+ write_json(transcript_path, transcript)+ };+ let (config, recipient) = match choice {+ OwnKey::Off => bail!("No transcription provider is chosen."),+ OwnKey::Unusable(message) => {+ return finish(transcript, &gaps::missing_key_gap(&message), duration_ms);+ }+ OwnKey::Ready { config, recipient } => (config, recipient),+ };++ status(+ app,+ dir,+ "transcribing",+ "Preparing audio for transcription",+ )?;+ let Some(pcm) = media::extract_pcm(video, &dir.join("cancelled"))? else {+ return finish(transcript, gaps::NO_AUDIO_GAP, duration_ms);+ };+ if cancel.load(Ordering::SeqCst) {+ bail!(cancelled());+ }+ let pcm_ms = pcm.len() as u64 * 1000 / u64::from(media::AUDIO_SAMPLE_RATE);+ let through_ms = if duration_ms > 0 { duration_ms } else { pcm_ms };++ // Recorded before any audio leaves the computer.+ before_send(&recipient)?;+ status(+ app,+ dir,+ "transcribing",+ &format!(+ "Transcribing with {} ({}) using your key",+ recipient.name, recipient.host+ ),+ )?;++ // The providers poll a CancelToken; the job is cancelled through an+ // AtomicBool. A watcher on a scoped thread joins the two.+ let token = CancelToken::new();+ let finished = AtomicBool::new(false);+ let result = std::thread::scope(|scope| {+ scope.spawn(|| {+ while !finished.load(Ordering::SeqCst) {+ if cancel.load(Ordering::SeqCst) {+ token.cancel();+ return;+ }+ std::thread::sleep(Duration::from_millis(200));+ }+ });+ let result = clipy_local_stt::transcribe_with_provider(&pcm, &config, &token);+ finished.store(true, Ordering::SeqCst);+ result+ });+ drop(pcm);++ match result {+ Ok(result) => {+ transcript.segments = gaps::segment_values(+ result+ .segments+ .into_iter()+ .map(|s| (s.start_ms, s.end_ms, s.text)),+ through_ms,+ );+ transcript.gaps.extend(+ result+ .gaps+ .iter()+ .map(|g| gaps::gap_line(g.start_ms, g.end_ms, &g.reason)),+ );+ if transcript.segments.is_empty() && transcript.gaps.is_empty() {+ transcript.gaps.push(gaps::NO_SPEECH_GAP.to_string());+ }+ transcript.language = result.language;+ transcript.through_ms = through_ms;+ write_json(transcript_path, transcript)+ }+ Err(SttError::Cancelled) => bail!(cancelled()),+ // Provider errors name the provider and the HTTP status only, never+ // the key or a response body.+ Err(error) => bail!(+ "{}. Your recording remains on this {DEVICE}; Retry to transcribe again.",+ error.to_string().trim_end_matches('.')+ ),+ }+}diff --git a/desktop/src-tauri/src/local/settings.rs b/desktop/src-tauri/src/local/settings.rsindex d4d6e11..c8e6b01 100644--- a/desktop/src-tauri/src/local/settings.rs+++ b/desktop/src-tauri/src/local/settings.rs@@ -17,6 +17,8 @@//! data folder through `keychain.rs`. No key is ever returned, logged or put//! in an error.+// The official app uses only the settings and keys (own-key transcription).+use std::path::PathBuf;use clipy_local_edition::settings::{diff --git a/desktop/src/components/recorder/OwnKeyTranscription.tsx b/desktop/src/components/recorder/OwnKeyTranscription.tsxnew file mode 100644index 0000000..2896a92--- /dev/null+++ b/desktop/src/components/recorder/OwnKeyTranscription.tsx@@ -0,0 +1,164 @@+import { useCallback, useEffect, useState } from "react";+import { useTranslations } from "use-intl";++import {+ getLocalSettings,+ saveLocalSettings,+ type KeyUpdate,+ type LocalSettingsDto,+ type TranscriptionKind,+} from "../../edition-local/settings-api";+import { TRANSCRIPTION_PROVIDERS, transcriptionProvider } from "../../edition-local/transcriptionProviders";+import { isWindows } from "../../lib/platform";+import { InlineSelect, SettingRow } from "./ui";++type Choice = TranscriptionKind | "off";++const FIELD = "w-full rounded-xl bg-row px-3 py-2 text-[14px] text-ink-text placeholder:text-ink-muted";+const BUTTON =+ "rounded-lg bg-row px-2.5 py-1 text-[12px] font-medium text-ink-text hover:bg-row-hover disabled:opacity-50";++/** The stored choice: a provider, or off when the built-in engine runs. */+function choiceOf(settings: LocalSettingsDto["transcription"]): Choice {+ return transcriptionProvider(settings.kind) ? settings.kind : "off";+}++/**+ * Settings, Transcription, "Your own key": recordings saved on this computer+ * are transcribed by a provider with the user's key (OpenRouter, OpenAI, ...)+ * instead of the speech model above. Dictation keeps the speech model. The+ * choice and the key live in the local settings (`get_local_settings`,+ * `save_local_settings`; the key in an owner-only file, never shown again).+ */+export function OwnKeyTranscription() {+ const t = useTranslations("desktop.settings.ownKey");+ const [stored, setStored] = useState<LocalSettingsDto["transcription"] | null>(null);+ const [choice, setChoice] = useState<Choice>("off");+ const [keyDraft, setKeyDraft] = useState("");+ const [replacing, setReplacing] = useState(false);+ const [model, setModel] = useState("");+ const [saving, setSaving] = useState(false);+ const [message, setMessage] = useState<{ tone: "ok" | "error"; text: string } | null>(null);++ const load = useCallback(() => {+ getLocalSettings()+ .then((settings) => {+ setStored(settings.transcription);+ setChoice(choiceOf(settings.transcription));+ setModel(settings.transcription.model ?? "");+ })+ .catch((err) => setMessage({ tone: "error", text: String(err) }));+ }, []);+ useEffect(() => {+ load();+ }, [load]);++ if (!stored) return null;++ const provider = choice === "off" ? null : transcriptionProvider(choice);+ const hasKey = stored.hasApiKey && choiceOf(stored) === choice;+ const dirty =+ choice !== choiceOf(stored) ||+ (provider !== null && (keyDraft.trim() !== "" || replacing || model.trim() !== (stored.model ?? "")));++ const save = async () => {+ setSaving(true);+ setMessage(null);+ const apiKey: KeyUpdate = keyDraft.trim()+ ? { action: "set", value: keyDraft.trim() }+ : replacing+ ? { action: "clear" }+ : { action: "keep" };+ try {+ const next = await saveLocalSettings({+ transcription: provider+ ? { kind: provider.kind, localModel: null, model: model.trim() || null, apiKey }+ : // Off: the built-in engine. These are only the local settings'+ // own defaults; the speech model above is what runs.+ isWindows+ ? { kind: "local", localModel: "english-fast", model: null, apiKey: { action: "keep" } }+ : { kind: "apple", localModel: null, model: null, apiKey: { action: "keep" } },+ });+ setStored(next.transcription);+ setChoice(choiceOf(next.transcription));+ setModel(next.transcription.model ?? "");+ setKeyDraft("");+ setReplacing(false);+ setMessage({ tone: "ok", text: t("saved") });+ } catch (err) {+ setMessage({ tone: "error", text: String(err) });+ } finally {+ setSaving(false);+ }+ };++ return (+ <SettingRow+ title={t("title")}+ subtitle={provider ? t("onSubtitle", { provider: provider.name, host: provider.host }) : t("offSubtitle")}+ trailing={+ <InlineSelect<Choice>+ ariaLabel={t("title")}+ value={choice}+ onChange={(next) => {+ setChoice(next);+ setKeyDraft("");+ setReplacing(false);+ setMessage(null);+ if (next !== choiceOf(stored)) setModel("");+ else setModel(stored.model ?? "");+ }}+ items={[+ { value: "off" as Choice, label: t("off") },+ ...TRANSCRIPTION_PROVIDERS.map((p) => ({ value: p.kind as Choice, label: p.name })),+ ]}+ />+ }+ >+ {(provider || dirty || message) && (+ <div className="space-y-2">+ {provider && (hasKey && !replacing ? (+ <div className="flex items-center gap-2 text-[13px] text-ink-secondary">+ <span>{t("keySaved", { provider: provider.name })}</span>+ <button type="button" className={BUTTON} onClick={() => setReplacing(true)}>+ {t("replaceKey")}+ </button>+ </div>+ ) : (+ <input+ type="password"+ autoComplete="off"+ spellCheck={false}+ aria-label={t("keyLabel", { provider: provider.name })}+ placeholder={t("keyLabel", { provider: provider.name })}+ value={keyDraft}+ onChange={(event) => setKeyDraft(event.target.value)}+ className={FIELD}+ />+ ))}+ {provider && (+ <input+ type="text"+ spellCheck={false}+ aria-label={t("modelLabel")}+ placeholder={provider.kind === "openrouter" ? t("openRouterModelPlaceholder") : t("modelPlaceholder")}+ value={model}+ onChange={(event) => setModel(event.target.value)}+ className={FIELD}+ />+ )}+ <div className="flex items-center gap-3">+ <button type="button" className={BUTTON} disabled={!dirty || saving} onClick={() => void save()}>+ {saving ? t("saving") : t("save")}+ </button>+ {message && (+ <span role={message.tone === "error" ? "alert" : "status"} className={`text-[12px] ${message.tone === "error" ? "text-status-error" : "text-ink-secondary"}`}>+ {message.text}+ </span>+ )}+ </div>+ </div>+ )}+ </SettingRow>+ );+}diff --git a/desktop/src/components/recorder/SettingsSheet.tsx b/desktop/src/components/recorder/SettingsSheet.tsxindex 0403be2..e69d5eb 100644--- a/desktop/src/components/recorder/SettingsSheet.tsx+++ b/desktop/src/components/recorder/SettingsSheet.tsx@@ -36,6 +36,7 @@ import { ShortcutsEditor } from "./ShortcutsEditor";import { TranscriptionDictionary } from "./TranscriptionDictionary";import { TranscriptCleanup } from "./TranscriptCleanup";import { TranscriptionSettings } from "./TranscriptionSettings";+import { OwnKeyTranscription } from "./OwnKeyTranscription";import { WindowCaptureChoice } from "./WindowCaptureChoice";import { Icon, InlineSelect, PrimaryButton, SectionTitle, SettingRow, Switch, tabKeyTarget, type IconName } from "./ui";@@ -464,6 +465,7 @@ export function SettingsSheet(p: SettingsSheetProps) {{tab === "transcription" && HAS_TRANSCRIPTION_TAB && (<div key="transcription" className="clipy-fade-in pb-4"><TranscriptionSettings heading={t("transcriptionTab.modelTitle")} />+ <OwnKeyTranscription /><SectionTitle>{t("transcriptionTab.wordsTitle")}</SectionTitle><TranscriptCleanup /><TranscriptionDictionary />diff --git a/desktop/src/edition-local/LocalPreferences.tsx b/desktop/src/edition-local/LocalPreferences.tsxindex e6830b3..3d77e94 100644--- a/desktop/src/edition-local/LocalPreferences.tsx+++ b/desktop/src/edition-local/LocalPreferences.tsx@@ -8,6 +8,7 @@ import { MeetingSettings } from "../components/recorder/MeetingSettings";import { LOCAL_PROJECT_URL } from "../lib/edition";import { useDesktopT, type DesktopT } from "../lib/messages";import { deviceName, isWindows } from "../lib/platform";+import { TRANSCRIPTION_PROVIDERS } from "./transcriptionProviders";import {cancelLocalModelDownload,downloadLocalModel,@@ -72,20 +73,22 @@ interface TranscriptionOption {provider: string;}+/** A provider with the user's own key: the audio goes to it. */+const PROVIDER_TRANSCRIPTION: TranscriptionOption[] = TRANSCRIPTION_PROVIDERS.map((p) => ({+ value: p.kind as TranscriptionChoice,+ label: `${p.name} (your key)`,+ provider: p.name,+}));+const MAC_TRANSCRIPTION: TranscriptionOption[] = [{ value: "apple", label: "On this Mac (Apple Speech)", provider: "" },+ ...PROVIDER_TRANSCRIPTION,];const WINDOWS_TRANSCRIPTION: TranscriptionOption[] = [{ value: "local:english-fast", label: "English, fast (download, about 104 MB)", provider: "" },{ value: "local:multilingual", label: "All languages (download, about 161 MB)", provider: "" },- { value: "openrouter", label: "OpenRouter (your key)", provider: "OpenRouter" },- { value: "openai", label: "OpenAI (your key)", provider: "OpenAI" },- { value: "groq", label: "Groq (your key)", provider: "Groq" },- { value: "deepgram", label: "Deepgram (your key)", provider: "Deepgram" },- { value: "assemblyai", label: "AssemblyAI (your key)", provider: "AssemblyAI" },- { value: "elevenlabs", label: "ElevenLabs (your key)", provider: "ElevenLabs" },- { value: "gemini", label: "Gemini (your key)", provider: "Gemini" },+ ...PROVIDER_TRANSCRIPTION,];const TRANSCRIPTION_OPTIONS = isWindows ? WINDOWS_TRANSCRIPTION : MAC_TRANSCRIPTION;@@ -627,19 +630,10 @@ function TranscriptionSection({});};- if (!isWindows) {- return (- <SettingRow- title={t("local.preferences.transcription.title")}- subtitle={t("local.preferences.transcription.macSubtitle")}- />- );- }-return (<SettingRowtitle={t("local.preferences.transcription.title")}- subtitle={t("local.preferences.transcription.windowsSubtitle")}+ subtitle={t(isWindows ? "local.preferences.transcription.windowsSubtitle" : "local.preferences.transcription.macKeySubtitle")}trailing={<InlineSelect<TranscriptionChoice>ariaLabel={t("local.preferences.transcription.title")}diff --git a/desktop/src/edition-local/transcriptionProviders.ts b/desktop/src/edition-local/transcriptionProviders.tsnew file mode 100644index 0000000..77d82ff--- /dev/null+++ b/desktop/src/edition-local/transcriptionProviders.ts@@ -0,0 +1,21 @@+import type { TranscriptionKind } from "./settings-api";++/**+ * Providers that transcribe a recording with the user's own key, the audio+ * going to that provider. The same list in Clipy Local (Mac and Windows) and+ * in the official app's "Your own key" setting. Order: OpenRouter first,+ * because one OpenRouter key reaches many transcription models.+ */+export const TRANSCRIPTION_PROVIDERS: { kind: TranscriptionKind; name: string; host: string }[] = [+ { kind: "openrouter", name: "OpenRouter", host: "openrouter.ai" },+ { kind: "openai", name: "OpenAI", host: "api.openai.com" },+ { kind: "groq", name: "Groq", host: "api.groq.com" },+ { kind: "deepgram", name: "Deepgram", host: "api.deepgram.com" },+ { kind: "assemblyai", name: "AssemblyAI", host: "api.assemblyai.com" },+ { kind: "elevenlabs", name: "ElevenLabs", host: "api.elevenlabs.io" },+ { kind: "gemini", name: "Gemini", host: "generativelanguage.googleapis.com" },+];++export function transcriptionProvider(kind: TranscriptionKind) {+ return TRANSCRIPTION_PROVIDERS.find((p) => p.kind === kind) ?? null;+}diff --git a/desktop/src/vendor/i18n/messages/en/desktop.json b/desktop/src/vendor/i18n/messages/en/desktop.jsonindex 4e63faa..388a731 100644--- a/desktop/src/vendor/i18n/messages/en/desktop.json+++ b/desktop/src/vendor/i18n/messages/en/desktop.json@@ -231,6 +231,7 @@"saveLabel": "{action} transcription","macSubtitle": "On this Mac with Apple Speech, while you record. The audio never leaves this Mac.","windowsSubtitle": "A downloaded model transcribes on this PC. A provider key sends the audio to that provider instead.",+ "macKeySubtitle": "Apple Speech transcribes on this Mac while you record, and the audio stays here. A provider key sends the audio to that provider instead.","apple": "On this Mac (Apple Speech)","englishFast": "English, fast (download, about 104 MB)","multilingual": "All languages (download, about 161 MB)",@@ -540,6 +541,21 @@"voicesMissing": "The voice models ({size}) download when needed.","writer": "Notes are written by {writer}.","systemAudio": "Turn on system audio for the recording, so the call is captured."+ },+ "ownKey": {+ "title": "Your own key",+ "off": "Off",+ "offSubtitle": "Recordings use the speech model above. Choose a provider to transcribe them with your own key instead.",+ "onSubtitle": "Recordings saved on this computer are transcribed by {provider} with your key: their audio goes to {host}. Dictation keeps the speech model above.",+ "keyLabel": "{provider} API key",+ "keySaved": "{provider} key saved",+ "replaceKey": "Replace",+ "modelLabel": "Transcription model",+ "modelPlaceholder": "Model (optional, the provider's default otherwise)",+ "openRouterModelPlaceholder": "Model (optional, openai/whisper-large-v3-turbo otherwise)",+ "save": "Save",+ "saving": "Saving…",+ "saved": "Saved. Used from the next recording."}},"ui": {diff --git a/packages/moments/src/generated/keyMomentsFusion.ts b/packages/moments/src/generated/keyMomentsFusion.tsindex bb90735..76026c4 100644--- a/packages/moments/src/generated/keyMomentsFusion.ts+++ b/packages/moments/src/generated/keyMomentsFusion.ts@@ -237,7 +237,7 @@ function flarePosition(moves: readonly CursorMove[], atMs: number): {}export function fuseMoments(input: FuseInput): FusedMoment[] {const { deixis, clicks, moves, hovers, segments, durationMs, normalizeAt } = input;- const clickByCue = assignClicks(deixis, clicks.filter(click => normalizeAt(click.x, click.y, click.tMs) !== null));+ const clickByCue = assignClicks(deixis, clicks.filter((click) => normalizeAt(click.x, click.y, click.tMs) !== null));const usedClicks = new Set<number>([...clickByCue.values()].map((click) => click.tMs));const usedDwells = new Set<number>();const annotations = groupDrawAnnotations(input.strokes ?? []);diff --git a/packages/moments/src/generated/localMomentPlan.ts b/packages/moments/src/generated/localMomentPlan.tsindex 2d3c252..43bd907 100644--- a/packages/moments/src/generated/localMomentPlan.ts+++ b/packages/moments/src/generated/localMomentPlan.ts@@ -175,7 +175,10 @@ function projectV1(moments: readonly {}) => (m.spoken ? 0 : V1_GESTURE_PRIORITY[m.moment.source]);const ranked = [...moments].sort((a, b) => priority(a) - priority(b) || a.moment.frame_at_ms - b.moment.frame_at_ms);const seen = new Set<number>();- const kept: Array<{ timestamp_ms: number; reason: string }> = [];+ const kept: Array<{+ timestamp_ms: number;+ reason: string;+ }> = [];for (const { moment } of ranked) {if (seen.has(moment.frame_at_ms))continue;