Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge #4163

milind-sonie8977e8ec026
diff --cc server/config.ts
index 73ee299f70,4de6be0737..805a6993e5
--- a/server/config.ts
+++ b/server/config.ts
@@@ -489,7 -503,7 +489,7 @@@ export interface AppConfig extends Help
/** A named host from the user's SSH config. Authentication stays with SSH. */
vps?: { sshAlias?: string };
opencodeGo?: { apiKey?: string; providerKeys?: Record<string, string> };
- tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; everyReply?: boolean };
- tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai"; baseUrl?: string; model?: string; fishModel?: FishTtsModel };
++ tts?: { key?: string; fishKey?: string; geminiKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai"; baseUrl?: string; model?: string; fishModel?: FishTtsModel; everyReply?: boolean };
decider?: DeciderConfig;
imageGen?: ImageGenerationConfig;
live?: LiveConfig;
diff --cc server/tts/index.ts
index 6d8c8a3286,f259b34a67..f6c66b3c56
--- a/server/tts/index.ts
+++ b/server/tts/index.ts
@@@ -26,21 -27,11 +27,21 @@@ export class NoVoiceConfigured extends
const elevenLabs = (cfg: AppConfig) => voiceCredential(cfg.tts?.key);
+/**
+ * Resolves the active voice synthesis provider from configuration.
+ * @param cfg The application configuration.
+ * @returns The resolved VoiceProvider name.
+ */
export function voiceProvider(cfg: AppConfig): VoiceProvider {
const provider = cfg.tts?.provider;
- return provider === "gemini" || provider === "xai" || provider === "fish" || provider === "system" || provider === "chatterbox" ? provider : "elevenlabs";
+ return provider === "gemini" || provider === "openai" || provider === "xai" || provider === "fish" || provider === "system" || provider === "chatterbox" ? provider : "elevenlabs";
}
+/**
+ * Determines whether the credentials or requirements for the active voice provider are met.
+ * @param cfg The application configuration.
+ * @returns True if provider requirements are configured.
+ */
export function providerConfigured(cfg: AppConfig): boolean {
const provider = voiceProvider(cfg);
if (provider === "gemini") return Boolean(cfg.tts?.geminiKey);
@@@ -162,15 -118,7 +167,15 @@@ export async function addSharedVoice(cf
return elevenlabs.addSharedVoice(credential.token, credential.api, publicOwnerId, voiceId, name);
}
+/**
+ * Synthesizes text to speech using the currently configured provider.
+ * @param cfg The application configuration.
+ * @param text The plain text to synthesize into spoken audio.
+ * @param voiceId Optional override voice ID.
+ * @param run Optional runner for system voices.
+ * @returns Synthesized audio buffer or stream promise.
+ */
- export function speak(cfg: AppConfig, text: string, voiceId?: string, run?: systemVoices.Runner) {
+ export function speak(cfg: AppConfig, text: string, voiceId?: string, run?: systemVoices.Runner, signal?: AbortSignal) {
const provider = voiceProvider(cfg);
if (provider === "gemini") {
const key = cfg.tts?.geminiKey;
diff --cc src/locales/en.json
index 395c658d1a,860d0413c6..3e1a6f44ed
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@@ -7681,50 -7623,20 +7681,66 @@@
"grokMove.unreadable": "Couldn't be read: {names}",
"grokMove.notAdded": "Couldn't be added: {names}",
"grokMove.isHere": "{name} is here",
+ "voice.openai.description": "Read replies and voice messages with AI-generated voices. Uses your OpenAI API key and is billed by OpenAI based on API usage. Live call settings are separate.",
+ "voice.openai.missingKey": "Add an OpenAI API key in Settings → API keys on the host to use readout.",
+ "voice.sample": "Good morning. The tests passed overnight, and I left two notes for you in the chat.",
+ "keys.purpose.openaiVoice": "Read replies aloud and make live calls with your OpenAI API key",
+ "voice.openai.error.key": "Add an OpenAI API key in Settings → API keys to read replies aloud.",
+ "voice.openai.error.auth": "OpenAI rejected the API key or its Realtime access. Check the key and project permissions in Settings.",
+ "voice.openai.error.rateLimit": "OpenAI speech is rate limited or out of API credits. Check your API usage before trying again.",
+ "voice.openai.error.timeout": "OpenAI speech timed out. No audio was played for this segment.",
+ "voice.openai.error.connection": "OpenAI speech was interrupted. Check your connection and proxy settings.",
+ "voice.openai.error.empty": "OpenAI returned no speech audio for this segment.",
+ "voice.openai.error.invalid": "OpenAI returned an unexpected speech response.",
+ "voice.openai.error.limit": "OpenAI speech exceeded the 8 MiB limit for one segment.",
+ "voice.openai.error.cancelled": "OpenAI speech was cancelled.",
+ "voice.openai.error.failed": "OpenAI could not generate speech for this segment. Check your API access and usage.",
+ "voice.openai.error.voice": "Choose an OpenAI voice before reading replies aloud.",
- "keys.purpose.openaiModelsVoice": "OpenAI models, reply readout and live calls"
++ "keys.purpose.openaiModelsVoice": "OpenAI models, reply readout and live calls",
+ "settings.section.imageGeneration": "Image generation",
+ "imageGen.intro": "Bots use this when you ask for an image in a chat, and bot avatars use it too. The backup is tried only when the base could not start: no key, no credit, rate limited or unreachable.",
+ "imageGen.status.ready": "Ready · images are made with {provider}",
+ "imageGen.status.backupOnly": "Ready with the backup only · images are made with {provider}",
+ "imageGen.status.notReady": "Not set up · add a key for the base or the backup provider; Custom also needs a base URL and a model ID",
+ "imageGen.primary.label": "Base provider",
+ "imageGen.primary.help": "Used first for every image.",
+ "imageGen.fallback.label": "Backup provider",
+ "imageGen.fallback.help": "Used only when the base could not start.",
+ "imageGen.fallback.none": "None",
+ "imageGen.slot.needsKey": "Needs a key: add it below.",
+ "imageGen.slot.needsConnection": "Needs a base URL and a model ID: add them below.",
+ "imageGen.model.label": "{slot} model",
+ "imageGen.model.placeholder": "Model ID",
+ "imageGen.model.other": "Other (type a model ID)",
+ "imageGen.model.idLabel": "{slot} model ID",
+ "imageGen.test.ok": "The key is accepted. The model is checked when the first image is made.",
+ "imageGen.test.okOpenrouter": "Works: the key is accepted and OpenRouter has the chosen model.",
+ "imageGen.test.noCredit": "The key is accepted, but this OpenRouter account has no credit, and image models are paid.",
+ "imageGen.test.modelMissing": "OpenRouter has no model {model}. Pick one from the list.",
+ "imageGen.test.rejected": "The provider refused this key. Check it or paste a new one.",
+ "imageGen.test.unreachable": "Could not reach the provider. Check the connection or the URL.",
+ "imageGen.test.unexpected": "The provider gave an unexpected answer.",
+ "imageGen.test.noUrl": "Add the base URL first, so the key is only sent to your endpoint.",
+ "imageGen.maxPerTurn.label": "Images per reply",
+ "imageGen.maxPerTurn.help": "The most images a bot may create in one reply.",
+ "imageGen.key.openai": "OpenAI API key",
+ "imageGen.key.gemini": "Gemini API key",
+ "imageGen.key.custom": "Custom image API key",
+ "imageGen.key.paste": "Paste API key",
+ "imageGen.key.get": "Get a key",
+ "imageGen.key.saved": "Key saved",
+ "imageGen.key.missing": "No key yet",
+ "imageGen.key.optional": "Key optional",
+ "imageGen.key.sharedXai": "This is the same Grok (xAI) key as under API keys, also used by the other Grok features. A Grok subscription does not include API access.",
+ "imageGen.key.sharedOpenrouter": "This is the same OpenRouter key as under API keys, also used by the OpenRouter models your bots run.",
+ "imageGen.key.manage": "Open API keys",
+ "imageGen.custom.url": "Base URL",
+ "imageGen.custom.help": "Any OpenAI-compatible Images API. localhost is the computer running {app}.",
+ "botIdentity.ai.usingProvider": "Uses {provider}, as set in Image generation.",
+ "botIdentity.ai.noProvider": "No image provider is set up yet.",
+ "botIdentity.ai.openImageSettings": "Open image settings",
+ "imageGen.key.xai": "Grok (xAI) API key",
+ "imageGen.key.openrouter": "OpenRouter API key",
+ "server.voice.noNoteNoVoice": "No voice note with this reply: this bot has no voice set up yet.",
+ "server.voice.noNoteFailed": "No voice note with this reply: the voice couldn't be made ({reason})."
}
diff --cc src/state/config-status.ts
index 32d53bfbf3,c734918fbe..4f33e47159
--- a/src/state/config-status.ts
+++ b/src/state/config-status.ts
@@@ -78,11 -75,9 +78,11 @@@ export interface ConfigStatus
configured: boolean;
ready: boolean;
voice: string;
- provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini";
+ provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai" | "gemini" | "openai";
baseUrl?: string;
model?: string;
+ /** Voice note with every reply, for every bot without its own choice. Absent from older servers. */
+ everyReply?: boolean;
/** Fish Audio speech model; present only while Fish is the provider. */
fishModel?: "s2.1-pro" | "s2.1-pro-free";
/** ElevenLabs voice comes with Cloud Pro; no key is saved. */