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
Add Tinfoil private inference provider (#875)
Zach880f4f6c10ef
diff --git a/.env.example b/.env.exampleindex 8bc9e3b7a..7a3712042 100644--- a/.env.example+++ b/.env.example@@ -32,6 +32,10 @@ GEMINI_API_KEY=your_gemini_api_key_here# Get your API key from: https://console.groq.com/keysGROQ_API_KEY=your_groq_api_key_here+# Tinfoil API Configuration (optional - for private cloud LLM inference)+# Get your API key from: https://tinfoil.sh/inference+TINFOIL_API_KEY=your_tinfoil_api_key_here+# Mistral API Configuration (optional - for Voxtral transcription)# Get your API key from: https://console.mistral.ai/api-keysMISTRAL_API_KEY=your_mistral_api_key_herediff --git a/README.md b/README.mdindex d4fd8cf5a..3daf91ee2 100644--- a/README.md+++ b/README.md@@ -41,7 +41,7 @@ OpenWhispr turns your voice into text, notes, and actions from your desktop. Pre## Features- **Voice dictation** — global hotkey to dictate into any app with automatic pasting-- **AI agent** — talk to GPT-5, Claude, Gemini, Groq, or local models with a named voice assistant+- **AI agent** — talk to GPT-5, Claude, Gemini, Groq, Tinfoil, or local models with a named voice assistant- **Voice agent hotkey** — dedicated hotkey that sends your dictation straight to your AI agent as a command, no wake word needed and no cleanup pass- **Meeting transcription** — auto-detect Zoom, Teams, and FaceTime calls with live speaker diarization, voice fingerprinting, and Google Calendar integration- **Local speaker diarization** — on-device speaker labelling with voice fingerprint recognition across meetings, no cloud requireddiff --git a/docs/network-allowlist.md b/docs/network-allowlist.mdindex 5395cd745..2d8166cd8 100644--- a/docs/network-allowlist.md+++ b/docs/network-allowlist.md@@ -54,13 +54,14 @@ Contacted only if the user connects Google Calendar in settings.Required only when a user configures their own API key for the correspondingprovider. Skip any provider not in use.-| Host | Protocol | Port | Used when |-| ----------------------------------- | -------- | ---- | ------------------------------------------------------- |-| `api.openai.com` | HTTPS | 443 | OpenAI API key configured (transcription or reasoning). |-| `api.anthropic.com` | HTTPS | 443 | Anthropic API key configured. |-| `generativelanguage.googleapis.com` | HTTPS | 443 | Gemini API key configured. |-| `api.groq.com` | HTTPS | 443 | Groq API key configured. |-| `api.mistral.ai` | HTTPS | 443 | Mistral API key configured. |+| Host | Protocol | Port | Used when |+| ----------------------------------- | ---------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `api.openai.com` | HTTPS | 443 | OpenAI API key configured (transcription or reasoning). |+| `api.anthropic.com` | HTTPS | 443 | Anthropic API key configured. |+| `generativelanguage.googleapis.com` | HTTPS | 443 | Gemini API key configured. |+| `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. |## Notesdiff --git a/src/components/ReasoningModelSelector.tsx b/src/components/ReasoningModelSelector.tsxindex e0150d970..97601221a 100644--- a/src/components/ReasoningModelSelector.tsx+++ b/src/components/ReasoningModelSelector.tsx@@ -33,7 +33,7 @@ type CloudModelOption = {invertInDark?: boolean;};-const CLOUD_PROVIDER_IDS = ["openai", "anthropic", "gemini", "groq", "custom"];+const CLOUD_PROVIDER_IDS = ["openai", "anthropic", "gemini", "groq", "tinfoil", "custom"];interface ReasoningModelSelectorProps {reasoningModel: string;@@ -320,6 +320,8 @@ export default function ReasoningModelSelector({const setGeminiApiKey = useSettingsStore((s) => s.setGeminiApiKey);const groqApiKey = useSettingsStore((s) => s.groqApiKey);const setGroqApiKey = useSettingsStore((s) => s.setGroqApiKey);+ const tinfoilApiKey = useSettingsStore((s) => s.tinfoilApiKey);+ const setTinfoilApiKey = useSettingsStore((s) => s.setTinfoilApiKey);const [selectedMode, setSelectedMode] = useState<"cloud" | "local">(mode || "cloud");const [selectedCloudProvider, setSelectedCloudProvider] = useState("openai");const [selectedLocalProvider, setSelectedLocalProvider] = useState("qwen");@@ -624,6 +626,31 @@ export default function ReasoningModelSelector({</div>)}+ {selectedCloudProvider === "tinfoil" && (+ <div className="space-y-2">+ <div className="flex items-baseline justify-between">+ <h4 className="font-medium text-foreground">{t("common.apiKey")}</h4>+ <a+ href="https://tinfoil.sh/inference?utm_source=referral&utm_campaign=openwhispr"+ target="_blank"+ rel="noopener noreferrer"+ onClick={createExternalLinkHandler(+ "https://tinfoil.sh/inference?utm_source=referral&utm_campaign=openwhispr"+ )}+ className="text-xs text-link underline decoration-link/30 hover:decoration-link/60 cursor-pointer transition-colors"+ >+ {t("reasoning.getApiKey")}+ </a>+ </div>+ <ApiKeyInput+ apiKey={tinfoilApiKey}+ setApiKey={setTinfoilApiKey}+ label=""+ helpText=""+ />+ </div>+ )}+<div className="pt-3 space-y-2"><h4 className="text-sm font-medium text-foreground">{t("reasoning.selectModel")}diff --git a/src/components/chat/useChatStreaming.ts b/src/components/chat/useChatStreaming.tsindex 0b3420103..9484114c7 100644--- a/src/components/chat/useChatStreaming.ts+++ b/src/components/chat/useChatStreaming.ts@@ -99,9 +99,14 @@ export function useChatStreaming({const isLanAgent = chatAgentMode === "self-hosted" && !!settings.chatAgentRemoteUrl;const isCustomAgent =chatAgentMode === "providers" && settings.chatAgentProvider === "custom";- const isLocalProvider = !["openai", "groq", "custom", "anthropic", "gemini"].includes(- settings.chatAgentProvider- );+ const isLocalProvider = ![+ "openai",+ "groq",+ "custom",+ "anthropic",+ "gemini",+ "tinfoil",+ ].includes(settings.chatAgentProvider);const localModelCanUseTool =isLocalProvider && estimateModelSizeB(settings.chatAgentModel) >= LOCAL_TOOL_MIN_PARAMS_B;const supportsTools = isCloudAgent || !isLocalProvider || localModelCanUseTool;diff --git a/src/components/ui/PromptStudio.tsx b/src/components/ui/PromptStudio.tsxindex eaa95c490..e45d2347e 100644--- a/src/components/ui/PromptStudio.tsx+++ b/src/components/ui/PromptStudio.tsx@@ -38,6 +38,7 @@ const PROVIDER_CONFIG: Record<string, ProviderConfig> = {anthropic: { label: "Anthropic", apiKeyStorageKey: "anthropicApiKey" },gemini: { label: "Gemini", apiKeyStorageKey: "geminiApiKey" },groq: { label: "Groq", apiKeyStorageKey: "groqApiKey" },+ tinfoil: { label: "Tinfoil", apiKeyStorageKey: "tinfoilApiKey" },openwhispr: { label: "OpenWhispr Cloud" },custom: {label: "Custom endpoint",diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex 62941e205..246473bfd 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1894,7 +1894,13 @@"anthropic_claude_opus_4_8": "Leistungsstärkstes Claude-Modell","anthropic_claude_opus_4_7": "Leistungsstarkes Opus-Modell","anthropic_claude_opus_4_6": "Vorherige Opus-Generation, 1M Kontext",- "anthropic_claude_opus_4_5": "Früheres Opus-Modell"+ "anthropic_claude_opus_4_5": "Früheres Opus-Modell",+ "tinfoil_deepseek_v4_pro": "Privates Long-Context-Reasoning in sicheren Enklaven, 800K Kontext",+ "tinfoil_glm_5_2": "Privates agentisches Engineering-Modell in sicheren Enklaven, 384K Kontext",+ "tinfoil_kimi_k2_6": "Privates Modell für langfristiges Coding und Multimodalität, 256K Kontext",+ "tinfoil_gemma4_31b": "Privates mehrsprachiges Reasoning-Modell mit Tool-Aufrufen, 256K Kontext",+ "tinfoil_gpt_oss_120b": "Privates Open-Weight-Reasoning-Modell mit Tool-Nutzung, 131K Kontext",+ "tinfoil_llama3_3_70b": "Privates Konversationsmodell mit Tool-Aufrufen, 128K Kontext"},"enterprise": {"bedrock_claude_haiku_4_5": "Schnell und günstig. Ideal zum Bereinigen von Text.",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex 5ba722519..0dc22a14e 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1986,7 +1986,13 @@"anthropic_claude_opus_4_8": "Most capable Claude model","anthropic_claude_opus_4_7": "Powerful Opus model","anthropic_claude_opus_4_6": "Previous Opus generation, 1M context",- "anthropic_claude_opus_4_5": "Earlier Opus model"+ "anthropic_claude_opus_4_5": "Earlier Opus model",+ "tinfoil_deepseek_v4_pro": "Private long-context reasoning in secure enclaves, 800K context",+ "tinfoil_glm_5_2": "Private agentic engineering model in secure enclaves, 384K context",+ "tinfoil_kimi_k2_6": "Private long-horizon coding and multimodal model, 256K context",+ "tinfoil_gemma4_31b": "Private multilingual reasoning model with tool calling, 256K context",+ "tinfoil_gpt_oss_120b": "Private open-weight reasoning model with tool use, 131K context",+ "tinfoil_llama3_3_70b": "Private conversational model with tool calling, 128K context"},"enterprise": {"bedrock_claude_haiku_4_5": "Fast and cheap. Great default for text cleanup.",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 50840e640..3e24210d4 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1942,7 +1942,13 @@"anthropic_claude_opus_4_8": "Modelo Claude más capaz","anthropic_claude_opus_4_7": "Modelo Opus potente","anthropic_claude_opus_4_6": "Generación anterior de Opus, contexto de 1M",- "anthropic_claude_opus_4_5": "Modelo Opus anterior"+ "anthropic_claude_opus_4_5": "Modelo Opus anterior",+ "tinfoil_deepseek_v4_pro": "Razonamiento privado de contexto largo en enclaves seguros, contexto de 800K",+ "tinfoil_glm_5_2": "Modelo privado de ingeniería agéntica en enclaves seguros, contexto de 384K",+ "tinfoil_kimi_k2_6": "Modelo privado de codificación a largo plazo y multimodal, contexto de 256K",+ "tinfoil_gemma4_31b": "Modelo privado de razonamiento multilingüe con llamada a herramientas, contexto de 256K",+ "tinfoil_gpt_oss_120b": "Modelo privado de razonamiento de pesos abiertos con uso de herramientas, contexto de 131K",+ "tinfoil_llama3_3_70b": "Modelo privado conversacional con llamada a herramientas, contexto de 128K"},"enterprise": {"bedrock_claude_haiku_4_5": "Rápido y económico. Ideal para limpiar texto.",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 1ca1adef6..05e0a1cac 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1942,7 +1942,13 @@"anthropic_claude_opus_4_8": "Modèle Claude le plus performant","anthropic_claude_opus_4_7": "Modèle Opus puissant","anthropic_claude_opus_4_6": "Génération Opus précédente, contexte 1M",- "anthropic_claude_opus_4_5": "Modèle Opus antérieur"+ "anthropic_claude_opus_4_5": "Modèle Opus antérieur",+ "tinfoil_deepseek_v4_pro": "Raisonnement privé à long contexte dans des enclaves sécurisées, contexte 800K",+ "tinfoil_glm_5_2": "Modèle privé d'ingénierie agentique dans des enclaves sécurisées, contexte 384K",+ "tinfoil_kimi_k2_6": "Modèle privé de codage longue durée et multimodal, contexte 256K",+ "tinfoil_gemma4_31b": "Modèle privé de raisonnement multilingue avec appel d'outils, contexte 256K",+ "tinfoil_gpt_oss_120b": "Modèle privé de raisonnement à poids ouverts avec usage d'outils, contexte 131K",+ "tinfoil_llama3_3_70b": "Modèle privé conversationnel avec appel d'outils, contexte 128K"},"enterprise": {"bedrock_claude_haiku_4_5": "Rapide et économique. Parfait pour nettoyer le texte.",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 118e1a188..d423fe6e7 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1894,7 +1894,13 @@"anthropic_claude_opus_4_8": "Modello Claude più capace","anthropic_claude_opus_4_7": "Modello Opus potente","anthropic_claude_opus_4_6": "Generazione Opus precedente, contesto da 1M",- "anthropic_claude_opus_4_5": "Modello Opus meno recente"+ "anthropic_claude_opus_4_5": "Modello Opus meno recente",+ "tinfoil_deepseek_v4_pro": "Ragionamento privato a contesto lungo in enclave sicure, contesto 800K",+ "tinfoil_glm_5_2": "Modello privato di ingegneria agentica in enclave sicure, contesto 384K",+ "tinfoil_kimi_k2_6": "Modello privato di coding a lungo termine e multimodale, contesto 256K",+ "tinfoil_gemma4_31b": "Modello privato di ragionamento multilingue con chiamata di strumenti, contesto 256K",+ "tinfoil_gpt_oss_120b": "Modello privato di ragionamento open-weight con uso di strumenti, contesto 131K",+ "tinfoil_llama3_3_70b": "Modello privato conversazionale con chiamata di strumenti, contesto 128K"},"enterprise": {"bedrock_claude_haiku_4_5": "Veloce ed economico. Ideale per ripulire il testo.",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex e70e63ddc..b3ddb822f 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1894,7 +1894,13 @@"anthropic_claude_opus_4_8": "最も高性能な Claude モデル","anthropic_claude_opus_4_7": "高性能な Opus モデル","anthropic_claude_opus_4_6": "前世代の Opus、100 万トークンコンテキスト",- "anthropic_claude_opus_4_5": "旧世代の Opus モデル"+ "anthropic_claude_opus_4_5": "旧世代の Opus モデル",+ "tinfoil_deepseek_v4_pro": "セキュアエンクレーブ内のプライベート長文脈推論、800K コンテキスト",+ "tinfoil_glm_5_2": "セキュアエンクレーブ内のプライベート・エージェント型エンジニアリングモデル、384K コンテキスト",+ "tinfoil_kimi_k2_6": "プライベートな長期コーディング・マルチモーダルモデル、256K コンテキスト",+ "tinfoil_gemma4_31b": "ツール呼び出し対応のプライベート多言語推論モデル、256K コンテキスト",+ "tinfoil_gpt_oss_120b": "ツール使用対応のプライベート・オープンウェイト推論モデル、131K コンテキスト",+ "tinfoil_llama3_3_70b": "ツール呼び出し対応のプライベート会話モデル、128K コンテキスト"},"enterprise": {"bedrock_claude_haiku_4_5": "高速で低コスト。テキスト整形に最適です。",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex 9e3554e20..248c967c6 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1873,7 +1873,13 @@"anthropic_claude_opus_4_8": "Modelo Claude mais capaz","anthropic_claude_opus_4_7": "Modelo Opus potente","anthropic_claude_opus_4_6": "Geração anterior do Opus, contexto de 1M",- "anthropic_claude_opus_4_5": "Modelo Opus mais antigo"+ "anthropic_claude_opus_4_5": "Modelo Opus mais antigo",+ "tinfoil_deepseek_v4_pro": "Raciocínio privado de contexto longo em enclaves seguros, contexto de 800K",+ "tinfoil_glm_5_2": "Modelo privado de engenharia agêntica em enclaves seguros, contexto de 384K",+ "tinfoil_kimi_k2_6": "Modelo privado de codificação de longo prazo e multimodal, contexto de 256K",+ "tinfoil_gemma4_31b": "Modelo privado de raciocínio multilíngue com chamada de ferramentas, contexto de 256K",+ "tinfoil_gpt_oss_120b": "Modelo privado de raciocínio de pesos abertos com uso de ferramentas, contexto de 131K",+ "tinfoil_llama3_3_70b": "Modelo privado conversacional com chamada de ferramentas, contexto de 128K"},"enterprise": {"bedrock_claude_haiku_4_5": "Rápido e barato. Ótimo para limpar texto.",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex 8d71af0b2..e950197d2 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1894,7 +1894,13 @@"anthropic_claude_opus_4_8": "Самая мощная модель Claude","anthropic_claude_opus_4_7": "Мощная модель Opus","anthropic_claude_opus_4_6": "Предыдущее поколение Opus, контекст 1M",- "anthropic_claude_opus_4_5": "Более ранняя модель Opus"+ "anthropic_claude_opus_4_5": "Более ранняя модель Opus",+ "tinfoil_deepseek_v4_pro": "Приватное рассуждение с длинным контекстом в защищённых анклавах, контекст 800K",+ "tinfoil_glm_5_2": "Приватная агентная инженерная модель в защищённых анклавах, контекст 384K",+ "tinfoil_kimi_k2_6": "Приватная модель для длительного кодинга и мультимодальности, контекст 256K",+ "tinfoil_gemma4_31b": "Приватная многоязычная модель рассуждений с вызовом инструментов, контекст 256K",+ "tinfoil_gpt_oss_120b": "Приватная модель рассуждений с открытыми весами и использованием инструментов, контекст 131K",+ "tinfoil_llama3_3_70b": "Приватная разговорная модель с вызовом инструментов, контекст 128K"},"enterprise": {"bedrock_claude_haiku_4_5": "Быстрая и дешёвая. Отлично подходит для очистки текста.",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex ee4bde64d..c9c638624 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1889,7 +1889,13 @@"anthropic_claude_opus_4_8": "最强大的 Claude 模型","anthropic_claude_opus_4_7": "强大的 Opus 模型","anthropic_claude_opus_4_6": "上一代 Opus,1M 上下文",- "anthropic_claude_opus_4_5": "更早的 Opus 模型"+ "anthropic_claude_opus_4_5": "更早的 Opus 模型",+ "tinfoil_deepseek_v4_pro": "安全飞地中的私密长上下文推理,800K 上下文",+ "tinfoil_glm_5_2": "安全飞地中的私密智能体工程模型,384K 上下文",+ "tinfoil_kimi_k2_6": "私密长程编码与多模态模型,256K 上下文",+ "tinfoil_gemma4_31b": "支持工具调用的私密多语言推理模型,256K 上下文",+ "tinfoil_gpt_oss_120b": "支持工具使用的私密开源权重推理模型,131K 上下文",+ "tinfoil_llama3_3_70b": "支持工具调用的私密对话模型,128K 上下文"},"enterprise": {"bedrock_claude_haiku_4_5": "快速且低成本。适合文本清理。",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex ceb3b2e33..83e56bbbc 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1889,7 +1889,13 @@"anthropic_claude_opus_4_8": "最強大的 Claude 模型","anthropic_claude_opus_4_7": "強大的 Opus 模型","anthropic_claude_opus_4_6": "上一代 Opus 模型,1M 上下文",- "anthropic_claude_opus_4_5": "較早的 Opus 模型"+ "anthropic_claude_opus_4_5": "較早的 Opus 模型",+ "tinfoil_deepseek_v4_pro": "安全飛地中的私密長上下文推理,800K 上下文",+ "tinfoil_glm_5_2": "安全飛地中的私密智能體工程模型,384K 上下文",+ "tinfoil_kimi_k2_6": "私密長程編碼與多模態模型,256K 上下文",+ "tinfoil_gemma4_31b": "支援工具呼叫的私密多語言推理模型,256K 上下文",+ "tinfoil_gpt_oss_120b": "支援工具使用的私密開放權重推理模型,131K 上下文",+ "tinfoil_llama3_3_70b": "支援工具呼叫的私密對話模型,128K 上下文"},"enterprise": {"bedrock_claude_haiku_4_5": "快速且低成本。適合文字清理。",diff --git a/src/models/modelRegistryData.json b/src/models/modelRegistryData.jsonindex 7f453802c..b12b10f43 100644--- a/src/models/modelRegistryData.json+++ b/src/models/modelRegistryData.json@@ -451,6 +451,65 @@"descriptionKey": "models.descriptions.cloud.groq_kimi_k2_0905"}]+ },+ {+ "id": "tinfoil",+ "name": "Tinfoil",+ "models": [+ {+ "id": "deepseek-v4-pro",+ "name": "DeepSeek V4 Pro",+ "description": "Private long-context reasoning in secure enclaves, 800K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_deepseek_v4_pro",+ "supportsThinking": true+ },+ {+ "id": "glm-5-2",+ "name": "GLM-5.2",+ "description": "Private agentic engineering model in secure enclaves, 384K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_glm_5_2",+ "supportsThinking": true+ },+ {+ "id": "kimi-k2-6",+ "name": "Kimi K2.6",+ "description": "Private long-horizon coding and multimodal model, 256K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_kimi_k2_6",+ "supportsThinking": true+ },+ {+ "id": "gemma4-31b",+ "name": "Gemma 4 31B",+ "description": "Private multilingual reasoning model with tool calling, 256K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_gemma4_31b",+ "supportsThinking": true+ },+ {+ "id": "gpt-oss-120b",+ "name": "GPT-OSS 120B",+ "description": "Private open-weight reasoning model with tool use, 131K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_gpt_oss_120b",+ "supportsThinking": true+ },+ {+ "id": "llama3-3-70b",+ "name": "Llama 3.3 70B",+ "description": "Private conversational model with tool calling, 128K context",+ "tokenParam": "max_tokens",+ "supportsTemperature": true,+ "descriptionKey": "models.descriptions.cloud.tinfoil_llama3_3_70b"+ }+ ]}],"enterpriseProviders": [diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex a9f7df3e2..6a0dce77f 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -15,6 +15,7 @@ import { getAIModel } from "./ai/providers";import { PROVIDER_REGISTRY, type ProviderContext } from "./ai/inferenceProviders";import { getConfiguredOpenAIBase } from "./ai/openaiBase";import { applyThinkingSuppression } from "./ai/thinkingSuppression";+import { clearTinfoilClientCache } from "./ai/tinfoilClient";export type AgentStreamChunk =| { type: "content"; text: string }@@ -62,7 +63,7 @@ class ReasoningService extends BaseReasoningService {}private async getApiKey(- provider: "openai" | "anthropic" | "gemini" | "groq" | "custom"+ provider: "openai" | "anthropic" | "gemini" | "groq" | "tinfoil" | "custom"): Promise<string> {if (provider === "custom") {let customKey = "";@@ -100,6 +101,7 @@ class ReasoningService extends BaseReasoningService {anthropic: () => window.electronAPI.getAnthropicKey(),gemini: () => window.electronAPI.getGeminiKey(),groq: () => window.electronAPI.getGroqKey(),+ tinfoil: () => window.electronAPI.getTinfoilKey?.(),};apiKey = (await keyGetters[provider]()) ?? undefined;@@ -335,7 +337,7 @@ class ReasoningService extends BaseReasoningService {provider: string,config: ReasoningConfig & { systemPrompt: string }): AsyncGenerator<string, void, unknown> {- const cloudProviders = ["openai", "groq", "gemini", "anthropic", "custom"];+ const cloudProviders = ["openai", "groq", "gemini", "anthropic", "tinfoil", "custom"];const isLocalProvider = !cloudProviders.includes(provider);const settings = getSettings();@@ -356,7 +358,13 @@ class ReasoningService extends BaseReasoningService {}endpoint = `http://127.0.0.1:${serverResult.port}/v1/chat/completions`;} else {- const providerKey = provider as "openai" | "groq" | "gemini" | "anthropic" | "custom";+ const providerKey = provider as+ | "openai"+ | "groq"+ | "gemini"+ | "anthropic"+ | "tinfoil"+ | "custom";const overrideKey = providerKey === "custom" ? config.customApiKey?.trim() : "";apiKey = overrideKey || (await this.getApiKey(providerKey));@@ -367,6 +375,8 @@ class ReasoningService extends BaseReasoningService {case "gemini":endpoint = buildApiUrl(API_ENDPOINTS.GEMINI, "/openai/chat/completions");break;+ case "tinfoil":+ throw new Error("Tinfoil streaming must use the verified SDK transport");case "openai":case "custom":endpoint = buildApiUrl(@@ -538,7 +548,7 @@ class ReasoningService extends BaseReasoningService {);}- const cloudProviders = ["openai", "groq", "gemini", "anthropic", "custom"];+ const cloudProviders = ["openai", "groq", "gemini", "anthropic", "tinfoil", "custom"];const isLocalProvider = !cloudProviders.includes(provider);const settings = getSettings();@@ -567,7 +577,13 @@ class ReasoningService extends BaseReasoningService {}baseURL = `http://127.0.0.1:${serverResult.port}/v1`;} else {- const providerKey = provider as "openai" | "groq" | "gemini" | "anthropic" | "custom";+ const providerKey = provider as+ | "openai"+ | "groq"+ | "gemini"+ | "anthropic"+ | "tinfoil"+ | "custom";const overrideKey = providerKey === "custom" ? config.customApiKey?.trim() : "";apiKey = overrideKey || (await this.getApiKey(providerKey));baseURL =@@ -576,7 +592,7 @@ class ReasoningService extends BaseReasoningService {const apiConfig = getOpenAiApiConfig(model);const aiProvider = isLocalProvider || isLanCleanup ? "local" : provider;- const aiModel = getAIModel(aiProvider, model, apiKey, baseURL);+ const aiModel = await getAIModel(aiProvider, model, apiKey, baseURL);const modelDef = getCloudModel(model);const userSuppressesThinking = config.disableThinking === true && !!modelDef?.supportsThinking;@@ -858,6 +874,7 @@ class ReasoningService extends BaseReasoningService {const anthropicKey = await window.electronAPI?.getAnthropicKey?.();const geminiKey = await window.electronAPI?.getGeminiKey?.();const groqKey = await window.electronAPI?.getGroqKey?.();+ const tinfoilKey = await window.electronAPI?.getTinfoilKey?.();const localAvailable = await window.electronAPI?.checkLocalReasoningAvailable?.();logger.logReasoning("API_KEY_CHECK", {@@ -865,10 +882,11 @@ class ReasoningService extends BaseReasoningService {hasAnthropic: !!anthropicKey,hasGemini: !!geminiKey,hasGroq: !!groqKey,+ hasTinfoil: !!tinfoilKey,hasLocal: !!localAvailable,});- return !!(openaiKey || anthropicKey || geminiKey || groqKey || localAvailable);+ return !!(openaiKey || anthropicKey || geminiKey || groqKey || tinfoilKey || localAvailable);} catch (error) {logger.logReasoning("API_KEY_CHECK_ERROR", {error: (error as Error).message,@@ -886,9 +904,13 @@ class ReasoningService extends BaseReasoningService {if (provider !== "custom") {this.apiKeyCache.delete(provider);}+ if (provider === "tinfoil") {+ clearTinfoilClientCache();+ }logger.logReasoning("API_KEY_CACHE_CLEARED", { provider });} else {this.apiKeyCache.clear();+ clearTinfoilClientCache();logger.logReasoning("API_KEY_CACHE_CLEARED", { provider: "all" });}}diff --git a/src/services/ai/inferenceProviders/index.ts b/src/services/ai/inferenceProviders/index.tsindex 58bfe5c46..b865f4a96 100644--- a/src/services/ai/inferenceProviders/index.ts+++ b/src/services/ai/inferenceProviders/index.ts@@ -7,6 +7,7 @@ import { enterpriseProvider } from "./enterprise";import { openwhisprProvider } from "./openwhispr";import { lanProvider } from "./lan";import { openaiProvider } from "./openai";+import { tinfoilProvider } from "./tinfoil";export const PROVIDER_REGISTRY: Readonly<Record<string, InferenceProvider>> = Object.freeze({openai: openaiProvider,@@ -14,6 +15,7 @@ export const PROVIDER_REGISTRY: Readonly<Record<string, InferenceProvider>> = Obanthropic: anthropicProvider,gemini: geminiProvider,groq: groqProvider,+ tinfoil: tinfoilProvider,local: localProvider,bedrock: enterpriseProvider,azure: enterpriseProvider,diff --git a/src/services/ai/inferenceProviders/tinfoil.ts b/src/services/ai/inferenceProviders/tinfoil.tsnew file mode 100644index 000000000..ab3682d37--- /dev/null+++ b/src/services/ai/inferenceProviders/tinfoil.ts@@ -0,0 +1,87 @@+import type { InferenceProvider } from "./types";+import { TOKEN_LIMITS } from "../../../config/constants";+import { getOpenAiApiConfig } from "../../../models/ModelRegistry";+import { withRetry, createApiRetryStrategy } from "../../../utils/retry";+import logger from "../../../utils/logger";+import { applyThinkingSuppression } from "../thinkingSuppression";+import { getTinfoilChatClient } from "../tinfoilClient";++const REQUEST_TIMEOUT_MS = 30_000;++export const tinfoilProvider: InferenceProvider = {+ id: "tinfoil",+ async call({ text, model, agentName, config, ctx }) {+ logger.logReasoning("TINFOIL_START", { model, agentName });++ const apiKey = await ctx.getApiKey("tinfoil");+ // The client verifies enclave attestation before every request and+ // refuses to send anything over an unverified transport.+ const client = await getTinfoilChatClient(apiKey);++ const systemPrompt = config.systemPrompt || ctx.getSystemPrompt(agentName);+ const messages = [+ { role: "system", content: systemPrompt },+ { role: "user", content: text },+ ];++ const apiConfig = getOpenAiApiConfig(model);+ const maxTokens =+ config.maxTokens ||+ Math.max(+ 4096,+ ctx.calculateMaxTokens(+ text.length,+ TOKEN_LIMITS.MIN_TOKENS,+ TOKEN_LIMITS.MAX_TOKENS,+ TOKEN_LIMITS.TOKEN_MULTIPLIER+ )+ );++ const requestBody: Record<string, unknown> = {+ model,+ messages,+ [apiConfig.tokenParam]: maxTokens,+ };++ if (apiConfig.supportsTemperature) {+ requestBody.temperature = config.temperature ?? 0.3;+ }++ applyThinkingSuppression(requestBody, model, "tinfoil", config);++ // 30s per attempt like sibling providers; SDK-internal retries off so+ // withRetry stays the single retry layer.+ const response = await withRetry(+ () =>+ client.chat.completions.create(requestBody as any, {+ timeout: REQUEST_TIMEOUT_MS,+ maxRetries: 0,+ }),+ createApiRetryStrategy()+ );++ const responseText =+ response.choices+ ?.map((choice: any) => choice?.message?.content)+ .find((content: unknown) => typeof content === "string" && content.trim())+ ?.trim() || "";++ logger.logReasoning("TINFOIL_RESPONSE", {+ model,+ responseLength: responseText.length,+ tokensUsed: response.usage?.total_tokens || 0,+ success: true,+ isEmpty: responseText.length === 0,+ });++ if (!responseText) {+ logger.logReasoning("TINFOIL_EMPTY_RESPONSE_FALLBACK", {+ model,+ originalTextLength: text.length,+ });+ return text;+ }++ return responseText;+ },+};diff --git a/src/services/ai/providers.ts b/src/services/ai/providers.tsindex f49da8884..d9ceecda1 100644--- a/src/services/ai/providers.ts+++ b/src/services/ai/providers.ts@@ -3,6 +3,7 @@ import { createGroq } from "@ai-sdk/groq";import { createAnthropic } from "@ai-sdk/anthropic";import { createGoogleGenerativeAI } from "@ai-sdk/google";import type { LanguageModel } from "ai";+import { getTinfoilLanguageModel } from "./tinfoilClient";// Renderer-side AI SDK factory. Cloud + local only — enterprise providers// (bedrock/azure/vertex) run in the main process via the@@ -10,12 +11,12 @@ import type { LanguageModel } from "ai";// APIs (fs, process, AWS credential chain) that don't work in the browser.// See `src/helpers/enterpriseAiProviders.js` for the main-process counterpart.-export function getAIModel(+export async function getAIModel(provider: string,model: string,apiKey: string,baseURL?: string-): LanguageModel {+): Promise<LanguageModel> {switch (provider) {case "openai":return createOpenAI({ apiKey })(model);@@ -25,6 +26,8 @@ export function getAIModel(return createAnthropic({ apiKey })(model);case "gemini":return createGoogleGenerativeAI({ apiKey })(model);+ case "tinfoil":+ return getTinfoilLanguageModel(apiKey, model);case "custom":return createOpenAI({ apiKey, baseURL })(model);case "local":diff --git a/src/services/ai/tinfoilClient.ts b/src/services/ai/tinfoilClient.tsnew file mode 100644index 000000000..670963a02--- /dev/null+++ b/src/services/ai/tinfoilClient.ts@@ -0,0 +1,77 @@+import type { LanguageModel } from "ai";+import type { TinfoilAI } from "tinfoil";++type TinfoilModule = typeof import("tinfoil");+type TinfoilAISDKProvider = Awaited<ReturnType<TinfoilModule["createTinfoilAI"]>>;++let tinfoilModulePromise: Promise<TinfoilModule> | null = null;++const chatClientCache = new Map<string, Promise<TinfoilAI>>();+const aiSdkProviderCache = new Map<string, Promise<TinfoilAISDKProvider>>();++function loadTinfoil(): Promise<TinfoilModule> {+ if (!tinfoilModulePromise) {+ // Don't cache a failed import — the next call should retry.+ tinfoilModulePromise = import("tinfoil").catch((error) => {+ tinfoilModulePromise = null;+ throw error;+ });+ }+ return tinfoilModulePromise;+}++function normalizeApiKey(apiKey: string): string {+ const key = apiKey?.trim() || "";+ if (!key) {+ throw new Error("Tinfoil API key not configured");+ }+ return key;+}++export async function getTinfoilChatClient(apiKey: string): Promise<TinfoilAI> {+ const key = normalizeApiKey(apiKey);+ const cached = chatClientCache.get(key);+ if (cached) return cached;++ const clientPromise = loadTinfoil()+ .then(({ TinfoilAI }) => {+ return new TinfoilAI({+ apiKey: key,+ dangerouslyAllowBrowser: true,+ });+ })+ .catch((error) => {+ chatClientCache.delete(key);+ throw error;+ });+ chatClientCache.set(key, clientPromise);+ return clientPromise;+}++async function getTinfoilAISDKProvider(apiKey: string): Promise<TinfoilAISDKProvider> {+ const key = normalizeApiKey(apiKey);+ const cached = aiSdkProviderCache.get(key);+ if (cached) return cached;++ const providerPromise = loadTinfoil()+ .then(({ createTinfoilAI }) => createTinfoilAI(key))+ .catch((error) => {+ aiSdkProviderCache.delete(key);+ throw error;+ });+ aiSdkProviderCache.set(key, providerPromise);+ return providerPromise;+}++export async function getTinfoilLanguageModel(+ apiKey: string,+ model: string+): Promise<LanguageModel> {+ const provider = await getTinfoilAISDKProvider(apiKey);+ return provider(model);+}++export function clearTinfoilClientCache(): void {+ chatClientCache.clear();+ aiSdkProviderCache.clear();+}