Skip to content

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

Live calls: support GPT-Live on Azure OpenAI

Prantik Medhidb33c2bb6f2a
diff --git a/apps/docs/content/docs/features/voice-and-memory.mdx b/apps/docs/content/docs/features/voice-and-memory.mdx
index dc66da2ab7..2d845e245f 100644
--- a/apps/docs/content/docs/features/voice-and-memory.mdx
+++ b/apps/docs/content/docs/features/voice-and-memory.mdx
@@ -70,6 +70,8 @@ A Live call hangs up after 5 minutes in which nobody speaks and the bot is not w
Live calls are free for everyone, from the desktop app, a web browser or your phone; no plan is needed. They use your own OpenAI API key, from a project with GPT-Live access: the OpenAI key in **Settings → API keys**, or a separate key for Live calls set from the call's settings, which wins when both are saved. Without a key, the **Live** button says "Live calls use your own OpenAI key. Add it in Settings → API keys." and offers **Open API keys**; a phone shows the same message, since keys are added on your computer. The key stays where you saved it, on This computer or on My Cloud; phones never receive it. OpenAI bills Live audio at about $0.05 per minute; the bot's own work is billed as usual. Live calls work in any desktop build with a microphone (no on-device dictation needed), and are for one bot at a time. Room calls always take turns.
+**Live calls through Azure OpenAI.** If your organisation runs OpenAI models on Azure, a Live call can use a GPT-Live deployment on your own Azure OpenAI or Microsoft Foundry resource instead of OpenAI. Deploy `gpt-live-1` on the resource, then in the call's settings (or the prompt the **Live** button shows when a call is not set up) choose **Azure OpenAI** as the **Service**, paste the resource endpoint (for example `https://my-resource.openai.azure.com`) and the deployment name (empty means `gpt-live-1`), and add a key of that resource. The OpenAI API key is never used for Azure, and the key is only ever sent to an `https` Azure OpenAI host (`*.openai.azure.com`, `*.services.ai.azure.com`, `*.cognitiveservices.azure.com`, Azure Government and Azure China, or an API Management gateway on `*.azure-api.net`). Azure bills the call to that resource. On a server you can set the same thing with `OMB_LIVE_PROVIDER=azure`, `OMB_AZURE_OPENAI_LIVE_ENDPOINT`, `OMB_AZURE_OPENAI_LIVE_DEPLOYMENT` and `OMB_OPENAI_LIVE_KEY` (the resource key). With Azure, everything below that goes to OpenAI goes to your Azure resource instead.
+
**What a Live call sends to OpenAI.** A Live call sends your voice to OpenAI, along with the chat's recent messages, the bot's answers and the details of any approval it asks for. The OpenAI key stays where you saved it: on your computer, or on My Cloud. The desktop says this where you choose Live and where you set it up; a phone says it once, before its first Live call, with **Start call** and **Cancel**. In detail: the chat's last eight text messages when the call starts (so "and the other one?" makes sense), every answer the bot gives on the call's chat (an answer to typed messages only while **Read replies to typed messages** is on, or when it also answers something you said), what a permission card asks (for example the command it wants to run), question options and proposal titles, the name of the app or credential a card waits for, the names of the bot's steps (never their arguments), and the bot's name, title and description.
## Dictation
diff --git a/docs/verification/live-calls.md b/docs/verification/live-calls.md
index bb13819fdd..d11fcdd7cd 100644
--- a/docs/verification/live-calls.md
+++ b/docs/verification/live-calls.md
@@ -53,6 +53,23 @@ start answer 409 `needsKey`; after the OpenAI key is saved through
`PUT /api/config`, a phone's call starts with that key; a separate Live key
then wins; neither key appears in the config or the log.
+
+## Azure OpenAI as the Live provider
+
+With `live.provider: "azure"` (`OMB_LIVE_PROVIDER=azure`) a call creates its
+GPT-Live session on the person's Azure OpenAI / Foundry resource:
+`POST {endpoint}/openai/v1/live/sessions` with the deployment name
+(`live.azureDeployment`, `OMB_AZURE_OPENAI_LIVE_DEPLOYMENT`, default
+`gpt-live-1`) as `session.model`, and the sideband attaches to
+`wss://{endpoint}/openai/v1/live/sessions/{id}/attach`. Both send the resource
+key as `api-key`, never as a bearer token. The key is only `live.key`; the
+OpenAI API key is never used for Azure. `live.azureEndpoint`
+(`OMB_AZURE_OPENAI_LIVE_ENDPOINT`) must be `https` on an Azure OpenAI host
+(`azureOpenAiRoot` in `server/live-call.ts`), and `PATCH /api/live/settings`
+refuses any other. Without the key, or with a missing or invalid endpoint,
+`POST /api/live/session` answers `409` with `needsKey` and the Azure setup
+sentence before anything leaves the harness. A call keeps the endpoint it
+started with even if the settings change mid-call.
## User path
Start a Live call from the call button's menu, say something the bot must act
diff --git a/server/config.ts b/server/config.ts
index fba9df31df..499c4d96c8 100644
--- a/server/config.ts
+++ b/server/config.ts
@@ -397,9 +397,12 @@ const appConfigSchema = z.object({
fishModel: z.enum(FISH_TTS_MODELS).optional(),
}).optional(),
decider: deciderConfigSchema.optional(),
- /** Live calls: `key` is an OpenAI key for Live calls only; without one they use `openai.key`. `voice` is a GPT-Live voice. */
+ /** Live calls: `key` is a key for Live calls only; with `provider` "openai" (the default) a call without one uses `openai.key`, with "azure" it is the Azure resource's key and is required. `azureEndpoint` is the resource URL and `azureDeployment` the gpt-live-1 deployment name. `voice` is a GPT-Live voice. */
live: z.object({
key: optionalText,
+ provider: z.enum(["openai", "azure"]).optional(),
+ azureEndpoint: z.string().trim().max(300).optional(),
+ azureDeployment: z.string().trim().max(64).optional(),
voice: z.string().trim().max(40).regex(/^[a-z]*$/, "a Live voice is a lowercase built-in voice name").optional(),
readTypedReplies: z.boolean().optional(),
idleMinutes: z.number().int().min(1).max(60).optional(),
@@ -511,7 +514,7 @@ export interface AppConfig extends HelperConfig {
tts?: { key?: string; fishKey?: string; voice?: string; provider?: "elevenlabs" | "fish" | "system" | "chatterbox" | "xai"; baseUrl?: string; model?: string; fishModel?: FishTtsModel };
decider?: DeciderConfig;
imageGen?: ImageGenerationConfig;
- live?: { key?: string; voice?: string; readTypedReplies?: boolean; idleMinutes?: number };
+ live?: { key?: string; provider?: "openai" | "azure"; azureEndpoint?: string; azureDeployment?: string; voice?: string; readTypedReplies?: boolean; idleMinutes?: number };
profile?: { name?: string; email?: string; aboutMe?: string; avatarUrl?: string };
rooms?: { turnTimeoutMinutes: number };
mcp?: { callTimeoutMinutes?: number };
@@ -804,6 +807,10 @@ export function loadConfig(): AppConfig {
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;
cfg.live = { ...cfg.live };
if (process.env.OMB_OPENAI_LIVE_KEY !== undefined) cfg.live.key = process.env.OMB_OPENAI_LIVE_KEY;
+ const liveProvider = process.env.OMB_LIVE_PROVIDER?.trim().toLowerCase();
+ if (liveProvider === "openai" || liveProvider === "azure") cfg.live.provider = liveProvider;
+ if (process.env.OMB_AZURE_OPENAI_LIVE_ENDPOINT !== undefined) cfg.live.azureEndpoint = process.env.OMB_AZURE_OPENAI_LIVE_ENDPOINT.trim();
+ if (process.env.OMB_AZURE_OPENAI_LIVE_DEPLOYMENT !== undefined) cfg.live.azureDeployment = process.env.OMB_AZURE_OPENAI_LIVE_DEPLOYMENT.trim();
cfg.imageGen = { ...cfg.imageGen };
if (process.env.OMB_OPENAI_IMAGE_KEY !== undefined) cfg.imageGen.key = process.env.OMB_OPENAI_IMAGE_KEY;
if (process.env.OMB_CUSTOM_IMAGE_KEY !== undefined) cfg.imageGen.customApiKey = process.env.OMB_CUSTOM_IMAGE_KEY;
@@ -863,6 +870,9 @@ export function syncCredentialEnv(patch: Partial<Omit<AppConfig, "threads" | "ne
[patch.anthropic?.url, "OMB_ANTHROPIC_API_URL"],
[patch.openaiCompat?.model, "OPENAI_COMPAT_MODEL"],
[patch.openaiCompat?.provider, "OPENAI_COMPAT_PROVIDER"],
+ [patch.live?.provider, "OMB_LIVE_PROVIDER"],
+ [patch.live?.azureEndpoint, "OMB_AZURE_OPENAI_LIVE_ENDPOINT"],
+ [patch.live?.azureDeployment, "OMB_AZURE_OPENAI_LIVE_DEPLOYMENT"],
];
for (const [value, name] of settings) {
if (value === undefined) continue;
diff --git a/server/index.ts b/server/index.ts
index 1cece45870..5abd3b99ea 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -318,9 +318,9 @@ import {
import * as tts from "./tts/index.ts";
import { createDecider, deciderReady, describeDecider } from "./decider/index.ts"; import { createExtractor, describeHelpers } from "./extractor/index.ts";
import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";
-import { createLiveSession, liveAttachUrl, liveHistoryFrom, LiveSessionError, type LiveBot, type LiveHistoryMessage } from "./live-call.ts";
+import { createLiveSession, liveAttachUrl, liveAuthHeaders, liveHistoryFrom, LiveSessionError, type LiveBot, type LiveHistoryMessage } from "./live-call.ts";
import { LiveCallController, LiveCallSignedOutError, type LiveSocket } from "./live-call-controller.ts";
-import { liveCallKey, liveSettingsFor } from "./live-settings.ts";
+import { liveCallEndpoint, liveCallKey, liveSettingsFor, liveSetupProblem } from "./live-settings.ts";
import { recordLiveCall, spokenLineFields, titleLiveCall } from "./live-call-record.ts";
import { narrateTool, toUtterances } from "./tts/speech-text.ts";
import { createTtsRoutes } from "./routes/tts.ts";
@@ -12637,11 +12637,11 @@ const liveCalls = new LiveCallController({
return task.activity === "waiting-on-you" ? "waiting" : "working";
},
broadcast: (frame) => broadcast(frame, { adminOnly: true }),
- settings: () => ({ key: liveCallKey(cfg)?.key ?? "", ...liveSettingsFor(cfg) }),
- createSession: ({ key, sdp, botId, threadId, voice }) => createLiveSession({ key, sdp, voice, bot: liveBotFor(botId), history: liveHistoryFor(threadId), cloudHome: Boolean(CLOUD_HOME) }),
+ settings: () => ({ key: liveCallKey(cfg)?.key ?? "", endpoint: liveCallEndpoint(cfg), setupProblem: liveSetupProblem(cfg), ...liveSettingsFor(cfg) }),
+ createSession: ({ key, endpoint, sdp, botId, threadId, voice }) => createLiveSession({ key, endpoint, sdp, voice, bot: liveBotFor(botId), history: liveHistoryFor(threadId), cloudHome: Boolean(CLOUD_HOME) }),
// Node's WebSocket (undici) accepts headers in its second argument.
- openSocket: (url, key) => new WebSocket(url, { headers: { authorization: `Bearer ${key}` } } as unknown as string[]) as unknown as LiveSocket,
- attachUrl: (sessionId) => liveAttachUrl(sessionId),
+ openSocket: (url, key, endpoint) => new WebSocket(url, { headers: liveAuthHeaders(endpoint.provider, key) } as unknown as string[]) as unknown as LiveSocket,
+ attachUrl: (sessionId, endpoint) => liveAttachUrl(sessionId, endpoint),
speakable: (text) => toUtterances(text),
// One "call" row per call: its id, times and length, never anything said on it.
recordCall: (input) => {
diff --git a/server/live-call-controller.test.ts b/server/live-call-controller.test.ts
index d377e66c71..4d9237da84 100644
--- a/server/live-call-controller.test.ts
+++ b/server/live-call-controller.test.ts
@@ -5,7 +5,7 @@ import {
LiveCallBusyError, LiveCallController, LiveCallSignedOutError, type LiveActivity, type LiveCallDeps, type LiveSocket,
} from "./live-call-controller.ts";
import { LIVE_COPY } from "../shared/live-approval.ts";
-import { LIVE_NEEDS_KEY, LiveSessionError } from "./live-call.ts";
+import { LIVE_NEEDS_AZURE, LIVE_NEEDS_KEY, LiveSessionError, type LiveEndpoint } from "./live-call.ts";
import type { RequestAuth } from "./request-auth.ts";
import type { Message, StoreChange } from "./store.ts";
@@ -30,6 +30,7 @@ class FakeSocket implements LiveSocket {
const owner: RequestAuth = { kind: "loopback", scopes: ["admin", "client"] };
const BOT = { botId: "bot1", botName: "Ada", threadId: "t1" };
+const ENDPOINT: LiveEndpoint = { provider: "openai", apiBase: "https://api.openai.com/v1", model: "gpt-live-1" };
function setup(overrides: Partial<LiveCallDeps> = {}) {
const listeners = new Set<(change: StoreChange) => void>();
@@ -37,7 +38,7 @@ function setup(overrides: Partial<LiveCallDeps> = {}) {
const frames: Array<LiveCallState | null> = [];
const logs: string[] = [];
let activity: LiveActivity = "idle";
- const settings = { key: "sk-test", voice: "sol", readTypedReplies: true, idleMinutes: 5 };
+ const settings: ReturnType<LiveCallDeps["settings"]> = { key: "sk-test", endpoint: ENDPOINT, voice: "sol", readTypedReplies: true, idleMinutes: 5 };
const queue = new Set<string>();
let messageCounter = 0;
const deps: LiveCallDeps = {
@@ -76,7 +77,7 @@ describe("LiveCallController lifecycle", () => {
it("creates the session with the key and voice, attaches the sideband and goes live", async () => {
const t = setup();
const result = await t.controller.start({ auth: owner, ...BOT, client: "ios", sdp: "offer-sdp" });
- expect(t.deps.createSession).toHaveBeenCalledWith({ key: "sk-test", sdp: "offer-sdp", botId: "bot1", threadId: "t1", voice: "sol" });
+ expect(t.deps.createSession).toHaveBeenCalledWith({ key: "sk-test", endpoint: ENDPOINT, sdp: "offer-sdp", botId: "bot1", threadId: "t1", voice: "sol" });
expect(result.sdp).toBe("answer-sdp");
expect(result.call).toMatchObject({ botId: "bot1", threadId: "t1", client: "ios", voice: "sol", status: "connecting" });
expect(t.socket().url).toBe("ws://fake/sess_1/attach");
@@ -106,6 +107,30 @@ describe("LiveCallController lifecycle", () => {
expect(LIVE_NEEDS_KEY).toBe("Live calls use your own OpenAI key. Add it in Settings → API keys.");
});
+ it("refuses an Azure call whose setup is incomplete with the setup message, before reaching Azure", async () => {
+ const t = setup();
+ t.settings.endpoint = null;
+ t.settings.setupProblem = LIVE_NEEDS_AZURE;
+ await expect(t.controller.start({ auth: owner, ...BOT, client: "desktop", sdp: "a" })).rejects.toMatchObject({ status: 409, message: LIVE_NEEDS_AZURE });
+ expect(t.deps.createSession).not.toHaveBeenCalled();
+ expect(t.controller.current()).toBeNull();
+ });
+
+ it("creates and attaches an Azure call on the Azure endpoint it started with, even if settings change mid-call", async () => {
+ const azure: LiveEndpoint = { provider: "azure", apiBase: "https://res.openai.azure.com/openai/v1", model: "live-dep" };
+ const attachUrl = vi.fn((id: string, endpoint: LiveEndpoint) => `${endpoint.apiBase}/live/sessions/${id}/attach`);
+ const t = setup({ attachUrl });
+ t.settings.endpoint = azure;
+ const pending = t.controller.start({ auth: owner, ...BOT, client: "web", sdp: "offer-sdp" });
+ t.settings.endpoint = ENDPOINT;
+ await pending;
+ expect(t.deps.createSession).toHaveBeenCalledWith(expect.objectContaining({ endpoint: azure }));
+ expect(attachUrl).toHaveBeenCalledWith("sess_1", azure);
+ expect(t.socket().url).toBe("https://res.openai.azure.com/openai/v1/live/sessions/sess_1/attach");
+ t.socket().open();
+ expect(t.controller.current()).toMatchObject({ status: "live" });
+ });
+
it("starts a phone's call with no plan at all once a key exists, through the companion or by the phone's own client", async () => {
for (const input of [{ client: "ios", device: "phone-1" }, { client: "android", device: "phone-2" }, { client: "ios" }, { client: "android" }] as const) {
const t = setup();
diff --git a/server/live-call-controller.ts b/server/live-call-controller.ts
index 63adf6763e..602dd8f53b 100644
--- a/server/live-call-controller.ts
+++ b/server/live-call-controller.ts
@@ -7,7 +7,7 @@ import {
import { clampAppend, commentaryChunks, LiveTranscript } from "../shared/live-call.ts";
import { signInWaits } from "../shared/sign-in-request.ts";
import type { LiveCallRecord, LiveCallState, LiveClient, LiveEndReason } from "../shared/wire.ts";
-import { LIVE_NEEDS_KEY, liveCallSummaryLine, LiveSessionError, liveVoice } from "./live-call.ts";
+import { LIVE_NEEDS_KEY, liveCallSummaryLine, liveProviderName, LiveSessionError, liveVoice, type LiveEndpoint } from "./live-call.ts";
import type { RequestAuth } from "./request-auth.ts";
import type { Message, StoreChange } from "./store.ts";
@@ -47,10 +47,11 @@ export interface LiveCallDeps {
personKey?(auth: RequestAuth): string | undefined;
activity(botId: string, threadId: string): LiveActivity;
broadcast(frame: { kind: "live.call"; botId: string; threadId: string; call: LiveCallState | null }): void;
- settings(): { key: string; voice: string; readTypedReplies: boolean; idleMinutes: number };
- createSession(input: { key: string; sdp: string; botId: string; threadId: string; voice: string }): Promise<{ sessionId: string; sdp: string }>;
- openSocket(url: string, key: string): LiveSocket;
- attachUrl(sessionId: string): string;
+ /** `endpoint` null, or a `setupProblem`, refuses the call with that message (409). */
+ settings(): { key: string; endpoint: LiveEndpoint | null; setupProblem?: string | null; voice: string; readTypedReplies: boolean; idleMinutes: number };
+ createSession(input: { key: string; endpoint: LiveEndpoint; sdp: string; botId: string; threadId: string; voice: string }): Promise<{ sessionId: string; sdp: string }>;
+ openSocket(url: string, key: string, endpoint: LiveEndpoint): LiveSocket;
+ attachUrl(sessionId: string, endpoint: LiveEndpoint): string;
speakable(text: string): string[];
recordCall?(input: { threadId: string; botName: string; record: LiveCallRecord }): void;
log(line: string): void;
@@ -88,6 +89,7 @@ interface Call {
personKey: string | undefined;
botName: string;
key: string;
+ endpoint: LiveEndpoint;
sessionId: string;
socket: LiveSocket | null;
attached: boolean;
@@ -149,21 +151,22 @@ export class LiveCallController {
if (input.device && this.revokedDevices.has(input.device)) throw new LiveCallSignedOutError();
const settings = this.deps.settings();
const key = settings.key.trim();
- if (!key) throw new LiveSessionError(LIVE_NEEDS_KEY, 409);
+ const endpoint = settings.endpoint;
+ if (settings.setupProblem || !key || !endpoint) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
const voice = liveVoice(settings.voice);
- const call = this.newCall(input, key, voice);
+ const call = this.newCall(input, key, endpoint, voice);
// Taken before the first await: a second start in the same tick is refused.
this.call = call;
let session: { sessionId: string; sdp: string };
try {
- session = await this.deps.createSession({ key, sdp: input.sdp, botId: input.botId, threadId: input.threadId, voice });
+ session = await this.deps.createSession({ key, endpoint, sdp: input.sdp, botId: input.botId, threadId: input.threadId, voice });
} catch (error) {
if (this.call === call) this.call = null;
this.deps.log(`[live] call failed bot=${input.botId} client=${input.client} status=${error instanceof LiveSessionError ? error.status : "error"}`);
throw error;
}
if (this.call !== call) {
- this.closeOrphan(session.sessionId, key);
+ this.closeOrphan(session.sessionId, key, endpoint);
throw new LiveSessionError("The call was cancelled.", 503);
}
try {
@@ -182,7 +185,7 @@ export class LiveCallController {
} catch (error) {
const sidebandOpened = call.socket !== null;
this.finish(call, "error", "The call could not start.");
- if (!sidebandOpened) this.closeOrphan(session.sessionId, key);
+ if (!sidebandOpened) this.closeOrphan(session.sessionId, key, endpoint);
throw error;
}
return { call: { ...call.state }, sdp: session.sdp };
@@ -217,7 +220,7 @@ export class LiveCallController {
}
- private newCall(input: { auth: RequestAuth; device?: string; botId: string; botName: string; threadId: string; client: LiveClient }, key: string, voice: string): Call {
+ private newCall(input: { auth: RequestAuth; device?: string; botId: string; botName: string; threadId: string; client: LiveClient }, key: string, endpoint: LiveEndpoint, voice: string): Call {
return {
state: { callId: randomUUID(), botId: input.botId, threadId: input.threadId, client: input.client, voice, startedAt: this.now(), status: "connecting" },
auth: input.auth,
@@ -225,6 +228,7 @@ export class LiveCallController {
personKey: this.deps.personKey?.(input.auth),
botName: input.botName,
key,
+ endpoint,
sessionId: "",
socket: null,
attached: false,
@@ -265,14 +269,14 @@ export class LiveCallController {
private attach(call: Call): void {
let socket: LiveSocket;
try {
- socket = this.deps.openSocket(this.deps.attachUrl(call.sessionId), call.key);
+ socket = this.deps.openSocket(this.deps.attachUrl(call.sessionId, call.endpoint), call.key, call.endpoint);
} catch {
- this.finish(call, "sideband-lost", "The call could not connect to OpenAI.");
+ this.finish(call, "sideband-lost", `The call could not connect to ${liveProviderName(call.endpoint.provider)}.`);
return;
}
call.socket = socket;
const attachTimer = this.later(call, () => {
- if (!call.attached) this.finish(call, "sideband-lost", "The call could not connect to OpenAI.");
+ if (!call.attached) this.finish(call, "sideband-lost", `The call could not connect to ${liveProviderName(call.endpoint.provider)}.`);
}, ATTACH_TIMEOUT_MS);
socket.onopen = () => {
call.attached = true;
@@ -285,19 +289,19 @@ export class LiveCallController {
socket.onmessage = (event) => this.guarded(call, () => this.onSideband(call, event.data));
// Node's WebSocket reports a refused handshake as an error without a close.
socket.onerror = () => {
- if (!call.attached) this.finish(call, "sideband-lost", "The call could not connect to OpenAI.");
+ if (!call.attached) this.finish(call, "sideband-lost", `The call could not connect to ${liveProviderName(call.endpoint.provider)}.`);
};
socket.onclose = () => {
if (call.state.status === "ended") return;
if (call.pendingEnd) this.finish(call, call.pendingEnd);
- else this.finish(call, "sideband-lost", "The call connection to OpenAI dropped.");
+ else this.finish(call, "sideband-lost", `The call connection to ${liveProviderName(call.endpoint.provider)} dropped.`);
};
}
- private closeOrphan(sessionId: string, key: string): void {
+ private closeOrphan(sessionId: string, key: string, endpoint: LiveEndpoint): void {
let socket: LiveSocket;
try {
- socket = this.deps.openSocket(this.deps.attachUrl(sessionId), key);
+ socket = this.deps.openSocket(this.deps.attachUrl(sessionId, endpoint), key, endpoint);
} catch {
return;
}
diff --git a/server/live-call.test.ts b/server/live-call.test.ts
index 21d3cf5374..bb090dee6b 100644
--- a/server/live-call.test.ts
+++ b/server/live-call.test.ts
@@ -1,6 +1,8 @@
import { describe, expect, it, vi } from "vitest";
import {
+ azureLiveEndpoint,
+ azureOpenAiRoot,
createLiveSession,
DEFAULT_LIVE_VOICE,
LIVE_MODEL,
@@ -13,6 +15,7 @@ import {
liveInstructions,
liveSessionsUrl,
MAX_SDP_BYTES,
+ openAiLiveEndpoint,
} from "./live-call.ts";
import { CLOUD_HOME_PLACE } from "./system-prompt.ts";
@@ -222,17 +225,79 @@ describe("session config for the untrusted client", () => {
describe("live URLs", () => {
it("uses OpenAI unless a loopback test server is set", () => {
- expect(liveSessionsUrl({})).toBe("https://api.openai.com/v1/live/sessions");
- expect(liveAttachUrl("sess_1", {})).toBe("wss://api.openai.com/v1/live/sessions/sess_1/attach");
+ expect(liveSessionsUrl(openAiLiveEndpoint({}))).toBe("https://api.openai.com/v1/live/sessions");
+ expect(liveAttachUrl("sess_1", openAiLiveEndpoint({}))).toBe("wss://api.openai.com/v1/live/sessions/sess_1/attach");
const env = { OMB_OPENAI_LIVE_URL: "http://127.0.0.1:4555" };
- expect(liveSessionsUrl(env)).toBe("http://127.0.0.1:4555/v1/live/sessions");
- expect(liveAttachUrl("sess_1", env)).toBe("ws://127.0.0.1:4555/v1/live/sessions/sess_1/attach");
+ expect(liveSessionsUrl(openAiLiveEndpoint(env))).toBe("http://127.0.0.1:4555/v1/live/sessions");
+ expect(liveAttachUrl("sess_1", openAiLiveEndpoint(env))).toBe("ws://127.0.0.1:4555/v1/live/sessions/sess_1/attach");
});
it("ignores an override that is not loopback", () => {
expect(liveBaseUrl({ OMB_OPENAI_LIVE_URL: "http://evil.example:80" })).toBe("https://api.openai.com");
});
it("escapes the session id", () => {
- expect(liveAttachUrl("a/b", {})).toBe("wss://api.openai.com/v1/live/sessions/a%2Fb/attach");
+ expect(liveAttachUrl("a/b", openAiLiveEndpoint({}))).toBe("wss://api.openai.com/v1/live/sessions/a%2Fb/attach");
+ });
+ it("points an Azure call at the resource's v1 API with the deployment as the model", () => {
+ const endpoint = azureLiveEndpoint("https://my-res.openai.azure.com", "my-live")!;
+ expect(endpoint).toEqual({ provider: "azure", apiBase: "https://my-res.openai.azure.com/openai/v1", model: "my-live" });
+ expect(liveSessionsUrl(endpoint)).toBe("https://my-res.openai.azure.com/openai/v1/live/sessions");
+ expect(liveAttachUrl("s/1", endpoint)).toBe("wss://my-res.openai.azure.com/openai/v1/live/sessions/s%2F1/attach");
+ expect(azureLiveEndpoint("https://my-res.openai.azure.com", "")?.model).toBe(LIVE_MODEL);
+ });
+});
+
+describe("azureOpenAiRoot", () => {
+ it("accepts a resource URL however it is pasted", () => {
+ for (const url of [
+ "https://my-res.openai.azure.com",
+ " https://my-res.openai.azure.com/ ",
+ "https://my-res.openai.azure.com/openai/v1",
+ "https://my-res.openai.azure.com/openai/v1/live/sessions?api-version=preview",
+ ]) expect(azureOpenAiRoot(url), url).toBe("https://my-res.openai.azure.com/openai");
+ expect(azureOpenAiRoot("https://proj.services.ai.azure.com")).toBe("https://proj.services.ai.azure.com/openai");
+ expect(azureOpenAiRoot("https://res.cognitiveservices.azure.com/")).toBe("https://res.cognitiveservices.azure.com/openai");
+ expect(azureOpenAiRoot("https://gw.azure-api.net/team-a/openai/v1")).toBe("https://gw.azure-api.net/team-a/openai");
+ });
+ it("refuses anything the key must not be sent to", () => {
+ for (const url of [
+ undefined,
+ "",
+ "my-res.openai.azure.com",
+ "http://my-res.openai.azure.com",
+ "https://openai.azure.com",
+ "https://my-res.openai.azure.com.evil.example",
+ "https://evil.example/my-res.openai.azure.com",
+ "https://user:[email protected]",
+ "https://api.openai.com",
+ ]) expect(azureOpenAiRoot(url), String(url)).toBeNull();
+ });
+ it("refuses a deployment name Azure could not have", () => {
+ expect(azureLiveEndpoint("https://my-res.openai.azure.com", "bad name/../x")).toBeNull();
+ });
+});
+
+describe("createLiveSession on Azure", () => {
+ it("sends the resource key as api-key, never as a bearer token, and the deployment as the model", async () => {
+ const fetchImpl = okFetch();
+ const endpoint = azureLiveEndpoint("https://my-res.openai.azure.com", "live-prod")!;
+ const result = await createLiveSession({ key: " azure-secret ", endpoint, sdp: OFFER, bot: BOT, history: [], cloudHome: false, fetchImpl });
+ expect(result).toEqual({ sessionId: "live_123", sdp: "v=0 answer" });
+ const [url, init] = fetchImpl.mock.calls[0];
+ expect(url).toBe("https://my-res.openai.azure.com/openai/v1/live/sessions");
+ const headers = init!.headers as Record<string, string>;
+ expect(headers["api-key"]).toBe("azure-secret");
+ expect(headers.authorization).toBeUndefined();
+ const body = JSON.parse(String(init?.body));
+ expect(body.session.model).toBe("live-prod");
+ expect(body.session.delegation).toEqual({ type: "client" });
+ expect(String(init?.body)).not.toContain("azure-secret");
+ });
+ it("names Azure in its errors", async () => {
+ const endpoint = azureLiveEndpoint("https://my-res.openai.azure.com", undefined)!;
+ const refuse = vi.fn(async () => new Response("{}", { status: 404 }));
+ await expect(createLiveSession({ key: "k", endpoint, sdp: OFFER, bot: BOT, history: [], cloudHome: false, fetchImpl: refuse }))
+ .rejects.toMatchObject({ status: 502, message: expect.stringContaining("deployment") });
+ expect(liveErrorMessage(401, undefined, "azure")).toMatch(/^Azure OpenAI rejected the API key/);
});
});
diff --git a/server/live-call.ts b/server/live-call.ts
index de3e8f2afc..91e8e6f8d2 100644
--- a/server/live-call.ts
+++ b/server/live-call.ts
@@ -1,5 +1,6 @@
-// The OpenAI key never leaves the harness: the renderer only ever holds the SDP answer and its media connection.
+// The provider key never leaves the harness: the renderer only ever holds the SDP answer and its media connection.
import { CLOUD_HOME_PLACE } from "./system-prompt.ts";
+import type { LiveProvider } from "../shared/wire.ts";
import type { Message } from "./store.ts";
export const LIVE_MODEL = "gpt-live-1";
@@ -7,6 +8,7 @@ const OPENAI_BASE = "https://api.openai.com";
export const DEFAULT_LIVE_VOICE = "marin";
export const MAX_SDP_BYTES = 64 * 1024;
export const LIVE_NEEDS_KEY = "Live calls use your own OpenAI key. Add it in Settings → API keys.";
+export const LIVE_NEEDS_AZURE = "Live calls through Azure OpenAI need the resource endpoint, the GPT-Live deployment name and its key. Add them in Call settings.";
/** The client's data channel is untrusted: it may only hang up; every append goes over the sideband. */
export const LIVE_DATA_CHANNEL = {
@@ -21,18 +23,79 @@ export const LIVE_DATA_CHANNEL = {
],
};
+/** Hosts an Azure OpenAI or Foundry resource answers on, including Azure Government, Azure China and API Management gateways. The key is only ever sent to one of these. */
+const AZURE_HOST_SUFFIXES = [
+ ".openai.azure.com",
+ ".services.ai.azure.com",
+ ".cognitiveservices.azure.com",
+ ".openai.azure.us",
+ ".openai.azure.cn",
+ ".azure-api.net",
+] as const;
+const AZURE_DEPLOYMENT = /^[A-Za-z0-9][\w.-]{0,63}$/;
+
+/** Where a Live call's session is created and its sideband attached. Never carries the key. */
+export interface LiveEndpoint {
+ provider: LiveProvider;
+ /** The versioned API root, e.g. `https://api.openai.com/v1` or `https://my-res.openai.azure.com/openai/v1`. */
+ apiBase: string;
+ /** The OpenAI model id, or the Azure deployment name. */
+ model: string;
+}
+
+export function liveProviderName(provider: LiveProvider): string {
+ return provider === "azure" ? "Azure OpenAI" : "OpenAI";
+}
+
/** Only a loopback http URL is accepted, read at call time. */
export function liveBaseUrl(env: NodeJS.ProcessEnv = process.env): string {
const override = env.OMB_OPENAI_LIVE_URL?.trim() ?? "";
return /^http:\/\/127\.0\.0\.1:\d{1,5}$/.test(override) ? override : OPENAI_BASE;
}
-export function liveSessionsUrl(env: NodeJS.ProcessEnv = process.env): string {
- return `${liveBaseUrl(env)}/v1/live/sessions`;
+export function openAiLiveEndpoint(env: NodeJS.ProcessEnv = process.env): LiveEndpoint {
+ return { provider: "openai", apiBase: `${liveBaseUrl(env)}/v1`, model: LIVE_MODEL };
+}
+
+/** The `…/openai` root of an Azure resource URL as people paste it (bare, with `/openai/v1`, or a full request URL); null for anything that is not https on an Azure host. */
+export function azureOpenAiRoot(raw: string | undefined): string | null {
+ let url: URL;
+ try {
+ url = new URL(raw?.trim() ?? "");
+ } catch {
+ return null;
+ }
+ const host = url.hostname.toLowerCase();
+ if (url.protocol !== "https:" || url.username || url.password) return null;
+ if (!AZURE_HOST_SUFFIXES.some((suffix) => host.endsWith(suffix) && host.length > suffix.length)) return null;
+ const path = url.pathname.replace(/\/+$/, "");
+ const at = path.search(/\/openai(\/|$)/i);
+ const prefix = at >= 0 ? path.slice(0, at) : path;
+ return `${url.origin}${prefix}/openai`;
+}
+
+export function azureLiveDeployment(raw: string | undefined): string | null {
+ const name = raw?.trim() || LIVE_MODEL;
+ return AZURE_DEPLOYMENT.test(name) ? name : null;
}
-export function liveAttachUrl(sessionId: string, env: NodeJS.ProcessEnv = process.env): string {
- return `${liveBaseUrl(env).replace(/^http/, "ws")}/v1/live/sessions/${encodeURIComponent(sessionId)}/attach`;
+export function azureLiveEndpoint(endpoint: string | undefined, deployment: string | undefined): LiveEndpoint | null {
+ const root = azureOpenAiRoot(endpoint);
+ const model = azureLiveDeployment(deployment);
+ return root && model ? { provider: "azure", apiBase: `${root}/v1`, model } : null;
+}
+
+export function liveSessionsUrl(endpoint: LiveEndpoint = openAiLiveEndpoint()): string {
+ return `${endpoint.apiBase}/live/sessions`;
+}
+
+export function liveAttachUrl(sessionId: string, endpoint: LiveEndpoint = openAiLiveEndpoint()): string {
+ return `${endpoint.apiBase.replace(/^http/, "ws")}/live/sessions/${encodeURIComponent(sessionId)}/attach`;
+}
+
+/** Azure OpenAI takes a resource key in `api-key`; OpenAI takes a bearer token. */
+export function liveAuthHeaders(provider: LiveProvider, key: string): Record<string, string> {
+ return provider === "azure" ? { "api-key": key } : { authorization: `Bearer ${key}` };
}
// The API caps startup history at 128 messages / 8,192 tokens; stay well inside it.
@@ -131,22 +194,24 @@ export interface CreateLiveSessionInput {
history: LiveHistoryMessage[];
cloudHome: boolean;
voice?: string;
+ endpoint?: LiveEndpoint;
fetchImpl?: typeof fetch;
- url?: string;
timeoutMs?: number;
}
-/** Errors carry a status and a message fit for the user: never the key, never OpenAI's raw body. */
+/** Errors carry a status and a message fit for the user: never the key, never the provider's raw body. */
export async function createLiveSession(input: CreateLiveSessionInput): Promise<{ sessionId: string; sdp: string }> {
+ const endpoint = input.endpoint ?? openAiLiveEndpoint();
+ const provider = liveProviderName(endpoint.provider);
const key = input.key.trim();
- if (!key) throw new LiveSessionError("Add an OpenAI API key to use Live calls.", 409);
+ if (!key) throw new LiveSessionError(`Add an ${provider} API key to use Live calls.`, 409);
if (!input.sdp.trim() || Buffer.byteLength(input.sdp) > MAX_SDP_BYTES) {
throw new LiveSessionError("The call could not start: the connection offer was invalid.", 400);
}
const initialInput = liveInitialInput(input.history);
const body = {
session: {
- model: LIVE_MODEL,
+ model: endpoint.model,
instructions: liveInstructions(input.bot, { cloudHome: input.cloudHome }),
delegation: { type: "client" },
audio: { output: { voice: liveVoice(input.voice) } },
@@ -157,45 +222,53 @@ export async function createLiveSession(input: CreateLiveSessionInput): Promise<
};
let response: Response;
try {
- response = await (input.fetchImpl ?? fetch)(input.url ?? liveSessionsUrl(), {
+ response = await (input.fetchImpl ?? fetch)(liveSessionsUrl(endpoint), {
method: "POST",
- headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
+ headers: { ...liveAuthHeaders(endpoint.provider, key), "content-type": "application/json" },
body: JSON.stringify(body),
signal: AbortSignal.timeout(input.timeoutMs ?? CREATE_TIMEOUT_MS),
});
} catch (error) {
const timedOut = error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
throw new LiveSessionError(
- timedOut ? "OpenAI did not answer in time. Try the call again." : "Could not reach OpenAI. Check the internet connection.",
+ timedOut ? `${provider} did not answer in time. Try the call again.` : `Could not reach ${provider}. Check the internet connection.`,
502,
);
}
if (!response.ok) {
const failure = await response.json().catch(() => null) as { error?: { param?: unknown } } | null;
const param = typeof failure?.error?.param === "string" ? failure.error.param : undefined;
- throw new LiveSessionError(liveErrorMessage(response.status, param), response.status === 429 ? 429 : 502);
+ throw new LiveSessionError(liveErrorMessage(response.status, param, endpoint.provider), response.status === 429 ? 429 : 502);
}
const payload = await response.json().catch(() => null) as { session?: { id?: unknown }; transport?: { sdp?: unknown } } | null;
const sessionId = payload?.session?.id;
const sdp = payload?.transport?.sdp;
if (typeof sessionId !== "string" || typeof sdp !== "string" || !sdp.trim()) {
- throw new LiveSessionError("OpenAI returned an unexpected answer. Try the call again.", 502);
+ throw new LiveSessionError(`${provider} returned an unexpected answer. Try the call again.`, 502);
}
return { sessionId, sdp };
}
-export function liveErrorMessage(status: number, param?: string): string {
+export function liveErrorMessage(status: number, param?: string, provider: LiveProvider = "openai"): string {
+ const name = liveProviderName(provider);
if (status === 400) {
return param && /voice/i.test(param)
- ? "OpenAI rejected the voice for this call. Choose another voice."
- : `OpenAI rejected the call settings (HTTP 400${param ? `, ${param.replace(/[^\w.]/g, "").slice(0, 60)}` : ""}).`;
+ ? `${name} rejected the voice for this call. Choose another voice.`
+ : `${name} rejected the call settings (HTTP 400${param ? `, ${param.replace(/[^\w.]/g, "").slice(0, 60)}` : ""}).`;
+ }
+ if (provider === "azure") {
+ if (status === 401) return "Azure OpenAI rejected the API key. Check the key of the Azure resource.";
+ if (status === 403) return "This Azure OpenAI resource refused the call. Check its network rules and that the key belongs to it.";
+ if (status === 404) return "Azure OpenAI has no GPT-Live deployment by that name on this resource. Check the endpoint and the deployment name.";
+ if (status === 429) return "Azure OpenAI is limiting Live sessions right now (rate limit or quota). Try again in a moment.";
+ } else {
+ if (status === 401) return "OpenAI rejected the API key. Check the key for Live calls.";
+ if (status === 403) return "This OpenAI project has no access to GPT-Live. Check the project's model access and billing.";
+ if (status === 404) return "GPT-Live is not available for this OpenAI project.";
+ if (status === 429) return "OpenAI is limiting Live sessions right now (rate limit or quota). Try again in a moment.";
}
- if (status === 401) return "OpenAI rejected the API key. Check the key for Live calls.";
- if (status === 403) return "This OpenAI project has no access to GPT-Live. Check the project's model access and billing.";
- if (status === 404) return "GPT-Live is not available for this OpenAI project.";
- if (status === 429) return "OpenAI is limiting Live sessions right now (rate limit or quota). Try again in a moment.";
- if (status >= 500) return "OpenAI had a problem starting the call. Try again in a moment.";
- return `OpenAI could not start the call (HTTP ${status}).`;
+ if (status >= 500) return `${name} had a problem starting the call. Try again in a moment.`;
+ return `${name} could not start the call (HTTP ${status}).`;
}
function oneLine(value: string): string {
diff --git a/server/live-settings.test.ts b/server/live-settings.test.ts
index a62576db32..d184945752 100644
--- a/server/live-settings.test.ts
+++ b/server/live-settings.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import type { AppConfig } from "./config.ts";
-import { LIVE_IDLE_MINUTES_DEFAULT, liveCallKey, liveSettingsFor } from "./live-settings.ts";
+import { LIVE_NEEDS_AZURE, LIVE_NEEDS_KEY } from "./live-call.ts";
+import { LIVE_IDLE_MINUTES_DEFAULT, liveCallEndpoint, liveCallKey, liveSettingsFor, liveSetupProblem } from "./live-settings.ts";
describe("live settings", () => {
it("defaults to a 5 minute idle hang-up and reading typed replies, with no key", () => {
@@ -37,3 +38,40 @@ describe("the key a Live call uses", () => {
expect(liveSettingsFor(others)).toEqual({ configured: false, voice: "", readTypedReplies: true, idleMinutes: 5 });
});
});
+
+describe("Live calls through Azure OpenAI", () => {
+ const azure = { provider: "azure" as const, azureEndpoint: "https://my-res.openai.azure.com", azureDeployment: "live-prod" };
+
+ it("never use the OpenAI API key as the Azure resource key", () => {
+ const cfg = { live: azure, openai: { key: "sk-openai" } } as AppConfig;
+ expect(liveCallKey(cfg)).toBeNull();
+ expect(liveSetupProblem(cfg)).toBe(LIVE_NEEDS_AZURE);
+ expect(liveSettingsFor(cfg)).toMatchObject({ configured: false, provider: "azure", azureEndpoint: azure.azureEndpoint, azureDeployment: "live-prod" });
+ });
+
+ it("are ready with the Live key, a valid endpoint and a deployment, and report none of the key", () => {
+ const cfg = { live: { ...azure, key: "azure-secret" } } as AppConfig;
+ expect(liveCallKey(cfg)).toEqual({ key: "azure-secret", source: "live" });
+ expect(liveCallEndpoint(cfg)).toEqual({ provider: "azure", apiBase: "https://my-res.openai.azure.com/openai/v1", model: "live-prod" });
+ expect(liveSetupProblem(cfg)).toBeNull();
+ const settings = liveSettingsFor(cfg);
+ expect(settings).toMatchObject({ configured: true, keySource: "live", provider: "azure" });
+ expect(JSON.stringify(settings)).not.toContain("azure-secret");
+ });
+
+ it("are not ready with an endpoint that is not an Azure host", () => {
+ const cfg = { live: { ...azure, key: "k", azureEndpoint: "https://evil.example" } } as AppConfig;
+ expect(liveCallEndpoint(cfg)).toBeNull();
+ expect(liveSetupProblem(cfg)).toBe(LIVE_NEEDS_AZURE);
+ expect(liveSettingsFor(cfg).configured).toBe(false);
+ });
+
+ it("default to gpt-live-1 as the deployment name", () => {
+ expect(liveCallEndpoint({ live: { ...azure, azureDeployment: "" } } as AppConfig)?.model).toBe("gpt-live-1");
+ });
+
+ it("leave OpenAI the default provider", () => {
+ expect(liveCallEndpoint({ openai: { key: "sk" } } as AppConfig, {})).toEqual({ provider: "openai", apiBase: "https://api.openai.com/v1", model: "gpt-live-1" });
+ expect(liveSetupProblem({} as AppConfig)).toBe(LIVE_NEEDS_KEY);
+ });
+});
diff --git a/server/live-settings.ts b/server/live-settings.ts
index 35d2625ec6..c452a4e432 100644
--- a/server/live-settings.ts
+++ b/server/live-settings.ts
@@ -1,21 +1,43 @@
import type { LiveKeySource, LiveSettings } from "../shared/wire.ts";
import type { AppConfig } from "./config.ts";
+import { azureLiveEndpoint, LIVE_NEEDS_AZURE, LIVE_NEEDS_KEY, openAiLiveEndpoint, type LiveEndpoint } from "./live-call.ts";
export const LIVE_IDLE_MINUTES_DEFAULT = 5;
-export function liveCallKey(cfg: Pick<AppConfig, "live" | "openai">): { key: string; source: LiveKeySource } | null {
+type LiveConfig = Pick<AppConfig, "live" | "openai">;
+
+/** An Azure resource key is never stood in for by the OpenAI API key, nor the other way round. */
+export function liveCallKey(cfg: LiveConfig): { key: string; source: LiveKeySource } | null {
const live = cfg.live?.key?.trim();
if (live) return { key: live, source: "live" };
+ if (cfg.live?.provider === "azure") return null;
const openai = cfg.openai?.key?.trim();
return openai ? { key: openai, source: "openai" } : null;
}
+/** null when Azure is chosen but its endpoint or deployment is missing or not valid. */
+export function liveCallEndpoint(cfg: LiveConfig, env: NodeJS.ProcessEnv = process.env): LiveEndpoint | null {
+ return cfg.live?.provider === "azure"
+ ? azureLiveEndpoint(cfg.live.azureEndpoint, cfg.live.azureDeployment)
+ : openAiLiveEndpoint(env);
+}
+
+export function liveSetupProblem(cfg: LiveConfig): string | null {
+ const azure = cfg.live?.provider === "azure";
+ if (!liveCallKey(cfg)) return azure ? LIVE_NEEDS_AZURE : LIVE_NEEDS_KEY;
+ return liveCallEndpoint(cfg) ? null : LIVE_NEEDS_AZURE;
+}
+
export function liveSettingsFor(cfg: AppConfig): LiveSettings {
const minutes = cfg.live?.idleMinutes;
const key = liveCallKey(cfg);
+ const azure = cfg.live?.provider === "azure";
return {
- configured: key !== null,
+ configured: liveSetupProblem(cfg) === null,
...(key ? { keySource: key.source } : {}),
+ ...(azure ? { provider: "azure" as const } : {}),
+ ...(cfg.live?.azureEndpoint ? { azureEndpoint: cfg.live.azureEndpoint } : {}),
+ ...(cfg.live?.azureDeployment ? { azureDeployment: cfg.live.azureDeployment } : {}),
voice: cfg.live?.voice ?? "",
readTypedReplies: cfg.live?.readTypedReplies ?? true,
idleMinutes: Number.isInteger(minutes) && minutes! >= 1 && minutes! <= 60 ? minutes! : LIVE_IDLE_MINUTES_DEFAULT,
diff --git a/server/routes/live.test.ts b/server/routes/live.test.ts
index 8e2efc93f2..af5f2837da 100644
--- a/server/routes/live.test.ts
+++ b/server/routes/live.test.ts
@@ -139,6 +139,17 @@ describe("live routes", () => {
expect((await request(d, "PATCH", "/api/live/settings", { voice: "Marin!" })).status).toBe(400);
expect(d.saved).toEqual([{ idleMinutes: 10, readTypedReplies: false }]);
});
+ it("saves an Azure provider, endpoint and deployment, refusing a host the key must not reach", async () => {
+ const d = deps();
+ const azure = { provider: "azure", azureEndpoint: "https://my-res.openai.azure.com", azureDeployment: "live-prod" };
+ expect(await request(d, "PATCH", "/api/live/settings", azure)).toMatchObject({ status: 200, body: { live: azure } });
+ expect(await request(d, "PATCH", "/api/live/settings", { azureEndpoint: "https://evil.example" })).toMatchObject({ status: 400, body: { error: expect.stringContaining("Azure OpenAI resource") } });
+ expect(await request(d, "PATCH", "/api/live/settings", { azureEndpoint: "http://my-res.openai.azure.com" })).toMatchObject({ status: 400 });
+ expect(await request(d, "PATCH", "/api/live/settings", { azureDeployment: "a b" })).toMatchObject({ status: 400, body: { error: expect.stringContaining("deployment name") } });
+ expect((await request(d, "PATCH", "/api/live/settings", { provider: "aws" })).status).toBe(400);
+ expect((await request(d, "PATCH", "/api/live/settings", { azureEndpoint: "", azureDeployment: "" })).status).toBe(200);
+ expect(d.saved).toEqual([azure, { azureEndpoint: "", azureDeployment: "" }]);
+ });
it("saves nothing for an empty patch", async () => {
const d = deps();
expect(await request(d, "PATCH", "/api/live/settings", {})).toEqual({ status: 400, body: { error: "nothing to save" } });
diff --git a/server/routes/live.ts b/server/routes/live.ts
index 89d879c82c..57b96d94d2 100644
--- a/server/routes/live.ts
+++ b/server/routes/live.ts
@@ -1,8 +1,8 @@
-// The OpenAI key is never read or written here; without one a start answers 409 `needsKey`. A phone can never send device-revoked.
+// The provider key is never read or written here; without one a start answers 409 `needsKey`. A phone can never send device-revoked.
import type { IncomingMessage } from "node:http";
import { z } from "zod";
-import type { LiveSettings } from "../../shared/wire.ts";
-import { LiveSessionError, MAX_SDP_BYTES } from "../live-call.ts";
+import type { LiveProvider, LiveSettings } from "../../shared/wire.ts";
+import { azureLiveDeployment, azureOpenAiRoot, LiveSessionError, MAX_SDP_BYTES } from "../live-call.ts";
import { LiveCallBusyError, type LiveCallController } from "../live-call-controller.ts";
import { PASS, type RouteContext, type RouteHandler } from "./table.ts";
@@ -10,7 +10,7 @@ export interface LiveRouteDeps {
calls: Pick<LiveCallController, "start" | "end" | "current" | "deviceRevoked">;
resolveTarget(botId: string, threadId: string | undefined): { botId: string; botName: string; threadId: string } | null;
settings(): LiveSettings;
- saveSettings(patch: { voice?: string; readTypedReplies?: boolean; idleMinutes?: number }): Promise<LiveSettings>;
+ saveSettings(patch: { provider?: LiveProvider; azureEndpoint?: string; azureDeployment?: string; voice?: string; readTypedReplies?: boolean; idleMinutes?: number }): Promise<LiveSettings>;
}
const id = z.string().regex(/^[\w-]{1,120}$/);
@@ -24,6 +24,10 @@ const sessionBody = z.object({
const endBody = z.object({ callId: z.string().min(1).max(120) }).strict();
// Strict, so `key` is refused rather than ignored: the key is saved only through the credential store or PUT /api/config.
const settingsBody = z.object({
+ provider: z.enum(["openai", "azure"]).optional(),
+ // "" clears the field. Anything else must be an https Azure OpenAI host, since the key is sent there.
+ azureEndpoint: z.string().trim().max(300).refine((url) => url === "" || azureOpenAiRoot(url) !== null).optional(),
+ azureDeployment: z.string().trim().max(64).refine((name) => name === "" || azureLiveDeployment(name) === name).optional(),
voice: z.string().trim().max(40).regex(/^[a-z]*$/).optional(),
readTypedReplies: z.boolean().optional(),
idleMinutes: z.number().int().min(1).max(60).optional(),
@@ -87,6 +91,9 @@ export function createLiveRoutes(deps: LiveRouteDeps): RouteHandler {
if (method === "PATCH" && path === "/api/live/settings") {
const parsed = settingsBody.safeParse(await bodyOf(req, readBody));
if (!parsed.success) {
+ const field = parsed.error.issues[0]?.path[0];
+ if (field === "azureEndpoint") return json(res, 400, { error: "The Azure endpoint must be the https address of an Azure OpenAI resource, like https://my-resource.openai.azure.com." });
+ if (field === "azureDeployment") return json(res, 400, { error: "The Azure deployment name may use letters, digits, '-', '_' and '.', up to 64 characters." });
return json(res, 400, { error: "Those Live settings are not valid." });
}
if (!Object.keys(parsed.data).length) return json(res, 400, { error: "nothing to save" });
diff --git a/shared/live-call-wire.ts b/shared/live-call-wire.ts
index 1165bbfa5a..52ef27d3a2 100644
--- a/shared/live-call-wire.ts
+++ b/shared/live-call-wire.ts
@@ -45,14 +45,23 @@ export interface LiveCallRecord {
title?: string;
}
+/** Who runs a Live call's GPT-Live session: OpenAI itself, or a GPT-Live deployment on the user's own Azure OpenAI / Foundry resource. */
+export type LiveProvider = "openai" | "azure";
+
/** `live`: the key saved for Live calls only; `openai`: the OpenAI API key from Settings → API keys, used when there is no `live` key. */
export type LiveKeySource = "live" | "openai";
/** Non-secret Live settings, as GET /api/config and PATCH /api/live/settings report them. */
export interface LiveSettings {
- /** A Live call has a key to use (`keySource` says which); never the key itself. */
+ /** A Live call has everything it needs: a key (`keySource` says which; never the key itself) and, for Azure, a valid endpoint and deployment. */
configured: boolean;
keySource?: LiveKeySource;
+ /** Absent means "openai". With "azure" only the `live` key is used, never the OpenAI API key. */
+ provider?: LiveProvider;
+ /** The Azure resource endpoint as saved, e.g. `https://my-resource.openai.azure.com`. Not a secret. */
+ azureEndpoint?: string;
+ /** The Azure deployment of gpt-live-1; empty means "gpt-live-1". */
+ azureDeployment?: string;
voice: string;
readTypedReplies: boolean;
idleMinutes: number;
diff --git a/shared/wire.ts b/shared/wire.ts
index a53c5508b7..1d43b36544 100644
--- a/shared/wire.ts
+++ b/shared/wire.ts
@@ -32,7 +32,7 @@ import type { WebhookAttempt, WebhookTrigger } from "./webhooks.ts";
import type { PublishedPageCard } from "./published-page.ts";
import type { InboxItem, InboxTask } from "./inbox.ts";
import type { LiveCallRecord, LiveCallState } from "./live-call-wire.ts";
-export type { LiveCallRecord, LiveCallState, LiveCallStatus, LiveClient, LiveEndReason, LiveKeySource, LiveSettings } from "./live-call-wire.ts";
+export type { LiveCallRecord, LiveCallState, LiveCallStatus, LiveClient, LiveEndReason, LiveKeySource, LiveProvider, LiveSettings } from "./live-call-wire.ts";
/** Reasoning-effort levels, ascending: a union of what any engine accepts;
* each driver declares the subset its CLI will take. */
diff --git a/src/components/LiveCallSettings.tsx b/src/components/LiveCallSettings.tsx
index 9ab87a35b9..c851951be3 100644
--- a/src/components/LiveCallSettings.tsx
+++ b/src/components/LiveCallSettings.tsx
@@ -6,6 +6,7 @@ import { liveDisclosure } from "@/lib/call-mode";
import { api, useStore, type ConfigStatus } from "@/state/store";
import type { LiveSettings } from "../../shared/wire";
import { LiveKeySetup } from "./LiveKeySetup";
+import { LiveProviderSettings } from "./LiveProviderSettings";
import { KeysLink } from "./keys/KeysLink";
import { Select } from "./Select";
@@ -22,6 +23,7 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
const focusOnOpen = useCallback((dialog: HTMLDivElement | null) => {
dialog?.querySelector<HTMLElement>("select, input, button")?.focus();
}, []);
+ const azure = live.provider === "azure";
const voice = live.voice || "marin";
const known = LIVE_VOICE_OPTIONS.some((option) => option.id === voice);
@@ -66,6 +68,7 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
onClose();
}}
>
+ <LiveProviderSettings />
<label className="flex items-center justify-between gap-2">
<span className="text-ink-secondary">{t("call.live.voice")}</span>
<Select
@@ -104,7 +107,7 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
</Select>
</label>
<div className="flex items-center justify-between gap-2 border-t border-hairline/60 pt-2">
- <span className="text-ink-secondary">{t("call.live.key")}</span>
+ <span className="text-ink-secondary">{t(azure ? "call.live.azureKey" : "call.live.key")}</span>
<span className="flex gap-2">
<button type="button" className="text-accent hover:underline" onClick={() => setChangingKey((open) => !open)}>
{t("call.live.keyChange")}
@@ -116,11 +119,12 @@ export function LiveCallSettings({ onClose }: { onClose: () => void }) {
)}
</span>
</div>
- {live.keySource !== "live" && (
+ {live.keySource !== "live" && azure && <div className="-mt-2 text-[12px] text-ink-tertiary">{t("call.live.azureNeedsKey")}</div>}
+ {live.keySource !== "live" && !azure && (
<div className="-mt-2 text-[12px] text-ink-tertiary">{t(live.keySource === "openai" ? "call.live.keyFromApiKeys" : "call.live.needsKey")} <KeysLink id="openai" purpose="liveCalls" /></div>
)}
{changingKey && <LiveKeySetup compact onSaved={() => setChangingKey(false)} />}
- <div className="text-[12px] text-ink-tertiary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true })} {t("call.live.cost")}</div>
+ <div className="text-[12px] text-ink-tertiary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure })} {t(azure ? "call.live.azureCost" : "call.live.cost")}</div>
{error && <div className="text-[12px] text-danger">{error}</div>}
</div>
);
diff --git a/src/components/LiveKeyNeeded.test.ts b/src/components/LiveKeyNeeded.test.ts
index 36966e7fe6..10c73b9af9 100644
--- a/src/components/LiveKeyNeeded.test.ts
+++ b/src/components/LiveKeyNeeded.test.ts
@@ -2,9 +2,9 @@ import { Children, createElement, isValidElement, type ReactElement, type ReactN
import { renderToStaticMarkup } from "react-dom/server";
import { beforeEach, expect, it, vi } from "vitest";
-const f = vi.hoisted(() => ({ dispatch: vi.fn(), dismiss: vi.fn(), cloudHome: false }));
+const f = vi.hoisted(() => ({ dispatch: vi.fn(), dismiss: vi.fn(), cloudHome: false, live: undefined as Record<string, unknown> | undefined }));
vi.mock("react", async (original) => ({ ...await original<typeof import("react")>(), useId: () => "live-key-title" }));
-vi.mock("@/state/store", () => ({ useStore: () => ({ state: { config: { cloudHome: f.cloudHome } }, dispatch: f.dispatch }) }));
+vi.mock("@/state/store", () => ({ useStore: () => ({ state: { config: { cloudHome: f.cloudHome, live: f.live } }, dispatch: f.dispatch }), api: vi.fn() }));
vi.mock("@/lib/live-call-media", () => ({ dismissLiveNotice: f.dismiss }));
import { LiveKeyNeeded } from "./LiveKeyNeeded";
import { finishKeyFocus, useKeyFocus } from "./keys/key-focus";
@@ -12,6 +12,7 @@ import { finishKeyFocus, useKeyFocus } from "./keys/key-focus";
beforeEach(() => {
vi.clearAllMocks();
f.cloudHome = false;
+ f.live = undefined;
});
type Node = ReactElement<{ children?: ReactNode; onClick?: () => void }>;
@@ -40,3 +41,15 @@ it("opens Settings at the OpenAI key in Voice and calls, and puts the prompt awa
finishKeyFocus(request!);
expect(f.dismiss).toHaveBeenCalledOnce();
});
+
+it("with Azure chosen, asks for the endpoint, deployment and resource key in place, and names Azure rather than OpenAI", () => {
+ f.live = { configured: false, provider: "azure", azureEndpoint: "https://my-res.openai.azure.com", voice: "", readTypedReplies: true, idleMinutes: 5 };
+ const html = renderToStaticMarkup(createElement(LiveKeyNeeded));
+ expect(html).toContain("Live calls through Azure OpenAI need the resource endpoint");
+ expect(html).toContain('value="https://my-res.openai.azure.com"');
+ expect(html).toContain('placeholder="gpt-live-1"');
+ expect(html).toContain('aria-label="Azure OpenAI key for Live calls"');
+ expect(html).toContain("The Azure key stays on your computer.");
+ expect(html).not.toContain("Open API keys");
+ expect(html).not.toContain("OpenAI key stays");
+});
diff --git a/src/components/LiveKeyNeeded.tsx b/src/components/LiveKeyNeeded.tsx
index b3cb47e034..a9ad524b73 100644
--- a/src/components/LiveKeyNeeded.tsx
+++ b/src/components/LiveKeyNeeded.tsx
@@ -1,4 +1,4 @@
-import { useId } from "react";
+import { useEffect, useId } from "react";
import { KeyRound } from "lucide-react";
import { liveDisclosure } from "@/lib/call-mode";
@@ -6,16 +6,31 @@ import { dismissLiveNotice } from "@/lib/live-call-media";
import { t } from "@/lib/i18n";
import { useStore } from "@/state/store";
import { openKeySettings } from "./keys/key-focus";
+import { LiveKeySetup } from "./LiveKeySetup";
+import { LiveProviderSettings } from "./LiveProviderSettings";
export function LiveKeyNeeded() {
const { state, dispatch } = useStore();
const titleId = useId();
- return <section aria-labelledby={titleId} className="flex flex-col gap-2.5 rounded-xl border border-hairline bg-panel p-4 text-left">
+ const live = state.config?.live;
+ const azure = live?.provider === "azure";
+ return <section aria-labelledby={titleId} className="flex flex-col gap-2.5 rounded-xl border border-hairline bg-panel p-4 text-left text-[13px]">
<div className="flex items-start gap-2.5">
<KeyRound size={16} className="mt-0.5 shrink-0 text-ink-secondary" aria-hidden="true" />
- <h2 id={titleId} className="text-[14px] font-medium leading-[1.4] text-ink">{t("call.live.needsKey")}</h2>
+ <h2 id={titleId} className="text-[14px] font-medium leading-[1.4] text-ink">{t(azure ? "call.live.needsAzure" : "call.live.needsKey")}</h2>
</div>
- <button type="button" className="ui-button ui-button-primary self-start" onClick={() => { dismissLiveNotice(); dispatch(openKeySettings("openai", "liveCalls")); }}>{t("call.live.openApiKeys")}</button>
- <p className="text-[12px] leading-[1.45] text-ink-tertiary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true })} {t("call.live.cost")}</p>
+ <LiveProviderSettings />
+ {azure && <DismissWhenReady ready={live?.configured === true} />}
+ {azure
+ ? live?.keySource !== "live" && <LiveKeySetup compact onSaved={() => {}} />
+ : <button type="button" className="ui-button ui-button-primary self-start" onClick={() => { dismissLiveNotice(); dispatch(openKeySettings("openai", "liveCalls")); }}>{t("call.live.openApiKeys")}</button>}
+ <p className="text-[12px] leading-[1.45] text-ink-tertiary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure })} {t(azure ? "call.live.azureCost" : "call.live.cost")}</p>
</section>;
}
+
+function DismissWhenReady({ ready }: { ready: boolean }) {
+ useEffect(() => {
+ if (ready) dismissLiveNotice();
+ }, [ready]);
+ return null;
+}
diff --git a/src/components/LiveKeySetup.tsx b/src/components/LiveKeySetup.tsx
index fa136f0298..da789eb21f 100644
--- a/src/components/LiveKeySetup.tsx
+++ b/src/components/LiveKeySetup.tsx
@@ -7,6 +7,7 @@ import { t } from "@/lib/i18n";
export function LiveKeySetup({ onSaved, compact = false }: { onSaved: () => void; compact?: boolean }) {
const { state, dispatch } = useStore();
+ const azure = state.config?.live?.provider === "azure";
const [key, setKey] = useState("");
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -46,17 +47,17 @@ export function LiveKeySetup({ onSaved, compact = false }: { onSaved: () => void
void save();
}}
>
- <div className="text-[14px] font-medium text-ink">{t("call.live.keyTitle")}</div>
- <div className="text-[13px] leading-[1.45] text-ink-secondary">{t("call.live.keyExplain")}</div>
- <div className="text-[13px] leading-[1.45] text-ink-secondary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true })}</div>
+ <div className="text-[14px] font-medium text-ink">{t(azure ? "call.live.azureKeyTitle" : "call.live.keyTitle")}</div>
+ <div className="text-[13px] leading-[1.45] text-ink-secondary">{t(azure ? "call.live.azureKeyExplain" : "call.live.keyExplain")}</div>
+ <div className="text-[13px] leading-[1.45] text-ink-secondary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure })}</div>
<input
type="password"
autoComplete="off"
spellCheck={false}
value={key}
onChange={(event) => setKey(event.target.value)}
- placeholder="sk-…"
- aria-label={t("call.live.keyField")}
+ placeholder={azure ? "…" : "sk-…"}
+ aria-label={t(azure ? "call.live.azureKeyField" : "call.live.keyField")}
className="rounded-lg border border-hairline bg-inset px-3 py-2 text-[13px] text-ink outline-none focus:border-accent/60"
/>
{error && <div className="text-[12px] text-danger">{error}</div>}
diff --git a/src/components/LiveProviderSettings.tsx b/src/components/LiveProviderSettings.tsx
new file mode 100644
index 0000000000..ee27ac3f80
--- /dev/null
+++ b/src/components/LiveProviderSettings.tsx
@@ -0,0 +1,97 @@
+import { useState } from "react";
+
+import { t } from "@/lib/i18n";
+import { api, useStore } from "@/state/store";
+import type { LiveProvider, LiveSettings } from "../../shared/wire";
+import { Select } from "./Select";
+
+type ProviderPatch = Partial<Pick<LiveSettings, "provider" | "azureEndpoint" | "azureDeployment">>;
+
+const FIELD = "w-full rounded-lg border border-hairline bg-inset px-2.5 py-1.5 text-[13px] text-ink outline-none focus:border-accent/60";
+
+export function LiveProviderSettings() {
+ const { state, dispatch } = useStore();
+ const live: LiveSettings = state.config?.live ?? { configured: false, voice: "", readTypedReplies: true, idleMinutes: 5 };
+ const provider: LiveProvider = live.provider ?? "openai";
+ const [endpoint, setEndpoint] = useState(live.azureEndpoint ?? "");
+ const [deployment, setDeployment] = useState(live.azureDeployment ?? "");
+ const [saving, setSaving] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const azureChanged = endpoint.trim() !== (live.azureEndpoint ?? "") || deployment.trim() !== (live.azureDeployment ?? "");
+
+ const save = async (patch: ProviderPatch) => {
+ setSaving(true);
+ setError(null);
+ try {
+ const body = await api<{ live: LiveSettings }>("/api/live/settings", { method: "PATCH", body: JSON.stringify(patch) });
+ if (state.config) dispatch({ type: "configStatus", config: { ...state.config, live: body.live } });
+ } catch (saveError) {
+ setError(saveError instanceof Error ? saveError.message : String(saveError));
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ return (
+ <div className="flex flex-col gap-2">
+ <label className="flex items-center justify-between gap-2">
+ <span className="text-ink-secondary">{t("call.live.provider")}</span>
+ <Select
+ size="sm"
+ value={provider}
+ disabled={saving}
+ onChange={(event) => void save({ provider: event.target.value as LiveProvider })}
+ >
+ <option value="openai">{t("call.live.provider.openai")}</option>
+ <option value="azure">{t("call.live.provider.azure")}</option>
+ </Select>
+ </label>
+ {provider === "azure" && (
+ <form
+ className="flex flex-col gap-2"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void save({ azureEndpoint: endpoint.trim(), azureDeployment: deployment.trim() });
+ }}
+ >
+ <label className="flex flex-col gap-1">
+ <span className="text-[12px] text-ink-secondary">{t("call.live.azureEndpoint")}</span>
+ <input
+ type="url"
+ inputMode="url"
+ autoComplete="off"
+ spellCheck={false}
+ value={endpoint}
+ placeholder="https://my-resource.openai.azure.com"
+ onChange={(event) => setEndpoint(event.target.value)}
+ className={FIELD}
+ />
+ </label>
+ <label className="flex flex-col gap-1">
+ <span className="text-[12px] text-ink-secondary">{t("call.live.azureDeployment")}</span>
+ <input
+ type="text"
+ autoComplete="off"
+ spellCheck={false}
+ value={deployment}
+ placeholder="gpt-live-1"
+ onChange={(event) => setDeployment(event.target.value)}
+ className={FIELD}
+ />
+ </label>
+ <div className="text-[12px] text-ink-tertiary">{t("call.live.azureHint")}</div>
+ {azureChanged && (
+ <button
+ type="submit"
+ disabled={saving}
+ className="self-start rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50"
+ >
+ {t("common.save")}
+ </button>
+ )}
+ </form>
+ )}
+ {error && <div className="text-[12px] text-danger">{error}</div>}
+ </div>
+ );
+}
diff --git a/src/lib/call-mode.ts b/src/lib/call-mode.ts
index f5f7da6590..dd33454bf7 100644
--- a/src/lib/call-mode.ts
+++ b/src/lib/call-mode.ts
@@ -10,7 +10,8 @@ export const CALL_MODES: ReadonlyArray<{ id: CallMode; label: LocaleKey }> = [
{ id: "live", label: "call.mode.live" },
];
-export function liveDisclosure({ cloudHome = false }: { cloudHome?: boolean } = {}): string {
+export function liveDisclosure({ cloudHome = false, azure = false }: { cloudHome?: boolean; azure?: boolean } = {}): string {
+ if (azure) return t(cloudHome ? "call.live.disclosureAzureCloud" : "call.live.disclosureAzure");
return t(cloudHome ? "call.live.disclosureCloud" : "call.live.disclosure");
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 16b2cc5ebf..2fe854f1c2 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -6224,6 +6224,21 @@
"call.live.keySaveAndCall": "Save and start the call",
"call.live.needsKey": "Live calls use your own OpenAI key. Add it in Settings → API keys.",
"call.live.openApiKeys": "Open API keys",
+ "call.live.provider": "Service",
+ "call.live.provider.openai": "OpenAI",
+ "call.live.provider.azure": "Azure OpenAI",
+ "call.live.azureEndpoint": "Azure resource endpoint",
+ "call.live.azureDeployment": "GPT-Live deployment name",
+ "call.live.azureHint": "Deploy gpt-live-1 on your Azure OpenAI or Foundry resource, then paste the resource endpoint and the deployment name. An empty name means gpt-live-1.",
+ "call.live.azureKey": "Azure key",
+ "call.live.azureNeedsKey": "Add the key of your Azure OpenAI resource with Change key.",
+ "call.live.azureKeyTitle": "Live calls through Azure OpenAI",
+ "call.live.azureKeyExplain": "Paste a key of the Azure OpenAI resource that hosts your GPT-Live deployment (Keys and Endpoint in the Azure portal). Azure bills the call to that resource; the bot's own work is billed as usual.",
+ "call.live.azureKeyField": "Azure OpenAI key for Live calls",
+ "call.live.azureCost": "Via GPT-Live on your Azure OpenAI resource, billed by Azure.",
+ "call.live.needsAzure": "Live calls through Azure OpenAI need the resource endpoint, the GPT-Live deployment name and its key.",
+ "call.live.disclosureAzure": "A Live call sends your voice to your Azure OpenAI resource, along with the chat's recent messages, the bot's answers and the details of any approval it asks for. The Azure key stays on your computer.",
+ "call.live.disclosureAzureCloud": "A Live call sends your voice to your Azure OpenAI resource, along with the chat's recent messages, the bot's answers and the details of any approval it asks for. The Azure key stays in the Cloud.",
"call.live.keyFromApiKeys": "Uses your OpenAI API key from Settings → API keys.",
"settings.group.you": "You",
"settings.group.ai": "AI",