Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Add Cartesia as a TTS provider
skygunner2bfb07681882
diff --git a/apps/docs/content/docs/features/voice-and-memory.mdx b/apps/docs/content/docs/features/voice-and-memory.mdxindex d6f5bd48cb..1e2604ff9b 100644--- a/apps/docs/content/docs/features/voice-and-memory.mdx+++ b/apps/docs/content/docs/features/voice-and-memory.mdx@@ -6,7 +6,7 @@ icon: AudioLines## Spoken replies-Pick a voice engine in App Settings, choose a voice, and use the speaker control on a response. Auto-speak can read new replies as they arrive. Four engines are available:+Pick a voice engine in App Settings, choose a voice, and use the speaker control on a response. Auto-speak can read new replies as they arrive. Voice engines include:- **ElevenLabs** — cloud voices, needs an API key.- **Fish Audio** — cloud voices from the Fish Audio library, needs its own API key.@@ -23,6 +23,16 @@ The harness rewrites code-heavy Markdown into speech-friendly text before syntheFish Audio and ElevenLabs keys are stored separately, so switching engines does not replace the other provider's credential. The picker combines popular public voices with voices owned by your Fish Audio account. Only use a voice when you have permission to do so.+### Cartesia++1. Create a key in [Cartesia API Keys](https://play.cartesia.ai/keys).+2. In an agent profile's **Voice** settings, choose **Cartesia**, paste the key, and save it.+3. Search for a stock voice or a clone available to your account, then use **Try** to hear it.++Cartesia generates spoken replies, voice notes, and the bot's audio in **Take turns** calls. **Live** calls and microphone recognition use their own settings. Text selected for speech is sent to Cartesia and uses your Cartesia account's credits.++For a self-hosted workspace, `tts.cartesiaModel` in `config.json` overrides the default `sonic-3.6` model. Set `tts.cartesiaLanguage` to a supported language code, such as `nl` for Dutch, to specify the language of the text sent for speech.+### Chatterbox (local)MausBot speaks through any OpenAI-compatible server that runs [Chatterbox](https://github.com/resemble-ai/chatterbox) behind `POST /v1/audio/speech` — for example LocalAI with a Chatterbox model installed, or a small wrapper service around `pip install chatterbox-tts`.diff --git a/electron/credential-patch.mjs b/electron/credential-patch.mjsindex 143399643a..6628f9d032 100644--- a/electron/credential-patch.mjs+++ b/electron/credential-patch.mjs@@ -19,6 +19,7 @@ export const CREDENTIAL_PATCH = {ttsKey: (value) => ({ tts: { key: value } }),fishAudioKey: (value) => ({ tts: { fishKey: value } }),geminiTtsKey: (value) => ({ tts: { geminiKey: value } }),+ cartesiaTtsKey: (value) => ({ tts: { cartesiaKey: value } }),jevApiKey: (value) => ({ decider: { key: value } }),openrouterDeciderKey: (value) => ({ decider: { openrouterKey: value } }),workersAiToken: (value) => ({ decider: { workersAiToken: value } }),diff --git a/electron/diagnostics.mjs b/electron/diagnostics.mjsindex a4dda955a0..f33621cab2 100644--- a/electron/diagnostics.mjs+++ b/electron/diagnostics.mjs@@ -25,6 +25,7 @@ export const CREDENTIAL_ENV_NAMES = ["OMB_TTS_KEY","OMB_FISH_AUDIO_API_KEY","OMB_GEMINI_API_KEY",+ "OMB_CARTESIA_API_KEY","OMB_JEV_API_KEY","OMB_OPENROUTER_DECIDER_KEY","OMB_WORKERS_AI_TOKEN",diff --git a/electron/workspace-credentials.mjs b/electron/workspace-credentials.mjsindex ed0eccec5e..deaf1b9959 100644--- a/electron/workspace-credentials.mjs+++ b/electron/workspace-credentials.mjs@@ -17,6 +17,7 @@ export const WORKSPACE_CREDENTIALS = [{ section: "tts", field: "key", name: "ttsKey", env: "OMB_TTS_KEY" },{ section: "tts", field: "fishKey", name: "fishAudioKey", env: "OMB_FISH_AUDIO_API_KEY" },{ section: "tts", field: "geminiKey", name: "geminiTtsKey", env: "OMB_GEMINI_API_KEY" },+ { section: "tts", field: "cartesiaKey", name: "cartesiaTtsKey", env: "OMB_CARTESIA_API_KEY" },{ section: "decider", field: "key", name: "jevApiKey", env: "OMB_JEV_API_KEY" },{ section: "decider", field: "openrouterKey", name: "openrouterDeciderKey", env: "OMB_OPENROUTER_DECIDER_KEY" },{ section: "decider", field: "workersAiToken", name: "workersAiToken", env: "OMB_WORKERS_AI_TOKEN" },diff --git a/scripts/testing/key-readback.e2e.test.ts b/scripts/testing/key-readback.e2e.test.tsindex c5a1af61c3..2418fdde2a 100644--- a/scripts/testing/key-readback.e2e.test.ts+++ b/scripts/testing/key-readback.e2e.test.ts@@ -106,6 +106,10 @@ beforeAll(async () => {}return reply(200, { text: "hello from deepseek", request_id: "fixture", duration_ms: 1000 });}+ if (url.startsWith("/cartesia/voices")) {+ if (!req.headers.authorization?.startsWith("Bearer fx-cartesiaTts-") || !req.headers["cartesia-version"]) return reply(401, {});+ return reply(200, { data: [], has_more: false });+ }if (url.startsWith("/eleven/voices")) return reply(200, { voices: [] });if (url.startsWith("/fish/model")) return reply(200, { items: [], total: 0 });return reply(404, { error: "not in the stand-in" });@@ -125,7 +129,14 @@ beforeAll(async () => {OMB_ELEVENLABS_API: `${origin}/eleven`, OMB_FISH_AUDIO_API: `${origin}/fish`, OMB_POSTIZ_CLOUD_URL: `${origin}/postiz`,};const log = openSync(fixture.info.logPath, "a", 0o600);- server = spawn(process.execPath, verificationServerArgs(env), { cwd: fileURLToPath(ROOT), env, stdio: ["ignore", log, log] });+ const cartesiaStub = `data:text/javascript,${encodeURIComponent(`+ const realFetch = globalThis.fetch;+ globalThis.fetch = (input, init) => {+ const url = new URL(String(input));+ if (url.origin === "https://api.cartesia.ai") return realFetch(${JSON.stringify(`${origin}/cartesia`)} + url.pathname + url.search, init);+ return realFetch(input, init);+ };`)}`;+ server = spawn(process.execPath, ["--import", cartesiaStub, ...verificationServerArgs(env)], { cwd: fileURLToPath(ROOT), env, stdio: ["ignore", log, log] });closeSync(log);const deadline = Date.now() + 30_000;while (Date.now() < deadline) {@@ -147,7 +158,7 @@ it("saves every kind of credential, reads it back and shows it masked to its lassetLocale("en");expect(saveds.map((entry) => entry.id)).toEqual(["openai", "anthropic", "xai", "openrouter", "mistral", "cerebras", "groq", "greenference", "modelgo", "meta", "deepseek", "opencodeGo", "openaiCompat",- "liveKey", "elevenlabs", "geminiTts", "fishAudio", "box", "composio", "treg", "postiz", "jev", "openrouterHelper", "workersAi", "imageOpenai", "imageCustom",+ "liveKey", "elevenlabs", "geminiTts", "fishAudio", "cartesiaTts", "box", "composio", "treg", "postiz", "jev", "openrouterHelper", "workersAi", "imageOpenai", "imageCustom",]);for (const storage of ["", "?secretStorage=external"]) {for (const entry of saveds) {@@ -175,7 +186,7 @@ it("saves every kind of credential, reads it back and shows it masked to its las}}expect(stubCalls).toEqual(expect.arrayContaining([- "GET /sandboxes", "POST /composio/tool_router/session", "GET /eleven/voices", "GET /fish/model", "POST /jev/v1/systemone", "POST /alpha/decisions", "POST /postiz/mcp",+ "GET /sandboxes", "POST /composio/tool_router/session", "GET /eleven/voices", "GET /fish/model", "GET /cartesia/voices", "POST /jev/v1/systemone", "POST /alpha/decisions", "POST /postiz/mcp",]));}, hostTimeout(180_000));diff --git a/server/bot-box/env.test.ts b/server/bot-box/env.test.tsindex 9b587e404b..5c7a3fa72c 100644--- a/server/bot-box/env.test.ts+++ b/server/bot-box/env.test.ts@@ -14,7 +14,7 @@ const SERVER_ONLY_OMB: ReadonlySet<string> = new Set(["OMB_AZURE_OPENAI_LIVE_ENDPOINT", "OMB_BACKGROUND_TEXT_MAX", "OMB_BENCH", "OMB_BOAT_API", "OMB_CLOUD_FOCUS_WAKE", "OMB_ENGINE_PRESTART", "OMB_BOTS_FULL_SAVE", "OMB_BOTS_SAVE_CHECK", "OMB_BOT_BOX", "OMB_BOT_MEMORY_MAX_MB", "OMB_BOX_CANARY", "OMB_BRAND_FILE","OMB_BROWSER_CGROUP", "OMB_BROWSER_CONNECTION", "OMB_BROWSER_HOLD_IDLE_MS", "OMB_BROWSER_IDLE_HANDOVER_MS", "OMB_BROWSER_LANG", "OMB_BROWSER_LEGACY_SHELL","OMB_BROWSER_MAX_RUNNING", "OMB_BROWSER_MEMORY_MAX", "OMB_BROWSER_SANDBOX", "OMB_BROWSER_SCREEN", "OMB_BROWSER_TIMEZONE", "OMB_BROWSER_TIMING",- "OMB_BUG_REPORT_URL", "OMB_CACHE_CAP_APP", "OMB_CACHE_CAP_TOOLS", "OMB_CACHE_ROOT", "OMB_CACHE_SWEEP", "OMB_CADDY_PATH", "OMB_CHECKPOINT_GIT_MAX", "OMB_CHROME_PATH", "OMB_CLAUDE_AUTOCOMPACT",+ "OMB_BUG_REPORT_URL", "OMB_CACHE_CAP_APP", "OMB_CACHE_CAP_TOOLS", "OMB_CACHE_ROOT", "OMB_CACHE_SWEEP", "OMB_CADDY_PATH", "OMB_CARTESIA_API_KEY", "OMB_CHECKPOINT_GIT_MAX", "OMB_CHROME_PATH", "OMB_CLAUDE_AUTOCOMPACT","OMB_CLAUDE_INHERIT_USER_CONFIG", "OMB_CLAUDE_SESSION_IDLE_", "OMB_CLI_OWNER_STDIN", "OMB_CLI_PREFIX", "OMB_CLINE_PROVIDER","OMB_CLOUDFLARED_PATH", "OMB_CLOUD_", "OMB_CLOUD_ADMIN_URL", "OMB_CLOUD_AI_TOKEN", "OMB_CLOUD_AI_URL","OMB_CLOUD_BOAT_TOKEN", "OMB_CLOUD_BOAT_URL", "OMB_CLOUD_BROWSER", "OMB_CLOUD_BOOTSTRAP_SECRET", "OMB_CLOUD_CAPS_DROPPED",diff --git a/server/config.test.ts b/server/config.test.tsindex 32aee1cb98..50ec2a95ad 100644--- a/server/config.test.ts+++ b/server/config.test.ts@@ -138,6 +138,12 @@ describe("configuration boundaries", () => {expect(() => parseConfigPatch({ tts: { provider: "unknown" } })).toThrow("provider");});+ it("keeps Cartesia speech settings and trims its own API key", () => {+ const tts = { provider: "cartesia", cartesiaKey: "fixture-cartesia-key", cartesiaModel: "sonic-3.5", cartesiaLanguage: "nl", voice: "voice-dutch" };+ expect(parseStoredConfig({ tts }).tts).toEqual(tts);+ expect(parseConfigPatch({ tts: { ...tts, cartesiaKey: ` ${tts.cartesiaKey} ` } }).tts).toEqual(tts);+ });+it("stores OpenAI readout without changing live-call settings or enabling readout", () => {const patch = { tts: { provider: "openai", voice: "marin" }, openai: { key: "fixture-key" } };expect(parseConfigPatch(patch)).toEqual(patch);diff --git a/server/config.ts b/server/config.tsindex 502f1b16fa..6f69529628 100644--- a/server/config.ts+++ b/server/config.ts@@ -30,7 +30,9 @@ import { settledFileCache, settledFileStamp } from "./settled-file.ts";import { isRemoteMcpServer, mcpServerServes, parseStoredMcpServer } from "./mcp-registry.ts"; import { postizKeyHeaders } from "./postiz/connection.ts";import { parseJson, schemaIssue, type JsonObject, type JsonValue } from "./schema.ts";import { deciderConfigSchema, type DeciderConfig } from "./decider/config.ts";-import { fishKeyFromLiveKey, liveConfigSchema, liveConfigWithEnv, liveSettingEnv, type LiveConfig } from "./live-config.ts"; import { hearingConfigShape } from "./tts/hearing-config.ts";+import { fishKeyFromLiveKey, liveConfigSchema, liveConfigWithEnv, liveSettingEnv, type LiveConfig } from "./live-config.ts";+import { ttsConfigSchema, type TtsConfig } from "./tts/config.ts";+export { FISH_TTS_MODELS, type FishTtsModel } from "./tts/config.ts";import { browserEngineConfigSchema, isValidCdpTarget, type BrowserEngineConfig } from "./browser/config.ts";import { roomContextSettings } from "./room-context-settings.ts"; import { usageCapsSchema, type UsageCapsConfig } from "./usage-caps-config.ts";import { localVmConfigSchema } from "./local-vm-settings.ts";@@ -41,10 +43,6 @@ const optionalText = z.string().optional(), secretText = z.string().trim().optioconst LEGACY_BROWSER_PROFILE_ID = /^[A-Za-z0-9_-]{1,40}$/;const BROWSER_PROFILE_ID = /^[a-z0-9_-]{1,40}$/;-/** Fish Audio speech models (`tts.fishModel`); unset means `s2.1-pro`, and `s2.1-pro-free` is Fish's free tier. */-export const FISH_TTS_MODELS = ["s2.1-pro", "s2.1-pro-free"] as const;-export type FishTtsModel = (typeof FISH_TTS_MODELS)[number];-export const DEFAULT_ROOM_TURN_TIMEOUT_MINUTES = 5;export const MIN_ROOM_TURN_TIMEOUT_MINUTES = 1;export const MAX_ROOM_TURN_TIMEOUT_MINUTES = 1_440;@@ -348,22 +346,7 @@ const appConfigSchema = z.object({vpsServers: vpsServersSchema.optional(),/** OpenCode key, plus `providerKeys` for its other providers by the env name OpenCode reads; both write-only and only for its child. */opencodeGo: z.object({ apiKey: secretText, providerKeys: z.record(z.string(), z.string()).optional() }).optional(),- /** `provider`: "elevenlabs" (default, `key`), "fish" (`fishKey`, `fishModel`), "system", "xai" (`xai.key`), "gemini" (`geminiKey`, `model`), "openai" (`openai.key`), "deepseek" (`deepseek.key`; it also hears dictation) or "chatterbox" (local; `baseUrl`, `model`). */- tts: z.object({- key: secretText,- fishKey: secretText,- geminiKey: secretText,- voice: optionalText,- provider: z.enum(["elevenlabs", "fish", "system", "chatterbox", "xai", "gemini", "openai", "deepseek"]).optional(),- baseUrl: z- .string()- .trim()- .max(2048)- .refine((value) => !value || /^https?:\/\//i.test(value), "the Chatterbox server address must start with http:// or https://")- .optional(),- model: optionalText, ...hearingConfigShape,- fishModel: z.enum(FISH_TTS_MODELS).optional(), everyReply: z.boolean().optional(), // a voice note with every reply unless a bot's voiceNoteEveryReply says otherwise- }).optional(),+ tts: ttsConfigSchema.optional(),decider: deciderConfigSchema.optional(),live: liveConfigSchema.optional(),/** Image provider credentials stay separate; choosing a router never reuses a cloud key. */@@ -456,7 +439,7 @@ export interface AppConfig extends HelperConfig {vps?: VpsConfig;vpsServers?: VpsServer[];opencodeGo?: { apiKey?: string; providerKeys?: Record<string, string> };- tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; everyReply?: boolean; hearWith?: "device" | "elevenlabs"; hearLanguage?: string };+ tts?: TtsConfig;decider?: DeciderConfig;imageGen?: ImageGenerationConfig;live?: LiveConfig;@@ -743,6 +726,7 @@ export function loadConfig(): AppConfig {if (presetVoice && !cfg.tts.voice?.trim() && (cfg.tts.provider ?? "elevenlabs") === "elevenlabs") cfg.tts.voice = presetVoice;if (process.env.OMB_FISH_AUDIO_API_KEY !== undefined) cfg.tts.fishKey = process.env.OMB_FISH_AUDIO_API_KEY;if (process.env.OMB_GEMINI_API_KEY !== undefined) cfg.tts.geminiKey = process.env.OMB_GEMINI_API_KEY;+ if (process.env.OMB_CARTESIA_API_KEY !== undefined) cfg.tts.cartesiaKey = process.env.OMB_CARTESIA_API_KEY;cfg.decider = { ...cfg.decider };if (process.env.OMB_JEV_API_KEY !== undefined) cfg.decider.key = process.env.OMB_JEV_API_KEY; if (process.env.OMB_CUSTOM_DECIDER_KEY !== undefined) cfg.decider.customKey = process.env.OMB_CUSTOM_DECIDER_KEY;if (process.env.OMB_OPENROUTER_DECIDER_KEY !== undefined) cfg.decider.openrouterKey = process.env.OMB_OPENROUTER_DECIDER_KEY; if (process.env.OMB_WORKERS_AI_TOKEN !== undefined) cfg.decider.workersAiToken = process.env.OMB_WORKERS_AI_TOKEN;@@ -788,6 +772,7 @@ export function syncCredentialEnv(patch: Partial<Omit<AppConfig, "threads" | "ne[patch.tts?.key, "OMB_TTS_KEY"],[patch.tts?.fishKey, "OMB_FISH_AUDIO_API_KEY"],[patch.tts?.geminiKey, "OMB_GEMINI_API_KEY"],+ [patch.tts?.cartesiaKey, "OMB_CARTESIA_API_KEY"],[patch.decider?.key, "OMB_JEV_API_KEY"], [patch.decider?.customKey, "OMB_CUSTOM_DECIDER_KEY"],[patch.decider?.openrouterKey, "OMB_OPENROUTER_DECIDER_KEY"], [patch.decider?.workersAiToken, "OMB_WORKERS_AI_TOKEN"],[patch.imageGen?.key, "OMB_OPENAI_IMAGE_KEY"],diff --git a/server/credential-env.ts b/server/credential-env.tsindex 5c40374f8b..9cfeb83996 100644--- a/server/credential-env.ts+++ b/server/credential-env.ts@@ -24,6 +24,7 @@ export const WORKSPACE_CREDENTIAL_ENV = ["OMB_TTS_KEY","OMB_FISH_AUDIO_API_KEY","OMB_GEMINI_API_KEY",+ "OMB_CARTESIA_API_KEY","OMB_JEV_API_KEY","OMB_OPENROUTER_DECIDER_KEY","OMB_WORKERS_AI_TOKEN",diff --git a/server/key-hint.ts b/server/key-hint.tsindex c2a53ff092..51c5e6965c 100644--- a/server/key-hint.ts+++ b/server/key-hint.ts@@ -19,6 +19,7 @@ export function nestedKeyStatus(cfg: AppConfig) {ttsKey: keyStatus(cfg.tts?.key),fishAudioKey: keyStatus(cfg.tts?.fishKey),geminiTtsKey: keyStatus(cfg.tts?.geminiKey),+ cartesiaTtsKey: keyStatus(cfg.tts?.cartesiaKey),jevApiKey: keyStatus(cfg.decider?.key),openrouterDeciderKey: keyStatus(cfg.decider?.openrouterKey),workersAiToken: keyStatus(cfg.decider?.workersAiToken),diff --git a/server/routes/config.ts b/server/routes/config.tsindex ad7287406c..e128c5e84b 100644--- a/server/routes/config.ts+++ b/server/routes/config.ts@@ -508,6 +508,10 @@ export function createConfigRoutes(deps: ConfigRouteDeps): RouteHandler {const check = await tts.verifyKey("gemini", newTts.geminiKey);if (!check.ok) return json(res, 400, { error: check.message });}+ if (newTts?.cartesiaKey) {+ const check = await tts.verifyKey("cartesia", newTts.cartesiaKey);+ if (!check.ok) return json(res, 400, { error: check.message });+ }const deciderKey = patch.decider ? deciderPatchKey(patch.decider, cfg.decider) : null;if (deciderKey) {const check = await decider.testKey(deciderKey.check);@@ -602,6 +606,7 @@ export function createConfigRoutes(deps: ConfigRouteDeps): RouteHandler {if (persisted.tts?.key !== undefined) persisted.tts.key = "";if (persisted.tts?.fishKey !== undefined) persisted.tts.fishKey = "";if (persisted.tts?.geminiKey !== undefined) persisted.tts.geminiKey = "";+ if (persisted.tts?.cartesiaKey !== undefined) persisted.tts.cartesiaKey = "";if (persisted.decider?.key !== undefined) persisted.decider.key = "";if (persisted.decider?.openrouterKey !== undefined) persisted.decider.openrouterKey = "";if (persisted.decider?.workersAiToken !== undefined) persisted.decider.workersAiToken = "";diff --git a/server/tts/cancellation.test.ts b/server/tts/cancellation.test.tsindex a772214009..1e036b27a4 100644--- a/server/tts/cancellation.test.ts+++ b/server/tts/cancellation.test.ts@@ -34,6 +34,11 @@ beforeAll(async () => {vi.stubEnv("OMB_FISH_AUDIO_API", providerUrl);vi.stubEnv("OMB_XAI_TTS_API", `${providerUrl}/v1`);vi.stubEnv("OMB_GEMINI_TTS_API", providerUrl);+ const realFetch = globalThis.fetch;+ vi.stubGlobal("fetch", (input: string, init?: RequestInit) => {+ const url = new URL(input);+ return realFetch(url.origin === "https://api.cartesia.ai" ? providerUrl + url.pathname : input, init);+ });const { createTtsRoutes } = await import("../routes/tts.ts");const route = createTtsRoutes({ config: () => config });api = createServer(async (req, res) => {@@ -54,6 +59,7 @@ afterEach(() => {afterAll(async () => {await Promise.all([api, provider].map((server) => new Promise<void>((resolve) => server.close(() => resolve()))));vi.unstubAllEnvs();+ vi.unstubAllGlobals();});describe("stopping read aloud", () => {diff --git a/server/tts/cartesia.test.ts b/server/tts/cartesia.test.tsnew file mode 100644index 0000000000..2e8e71815a--- /dev/null+++ b/server/tts/cartesia.test.ts@@ -0,0 +1,76 @@+import { afterEach, describe, expect, it, vi } from "vitest";+import type { AppConfig } from "../config.ts";+import { nestedKeyStatus } from "../key-hint.ts";+import { describeVoice, listVoices, speak, verifyKey, voiceReady } from "./index.ts";++const key = "fixture-cartesia-key";+const config: AppConfig = { tts: { provider: "cartesia", cartesiaKey: key, fishKey: "fish-only", voice: "workspace-voice" } };+const mp3 = new Uint8Array([0x49, 0x44, 0x33]);+afterEach(() => vi.unstubAllGlobals());++describe("Cartesia speech", () => {+ it("sends the bot's voice, model and language to the bytes endpoint and returns MP3", async () => {+ const fetcher = vi.fn(async (_url: string, _init: RequestInit) => new Response(mp3, { headers: { "content-type": "audio/mpeg" } }));+ vi.stubGlobal("fetch", fetcher);+ expect(describeVoice(config)).toMatchObject({ configured: true, ready: true, provider: "cartesia", voice: "workspace-voice" });+ expect(JSON.stringify([describeVoice(config), nestedKeyStatus(config).cartesiaTtsKey])).not.toContain(key);+ expect(nestedKeyStatus(config).cartesiaTtsKey).toEqual({ configured: true, last4: key.slice(-4) });+ const alternate: AppConfig = { tts: { ...config.tts, cartesiaModel: "sonic-3.5", cartesiaLanguage: "nl" } };+ const audio = await speak(alternate, "Hallo allemaal", "bot-voice");+ expect(audio.mime).toBe("audio/mpeg");+ expect(Array.from(audio.bytes)).toEqual(Array.from(mp3));+ const [url, init] = fetcher.mock.calls[0]!;+ expect(url).toBe("https://api.cartesia.ai/tts/bytes");+ expect(init).toMatchObject({ method: "POST", redirect: "error" });+ expect(new Headers(init.headers).get("authorization")).toBe(`Bearer ${key}`);+ expect(new Headers(init.headers).get("cartesia-version")).toBe("2026-08-14");+ expect(JSON.parse(String(init.body))).toEqual({+ model_id: "sonic-3.5", transcript: "Hallo allemaal", voice: "bot-voice", language: "nl",+ output_format: { container: "mp3", sample_rate: 44_100, bit_rate: 64_000 },+ });+ await speak(config, "Hello");+ expect(JSON.parse(String(fetcher.mock.calls[1]![1].body))).toMatchObject({ model_id: "sonic-3.6", voice: "workspace-voice" });+ expect(voiceReady({ tts: { provider: "cartesia", fishKey: "fish-only" } }, "bot-voice")).toBe(false);+ });++ it("finds owned clones past the first page and supports the voice picker's search", async () => {+ const fetcher = vi.fn(async (url: string, _init: RequestInit) => {+ const { searchParams } = new URL(url);+ const data = searchParams.has("starting_after") || searchParams.has("q") ? [{ id: "clone", name: "Dutch clone" }]+ : searchParams.has("is_owner") ? [{ id: "owned", name: "My voice" }] : [{ id: "stock", name: "Stock voice" }];+ const more = searchParams.has("is_owner") && !searchParams.has("starting_after");+ return Response.json({ data, has_more: more, next_page: more ? "owned" : null });+ });+ vi.stubGlobal("fetch", fetcher);+ expect(await listVoices(config)).toEqual([+ { id: "stock", label: "Stock voice" }, { id: "owned", label: "My voice" }, { id: "clone", label: "Dutch clone" },+ ]);+ expect(await listVoices(config, undefined, { query: "Dutch clone" })).toEqual([{ id: "clone", label: "Dutch clone" }]);+ expect(fetcher.mock.calls.every(([url, options]) => new URL(url).origin === "https://api.cartesia.ai" && new Headers(options.headers).get("authorization") === `Bearer ${key}`)).toBe(true);+ });++ it("checks the key against an owned catalog and keeps remote error details private", async () => {+ const fetcher = vi.fn(async (_url: string) => new Response(`Do not echo ${key}`, { status: 401 }));+ vi.stubGlobal("fetch", fetcher);+ const checked = await verifyKey("cartesia", key);+ expect(fetcher.mock.calls[0]![0]).toBe("https://api.cartesia.ai/voices?limit=1&is_owner=true");+ expect(checked).toEqual({ ok: false, message: expect.stringContaining("Cartesia rejected the API key") });+ expect(JSON.stringify(checked)).not.toContain(key);+ await expect(speak(config, "private transcript")).rejects.toThrow("Cartesia rejected the API key");+ fetcher.mockResolvedValueOnce(Response.json({ data: [], has_more: false }));+ expect(await verifyKey("cartesia", key)).toEqual({ ok: true });+ });++ it("rejects non-audio success responses and cancels synthesis when playback stops", async () => {+ const fetcher = vi.fn(async (_url: string, _init: RequestInit) => Response.json({ error: "not audio" }));+ vi.stubGlobal("fetch", fetcher);+ await expect(speak(config, "Hello")).rejects.toThrow("unexpected audio format");+ const controller = new AbortController();+ fetcher.mockImplementationOnce(async (_url, init) => new Promise((_, reject) => {+ init.signal!.addEventListener("abort", () => reject(init.signal!.reason), { once: true });+ }));+ const speaking = speak(config, "Hello", undefined, undefined, controller.signal);+ controller.abort();+ await expect(speaking).rejects.toThrow("Cartesia speech was cancelled");+ });+});diff --git a/server/tts/cartesia.ts b/server/tts/cartesia.tsnew file mode 100644index 0000000000..4d9ddf436d--- /dev/null+++ b/server/tts/cartesia.ts@@ -0,0 +1,125 @@+import { z } from "zod";+import type { Audio, VerifyResult, Voice } from "./elevenlabs.ts";++const API = "https://api.cartesia.ai";+const VERSION = "2026-08-14";+export const DEFAULT_CARTESIA_MODEL = "sonic-3.6";+const voicesPage = z.object({+ data: z.array(z.object({ id: z.string().min(1), name: z.string().min(1), description: z.string().optional() })),+ has_more: z.boolean(),+ next_page: z.string().nullish(),+});++async function request(path: string, key: string, init: RequestInit, timeoutMs: number, signal?: AbortSignal): Promise<Response> {+ const timeout = AbortSignal.timeout(timeoutMs);+ const headers = new Headers(init.headers);+ headers.set("authorization", `Bearer ${key}`);+ headers.set("cartesia-version", VERSION);+ let response: Response;+ try {+ response = await fetch(`${API}${path}`, { ...init, headers, redirect: "error", signal: signal ? AbortSignal.any([signal, timeout]) : timeout });+ } catch {+ if (signal?.aborted) throw new Error("Cartesia speech was cancelled.");+ if (timeout.aborted) throw new Error("Cartesia did not answer in time. Try again.");+ throw new Error("Could not reach Cartesia. Check your connection.");+ }+ if (response.ok) return response;+ await response.body?.cancel().catch(() => {});+ // Remote errors can echo a credential or private transcript.+ const { status } = response;+ if (status === 401 || status === 403) throw new Error("Cartesia rejected the API key or its permissions. Check the key in Settings.");+ if (status === 402) throw new Error("The Cartesia account needs credits to generate speech.");+ if (status === 429) throw new Error("Cartesia is rate-limiting requests. Wait a moment and try again.");+ throw new Error(`Cartesia request failed (HTTP ${status}). Check your voice and model settings.`);+}++async function readResponse(response: Response, limit: number): Promise<Buffer> {+ const chunks: Uint8Array[] = [];+ const reader = response.body?.getReader();+ if (!reader) return Buffer.alloc(0);+ let size = 0;+ try {+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ size += value.byteLength;+ if (size > limit) {+ await reader.cancel().catch(() => {});+ throw new Error("Cartesia returned too much data.");+ }+ chunks.push(value);+ }+ } finally {+ reader.releaseLock();+ }+ return Buffer.concat(chunks, size);+}++export async function verifyKey(key: string): Promise<VerifyResult> {+ try {+ const response = await request("/voices?limit=1&is_owner=true", key, {}, 20_000);+ await response.body?.cancel().catch(() => {});+ return { ok: true };+ } catch (error) {+ return { ok: false, message: error instanceof Error ? error.message : "Could not check the Cartesia API key." };+ }+}++async function listPage(key: string, params: URLSearchParams) {+ const response = await request(`/voices?${params}`, key, {}, 20_000);+ const text = await readResponse(response, 2 * 1024 * 1024);+ let body: unknown;+ try { body = JSON.parse(text.toString("utf-8")); } catch { body = null; }+ const parsed = voicesPage.safeParse(body);+ if (!parsed.success) throw new Error("Cartesia returned an invalid voice list. Try again later.");+ return parsed.data;+}++export async function listVoices(key: string, { query, current }: { query?: string; current?: string } = {}): Promise<Voice[]> {+ const params = new URLSearchParams({ limit: "100" });+ if (query?.trim()) params.set("q", query.trim());+ const first = await listPage(key, params);+ const voices = new Map(first.data.map((voice) => [voice.id, voice]));+ if (!query?.trim()) {+ // The first page can fill with public voices before the account's private clones.+ params.set("is_owner", "true");+ const cursors = new Set<string>();+ for (;;) {+ const owned = await listPage(key, params);+ for (const voice of owned.data) voices.set(voice.id, voice);+ if (!owned.has_more) break;+ const cursor = owned.next_page ?? owned.data.at(-1)?.id;+ if (!cursor || cursors.has(cursor) || cursors.size >= 25) throw new Error("Cartesia did not finish listing owned voices. Search by name or ID.");+ cursors.add(cursor);+ params.set("starting_after", cursor);+ }+ if (current && !voices.has(current)) {+ const selected = await listPage(key, new URLSearchParams({ q: current, limit: "10" })).catch(() => null);+ const match = selected?.data.find((voice) => voice.id === current);+ if (match) voices.set(match.id, match);+ }+ }+ return [...voices.values()].map(({ id, name, description }) => ({ id, label: name, description }));+}++export async function synthesize(text: string, voiceId: string, key: string, model?: string, language?: string, signal?: AbortSignal): Promise<Audio> {+ const response = await request("/tts/bytes", key, {+ method: "POST",+ headers: { "content-type": "application/json", accept: "audio/mpeg" },+ body: JSON.stringify({+ model_id: model || DEFAULT_CARTESIA_MODEL,+ transcript: text,+ voice: voiceId,+ ...(language ? { language } : {}),+ output_format: { container: "mp3", sample_rate: 44_100, bit_rate: 64_000 },+ }),+ }, 60_000, signal);+ const mime = response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase();+ if (mime !== "audio/mpeg" && mime !== "audio/mp3") {+ await response.body?.cancel().catch(() => {});+ throw new Error("Cartesia returned an unexpected audio format. Try again later.");+ }+ const bytes = await readResponse(response, 32 * 1024 * 1024);+ if (!bytes.length) throw new Error("Cartesia returned empty audio. Try again.");+ return { bytes, mime: "audio/mpeg" };+}diff --git a/server/tts/config.ts b/server/tts/config.tsnew file mode 100644index 0000000000..fb2c7c54a1--- /dev/null+++ b/server/tts/config.ts@@ -0,0 +1,28 @@+import { z } from "zod";+import { hearingConfigShape } from "./hearing-config.ts";++export const FISH_TTS_MODELS = ["s2.1-pro", "s2.1-pro-free"] as const;+export type FishTtsModel = (typeof FISH_TTS_MODELS)[number];++export const voiceProviders = ["elevenlabs", "fish", "system", "chatterbox", "xai", "gemini", "openai", "deepseek", "cartesia"] as const;+export type VoiceProvider = (typeof voiceProviders)[number];+const key = z.string().trim().optional();++export const ttsConfigSchema = z.object({+ key,+ fishKey: key,+ geminiKey: key,+ cartesiaKey: key,+ cartesiaModel: z.string().trim().max(100).optional(),+ cartesiaLanguage: z.string().trim().regex(/^(?:[a-z]{2,3}(?:-[A-Z]{2})?)?$/, "Use a Cartesia language code such as nl or en-GB").optional(),+ voice: z.string().optional(),+ provider: z.enum(voiceProviders).optional(),+ baseUrl: z.string().trim().max(2048)+ .refine((value) => !value || /^https?:\/\//i.test(value), "the Chatterbox server address must start with http:// or https://").optional(),+ model: z.string().optional(),+ ...hearingConfigShape,+ fishModel: z.enum(FISH_TTS_MODELS).optional(),+ everyReply: z.boolean().optional(),+});++export type TtsConfig = z.output<typeof ttsConfigSchema>;diff --git a/server/tts/index.ts b/server/tts/index.tsindex 8f96001ff1..a4903a793a 100644--- a/server/tts/index.ts+++ b/server/tts/index.ts@@ -9,7 +9,9 @@ import * as gemini from "./gemini.ts";import * as deepseek from "./deepseek.ts";import * as systemVoices from "./system-voices.ts";-export type VoiceProvider = "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek";+import * as cartesia from "./cartesia.ts";+import { voiceProviders, type VoiceProvider } from "./config.ts";+export type { VoiceProvider } from "./config.ts";export class NoVoiceConfigured extends Error {// Not a parameter property: the harness runs under strip-only `node --experimental-strip-types`, which rejects one at load.@@ -37,7 +39,7 @@ const deepseekVoice = (cfg: AppConfig, voiceId?: string) => (deepseek.isDeepSeek*/export function voiceProvider(cfg: AppConfig): VoiceProvider {const provider = cfg.tts?.provider;- return provider === "deepseek" || provider === "gemini" || provider === "openai" || provider === "xai" || provider === "fish" || provider === "system" || provider === "chatterbox" ? provider : "elevenlabs";+ return provider && voiceProviders.includes(provider) ? provider : "elevenlabs";}/**@@ -48,6 +50,7 @@ export function voiceProvider(cfg: AppConfig): VoiceProvider {export function providerConfigured(cfg: AppConfig): boolean {const provider = voiceProvider(cfg);if (provider === "gemini") return Boolean(cfg.tts?.geminiKey);+ if (provider === "cartesia") return Boolean(cfg.tts?.cartesiaKey);if (provider === "openai") return Boolean(cfg.openai?.key);if (provider === "deepseek") return Boolean(cfg.deepseek?.key);if (provider === "xai") return Boolean(cfg.xai?.key);@@ -65,6 +68,7 @@ export function providerConfigured(cfg: AppConfig): boolean {export function voiceConfigured(cfg: AppConfig): boolean {const provider = voiceProvider(cfg);if (provider === "gemini") return Boolean(cfg.tts?.geminiKey && gemini.isSupportedVoice(cfg.tts?.voice));+ if (provider === "cartesia") return Boolean(cfg.tts?.cartesiaKey && cfg.tts?.voice);if (provider === "openai") return Boolean(cfg.openai?.key && cfg.tts?.voice);if (provider === "deepseek") return Boolean(cfg.deepseek?.key && deepseek.isDeepSeekVoice(cfg.tts?.voice));if (provider === "xai") return Boolean(cfg.xai?.key && cfg.tts?.voice);@@ -85,6 +89,7 @@ export function voiceConfigured(cfg: AppConfig): boolean {export function voiceReady(cfg: AppConfig, voiceId?: string): boolean {const provider = voiceProvider(cfg);if (provider === "gemini") return Boolean(cfg.tts?.geminiKey && gemini.isSupportedVoice(voiceId || cfg.tts?.voice));+ if (provider === "cartesia") return Boolean(cfg.tts?.cartesiaKey && (voiceId || cfg.tts?.voice));if (provider === "openai") return Boolean(cfg.openai?.key && (voiceId || cfg.tts?.voice));if (provider === "deepseek") return Boolean(cfg.deepseek?.key && deepseek.isDeepSeekVoice(deepseekVoice(cfg, voiceId)));if (provider === "xai") return Boolean(cfg.xai?.key && (voiceId || cfg.tts?.voice));@@ -121,11 +126,12 @@ export function describeVoice(cfg: AppConfig) {/*** Verifies an API key with the corresponding speech provider before saving.- * @param provider The TTS provider name ("elevenlabs" | "fish" | "gemini").+ * @param provider A speech provider with its own API key.* @param key The API key to test.* @returns Result indicating whether the key is valid.*/-export function verifyKey(provider: "elevenlabs" | "fish" | "gemini", key: string) {+export function verifyKey(provider: "elevenlabs" | "fish" | "gemini" | "cartesia", key: string) {+ if (provider === "cartesia") return cartesia.verifyKey(key);if (provider === "fish") return fish.verifyKey(key);if (provider === "gemini") return gemini.verifyKey(key);return elevenlabs.verifyKey(key);@@ -144,6 +150,7 @@ export async function listVoices(search?: fish.VoiceSearch,): Promise<elevenlabs.Voice[]> {const provider = voiceProvider(cfg);+ if (provider === "cartesia") return cfg.tts?.cartesiaKey ? cartesia.listVoices(cfg.tts.cartesiaKey, search) : [];if (provider === "gemini") return cfg.tts?.geminiKey ? gemini.listVoices() : [];if (provider === "openai") return cfg.openai?.key ? openai.listVoices() : [];if (provider === "deepseek") return cfg.deepseek?.key ? deepseek.listVoices() : [];@@ -187,6 +194,13 @@ export async function addSharedVoice(cfg: AppConfig, publicOwnerId: string, voic*/export function speak(cfg: AppConfig, text: string, voiceId?: string, run?: systemVoices.Runner, signal?: AbortSignal) {const provider = voiceProvider(cfg);+ if (provider === "cartesia") {+ const key = cfg.tts?.cartesiaKey;+ if (!key) throw new NoVoiceConfigured("key", "Add a Cartesia API key in Voice settings.");+ const voice = voiceId || cfg.tts?.voice;+ if (!voice) throw new NoVoiceConfigured("voice");+ return cartesia.synthesize(text, voice, key, cfg.tts?.cartesiaModel, cfg.tts?.cartesiaLanguage, signal);+ }if (provider === "gemini") {const key = cfg.tts?.geminiKey;if (!key) throw new NoVoiceConfigured("key", "Add a Gemini API key in Settings to use Gemini voice.");diff --git a/src/components/VoiceSettings.test.ts b/src/components/VoiceSettings.test.tsindex a4807f41ae..080e9c0f97 100644--- a/src/components/VoiceSettings.test.ts+++ b/src/components/VoiceSettings.test.ts@@ -83,18 +83,43 @@ describe("VoiceSettings", () => {expect(onPatch).not.toHaveBeenCalled();});- it("lays the eight voice services out four to a row, OpenAI beside the other online services", async () => {+ it("offers Cartesia beside the other voice providers", async () => {fixture.api.mockResolvedValue({ voices: [] });await render(bot("pepper"), vi.fn());const radios = [...host.querySelectorAll<HTMLElement>('[role="radiogroup"] [role="radio"]')];- expect(radios.map((radio) => radio.textContent)).toEqual(["ElevenLabs", "Fish Audio", "OpenAI", "Grok (xAI)", "Gemini", "Built-in Mac voices", "Chatterbox (local)", "DeepSeek"]);+ expect(radios.map((radio) => radio.textContent)).toEqual(["ElevenLabs", "Fish Audio", "OpenAI", "Grok (xAI)", "Gemini", "Built-in Mac voices", "Chatterbox (local)", "DeepSeek", "Cartesia"]);expect(radios.map((radio) => radio.className.match(/col-span-\d/)?.[0])).toEqual([- "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1",+ "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1", "col-span-1",]);});});+describe("Cartesia voice settings", () => {+ it("saves Cartesia's key in its own field and picks an owned voice", async () => {+ fixture.config = { tts: { provider: "cartesia", configured: false, voice: "" } };+ fixture.api.mockResolvedValue({ tts: { provider: "cartesia", configured: true } });+ const onPatch = vi.fn();+ await render(bot("pepper"), onPatch);+ const input = host.querySelector<HTMLInputElement>('input[aria-label="Cartesia key"]')!;+ await act(async () => {+ Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!.call(input, "fixture-cartesia-key");+ input.dispatchEvent(new Event("input", { bubbles: true }));+ });+ await act(async () => host.querySelector<HTMLButtonElement>('input[aria-label="Cartesia key"] + button')!.click());+ expect(fixture.api).toHaveBeenCalledWith("/api/config", { method: "PUT", body: JSON.stringify({ tts: { cartesiaKey: "fixture-cartesia-key" } }) });+ expect(input.value).toBe("");+ fixture.config = { tts: { provider: "cartesia", configured: true, voice: "" } };+ fixture.api.mockResolvedValue({ voices: [{ id: "cartesia-voice", label: "My Cartesia clone" }] });+ await render(bot("pepper"), onPatch);+ await act(async () => trigger().click());+ const clone = [...document.body.querySelectorAll<HTMLElement>('[role="option"]')].find((option) => option.textContent?.includes("My Cartesia clone"))!;+ await act(async () => clone.click());+ expect(onPatch).toHaveBeenCalledExactlyOnceWith({ voice: "cartesia-voice" });+ expect(fixture.api).not.toHaveBeenCalledWith("/api/tts/voices/add", expect.anything());+ });+});+describe("OpenAI voice settings", () => {const openaiRadio = () => [...host.querySelectorAll<HTMLButtonElement>('[role="radio"]')].find((radio) => radio.textContent === "OpenAI")!;it("selects marin only after the person chooses OpenAI, without enabling readout", async () => {diff --git a/src/components/VoiceSettings.tsx b/src/components/VoiceSettings.tsxindex f3560766d9..ea73355b07 100644--- a/src/components/VoiceSettings.tsx+++ b/src/components/VoiceSettings.tsx@@ -68,10 +68,13 @@ export function VoiceSettings({const [deviceVoice, setDeviceVoice] = useState(() => remoteSystemVoice(bot.id));const usesLocalSystem = localMacClient && deviceProvider === "system";const provider = tts?.provider ?? "elevenlabs";- const searchable = (provider === "fish" || provider === "elevenlabs" || provider === "gemini") && !usesLocalSystem;+ const searchable = (provider === "fish" || provider === "elevenlabs" || provider === "gemini" || provider === "cartesia") && !usesLocalSystem;const voiceSearch = searchable && provider !== "gemini" ? searchedQuery : "";const pickedVoice = searchable && provider !== "gemini" ? (bot.voice ?? "") : "";- const cloudProvider = provider === "gemini"+ const cloudProvider = provider === "cartesia"+ ? { id: "cartesia" as const, name: "Cartesia", credential: "cartesiaTtsKey" as const, configField: "cartesiaKey" as const,+ placeholder: t("voice.cartesia.keyPlaceholder"), keyUrl: "https://play.cartesia.ai/keys" }+ : provider === "gemini"? { id: "gemini" as const, name: "Gemini", credential: "geminiTtsKey" as const, configField: "geminiKey" as const,placeholder: t("voice.gemini.keyPlaceholder"), keyUrl: "https://aistudio.google.com/api-keys" }: provider === "fish"@@ -94,7 +97,7 @@ export function VoiceSettings({}: null;const key = cloudProvider ? voiceKeyDraftValue(keyDraft, cloudProvider.id) : "";- const hostProviderLabel = provider === "gemini" ? t("voice.hostLabel", { provider: "Gemini" }) : provider === "fish"+ const hostProviderLabel = provider === "cartesia" || provider === "gemini" ? t("voice.hostLabel", { provider: provider === "cartesia" ? "Cartesia" : "Gemini" }) : provider === "fish"? t("voice.hostLabel", { provider: t("voice.fish.label") }): provider === "elevenlabs"? t("voice.hostLabel", { provider: t("voice.elevenlabs.label") })@@ -155,7 +158,7 @@ export function VoiceSettings({setLoadingVoices(true);const params = new URLSearchParams();if (voiceSearch) params.set("q", voiceSearch);- if (provider === "fish" && pickedVoice) params.set("current", pickedVoice);+ if ((provider === "fish" || provider === "cartesia") && pickedVoice) params.set("current", pickedVoice);const query = params.toString();api(`/api/tts/voices${query ? `?${query}` : ""}`).then((r: { voices?: typeof voices; error?: string }) => {@@ -344,6 +347,7 @@ export function VoiceSettings({{ value: "system", label: t("voice.macBuiltIn"), available: systemVoicesAvailable, span: "col-span-1" },{ value: "chatterbox", label: t("voice.chatterboxLocal"), available: true, span: "col-span-1" },{ value: "deepseek", label: "DeepSeek", available: true, span: "col-span-1" },+ { value: "cartesia", label: "Cartesia", available: true, span: "col-span-1" },] as const).map((option) => (<buttonkey={option.value}diff --git a/src/components/keys/key-catalog.ts b/src/components/keys/key-catalog.tsindex 3de704b1a4..f8b1b6392c 100644--- a/src/components/keys/key-catalog.ts+++ b/src/components/keys/key-catalog.ts@@ -48,7 +48,7 @@ export interface KeyTarget {export type KeyId =| "openai" | "anthropic" | "xai" | "openrouter" | "mistral" | "cerebras" | "groq" | "greenference" | "modelgo" | "meta" | "deepseek" | "opencodeGo" | "opencodeProviders"- | "ollama" | "lmStudio" | "openaiCompat" | "liveCalls" | "liveKey" | "elevenlabs" | "fishAudio" | "geminiTts" | "chatterbox" | "box" | "vps" | "onePassword" | "composio" | "treg" | "postiz"+ | "ollama" | "lmStudio" | "openaiCompat" | "liveCalls" | "liveKey" | "elevenlabs" | "fishAudio" | "geminiTts" | "cartesiaTts" | "chatterbox" | "box" | "vps" | "onePassword" | "composio" | "treg" | "postiz"| "jev" | "openrouterHelper" | "workersAi" | "customDecider" | "imageOpenai" | "imageGemini" | "imageCustom";export type KeyMark = { driverKind: string; preset?: ProviderIconPreset } | { icon: LucideIcon };@@ -158,6 +158,11 @@ export const KEY_CATALOG: readonly KeyEntry[] = [target: { patch: (value) => ({ tts: { fishKey: value } }), slot: "fishAudioKey", verifiedOnSave: true,saved: (config) => flag(config.savedKeys?.fishAudioKey ?? { configured: config.tts?.provider === "fish" && config.tts.configured }),placeholder: "…", placeholderKey: "voice.fish.keyPlaceholder", href: "https://fish.audio/app/api-keys/", analytics: "fish_audio" } },+ { id: "cartesiaTts", section: "voice", labelKey: "keys.label.cartesiaTts", purposeKey: "keys.purpose.cartesiaTts", name: "Cartesia", env: ["OMB_CARTESIA_API_KEY"],+ words: ["cartesia", "sonic", "voice", "voices", "speech", "tts"], mark: { icon: AudioLines }, kind: "key",+ target: { patch: (value) => ({ tts: { cartesiaKey: value } }), slot: "cartesiaTtsKey", verifiedOnSave: true,+ saved: (config) => flag(config.savedKeys?.cartesiaTtsKey), placeholder: "…", placeholderKey: "voice.cartesia.keyPlaceholder",+ href: "https://play.cartesia.ai/keys", analytics: "cartesia_tts" } },{ id: "chatterbox", section: "voice", labelKey: "voice.chatterboxServer", purposeKey: "voice.chatterboxHelp", name: "Chatterbox", env: [],words: ["chatterbox", "voice", "tts", "speech", "base url", "server", "address", "local"], mark: { icon: AudioLines }, kind: "panel",status: (config) => ({ configured: Boolean(config.tts?.baseUrl?.trim()) }) },diff --git a/src/lib/analytics-allowlist.test.ts b/src/lib/analytics-allowlist.test.tsindex 8cdae304f4..bd39ec3525 100644--- a/src/lib/analytics-allowlist.test.ts+++ b/src/lib/analytics-allowlist.test.ts@@ -77,7 +77,7 @@ describe("app, role and key lists", () => {expect(rows).toEqual({openai: "openai", anthropic: "anthropic", xai: "xai", openrouter: "openrouter", mistral: "mistral", cerebras: "cerebras", groq: "groq",greenference: "greenference", modelgo: "modelgo", meta: "meta", deepseek: "deepseek", opencodeGo: "opencode_go", openaiCompat: "openai_compat", liveKey: "openai_live",- elevenlabs: "elevenlabs", fishAudio: "fish_audio", geminiTts: "gemini_tts", box: "boat", composio: "composio", treg: "treg", jev: "jev",+ elevenlabs: "elevenlabs", fishAudio: "fish_audio", geminiTts: "gemini_tts", cartesiaTts: "cartesia_tts", box: "boat", composio: "composio", treg: "treg", jev: "jev",openrouterHelper: "openrouter_decider", imageOpenai: "openai_image", postiz: "postiz",});for (const provider of Object.values(rows)) expect(KEY_PROVIDER).toContain(provider);diff --git a/src/lib/analytics-allowlist.ts b/src/lib/analytics-allowlist.tsindex 9ba5b84c7e..6ca9a9cfce 100644--- a/src/lib/analytics-allowlist.ts+++ b/src/lib/analytics-allowlist.ts@@ -14,7 +14,7 @@ export function allow<const T extends string>(value: unknown, list: readonly T[]export const KEY_PROVIDER = ["anthropic", "openai", "openrouter", "openai_compat", "xai", "mistral", "cerebras", "groq", "greenference", "modelgo", "meta", "boat", "composio",- "opencode_go", "custom_endpoint", "elevenlabs", "fish_audio", "gemini_tts", "jev", "openrouter_decider", "openai_image", "custom_image",+ "opencode_go", "custom_endpoint", "elevenlabs", "fish_audio", "gemini_tts", "cartesia_tts", "jev", "openrouter_decider", "openai_image", "custom_image","openai_live", "onepassword", "treg", "deepseek", "postiz",] as const;export type KeyProvider = (typeof KEY_PROVIDER)[number];diff --git a/src/lib/voice-key-draft.ts b/src/lib/voice-key-draft.tsindex 53ad8929bf..c640ea4344 100644--- a/src/lib/voice-key-draft.ts+++ b/src/lib/voice-key-draft.ts@@ -1,4 +1,4 @@-export type CloudVoiceProvider = "elevenlabs" | "fish" | "gemini";+export type CloudVoiceProvider = "elevenlabs" | "fish" | "gemini" | "cartesia";export type VoiceKeyDraft = { provider: CloudVoiceProvider | null; value: string };/** Never expose a credential draft after the selected provider changes. */diff --git a/src/locales/en.json b/src/locales/en.jsonindex cf38252006..3389d9e177 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -949,6 +949,9 @@"voice.grok.host": "Host · Grok","voice.grok.sharedKey": "Grok uses this installation’s existing xAI key.","voice.gemini.keyPlaceholder": "Paste your Google AI Studio API key",+ "voice.cartesia.keyPlaceholder": "Paste your Cartesia API key",+ "keys.label.cartesiaTts": "Cartesia API key",+ "keys.purpose.cartesiaTts": "Cartesia voices for spoken replies, voice notes and Take turns calls","voice.gemini.model": "Gemini speech model","keys.label.geminiTts": "Gemini speech API key","keys.purpose.geminiTts": "Gemini voices for spoken replies, voice notes and calls",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 0dd3959498..ee5fa4af50 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -1,5 +1,8 @@{"voice.gemini.keyPlaceholder": "Cole sua chave de API do Google AI Studio",+ "voice.cartesia.keyPlaceholder": "Cole sua chave de API da Cartesia",+ "keys.label.cartesiaTts": "Chave de API da Cartesia",+ "keys.purpose.cartesiaTts": "Vozes da Cartesia para respostas faladas, notas de voz e chamadas em turnos","voice.gemini.model": "Modelo de voz do Gemini","keys.label.geminiTts": "Chave de API de voz do Gemini","keys.purpose.geminiTts": "Vozes do Gemini para respostas faladas, mensagens de voz e chamadas",diff --git a/src/state/config-status.ts b/src/state/config-status.tsindex d2375d98f5..d6fd59d92d 100644--- a/src/state/config-status.ts+++ b/src/state/config-status.ts@@ -8,7 +8,7 @@ import type { ModelSelection } from "./store";/** A saved credential: whether it is set and, for admins, its last four characters. The key itself never comes back. */export interface SavedKey { configured: boolean; last4?: string }-export type NestedKeyName = "ttsKey" | "fishAudioKey" | "geminiTtsKey" | "jevApiKey" | "openrouterDeciderKey" | "workersAiToken" | "customDeciderKey" | "openaiImageApiKey" | "customImageApiKey" | "openaiLiveKey" | "geminiImageApiKey";+export type NestedKeyName = "ttsKey" | "fishAudioKey" | "geminiTtsKey" | "cartesiaTtsKey" | "jevApiKey" | "openrouterDeciderKey" | "workersAiToken" | "customDeciderKey" | "openaiImageApiKey" | "customImageApiKey" | "openaiLiveKey" | "geminiImageApiKey";export interface ImageSlotStatus { provider: ImageProvider; model: string; configured: boolean }@@ -95,7 +95,7 @@ export interface ConfigStatus {configured: boolean;ready: boolean;voice: string;- provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek";+ provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai" | "deepseek" | "cartesia";baseUrl?: string;model?: string;/** Voice note with every reply, for every bot without its own choice. Absent from older servers. */diff --git a/src/types/ogb.d.ts b/src/types/ogb.d.tsindex 50c9a5721c..7d44ab7ff5 100644--- a/src/types/ogb.d.ts+++ b/src/types/ogb.d.ts@@ -528,7 +528,7 @@ const __APP_VERSION__: string;credentialStore?: { unreadable(): Promise<boolean>; reset(): Promise<"reset" | "cancelled" | "quitting" | "failed" | "readable"> };/** Save a provider credential through Electron's OS-backed store. */setCredential?(- name: "openaiApiKey" | "anthropicApiKey" | "openrouterApiKey" | "mistralApiKey" | "cerebrasApiKey" | "groqApiKey" | "greenferenceApiKey" | "modelgoApiKey" | "metaApiKey" | "deepseekApiKey" | "openaiCompatApiKey" | "composioApiKey" | "xaiApiKey" | "boxToken" | "opencodeGoApiKey" | "ttsKey" | "fishAudioKey" | "geminiTtsKey" | "jevApiKey" | "openrouterDeciderKey" | "workersAiToken" | "customDeciderKey" | "openaiImageApiKey" | "customImageApiKey" | "openaiLiveKey" | "tregApiKey" | "postizApiKey" | "geminiImageApiKey",+ name: "openaiApiKey" | "anthropicApiKey" | "openrouterApiKey" | "mistralApiKey" | "cerebrasApiKey" | "groqApiKey" | "greenferenceApiKey" | "modelgoApiKey" | "metaApiKey" | "deepseekApiKey" | "openaiCompatApiKey" | "composioApiKey" | "xaiApiKey" | "boxToken" | "opencodeGoApiKey" | "ttsKey" | "fishAudioKey" | "geminiTtsKey" | "cartesiaTtsKey" | "jevApiKey" | "openrouterDeciderKey" | "workersAiToken" | "customDeciderKey" | "openaiImageApiKey" | "customImageApiKey" | "openaiLiveKey" | "tregApiKey" | "postizApiKey" | "geminiImageApiKey",value: string,options?: { everyClaudeBot?: false },): Promise<ConfigStatus>;