Skip to content

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

Add Codex sign-in for macOS Live calls

Thang Le33d0706c953f
diff --git a/apps/docs/content/docs/features/voice-and-memory.mdx b/apps/docs/content/docs/features/voice-and-memory.mdx
index d6f5bd48cb..da4346bc5d 100644
--- a/apps/docs/content/docs/features/voice-and-memory.mdx
+++ b/apps/docs/content/docs/features/voice-and-memory.mdx
@@ -68,13 +68,15 @@ A message typed during a call is answered by the bot, and the voice reads that a
A Live call hangs up after 5 minutes in which nobody speaks and the bot is not working (the gear changes the minutes). It drops if its audio does not connect within 20 seconds, and on a phone it ends when you switch away from the app or lock the phone. It also ends at once when the phone that started it is unpaired, or the sign-in that started it is signed out or revoked. Voice notes do not play while you are on a Live call.
-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 speech-to-text needed), and are for one bot at a time. Room calls always take turns.
+Live calls through OpenAI work from the desktop app, a web browser or your phone. 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 speech-to-text needed), and are for one bot at a time. Room calls always take turns.
+
+**Live calls through Codex on macOS.** On **This computer**, open **Settings → AI → Voice and calls** and choose **Codex (ChatGPT sign-in)** as the **Service**. This uses the ChatGPT account already signed in to Codex CLI. Update Codex CLI if it does not support voice. The call uses that sign-in for audio, and the bot handles spoken requests in the current chat with its selected AI. This service sends your microphone audio and the bot’s spoken replies to OpenAI. Previous chat messages stay out of the voice session at startup. Approve actions in the chat. The Codex service is available in the local macOS app.
**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. Azure bills the call to that resource. The OpenAI API key is never used for Azure. A saved Live key goes only to the service it was saved for and, on Azure, to that endpoint's host: changing the **Service** or the endpoint's host asks for the key again, even if you change it back. Calls go only to an `https` address on `*.openai.azure.com`, `*.services.ai.azure.com`, `*.cognitiveservices.azure.com`, `*.openai.azure.us`, `*.openai.azure.cn` or `*.azure-api.net` (API Management); any other address is refused, and so is a redirect. 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); set together there, the key belongs to that endpoint. With Azure, everything below that goes to OpenAI goes to your Azure resource instead.
**Who can make a call through Azure.** Only an admin, or the owner of a server one person uses. Azure does not accept the setting that limits the caller's app to hanging up, so on an Azure call that app's connection to the voice is wider, and could carry the bot's instructions. Everyone else, such as a User on a Team Cloud or someone who is not an admin on a shared company workspace, reads "Live calls here go through Azure OpenAI, so only an admin or the owner of this server can start one. Ask an admin if you need a call." No call starts, and it never goes through OpenAI 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.
+**What an API-key Live call sends to OpenAI.** A Live call through the OpenAI API 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 a766b2df45..74f7075d9a 100644
--- a/docs/verification/live-calls.md
+++ b/docs/verification/live-calls.md
@@ -53,6 +53,25 @@ 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.
+## Codex sign-in on macOS
+
+The local macOS desktop app offers **Codex (ChatGPT sign-in)** in its existing
+**Service** picker. The server accepts this service from the authenticated
+desktop only. The saved setting leaves the previous service and its key in the
+existing configuration fields so an earlier release can read them.
+
+```sh
+pnpm exec vitest run server/live-codex.test.ts server/live-call-controller.test.ts server/live-settings.test.ts server/routes/live.test.ts
+```
+
+The Codex CLI fixture negotiates WebRTC SDP through a fake app-server. It
+checks that API-key sign-in and active tools are refused, the ephemeral thread
+has no tool environment or startup chat context, only the call's user
+transcript is relayed, and the process stops on hang-up. The controller checks
+that the transcript reaches the requested bot and thread and a spoken
+approval leaves the approval card for the person to handle in chat. These
+checks use a disposable home and synthetic SDP and do not use a microphone.
+
## Azure OpenAI as the Live provider
With `live.provider: "azure"` (`OMB_LIVE_PROVIDER=azure`) a call creates its
diff --git a/packages/phone-protocol/src/live-call-wire.ts b/packages/phone-protocol/src/live-call-wire.ts
index 90367e23cd..09eff0877f 100644
--- a/packages/phone-protocol/src/live-call-wire.ts
+++ b/packages/phone-protocol/src/live-call-wire.ts
@@ -59,7 +59,7 @@ export interface LiveCallRecord {
* the Gemini Live API on the person's Gemini key, which the client reaches with a single-use token the harness creates, or an
* ElevenLabs agent the harness sets up on the person's ElevenLabs account, which the client reaches with a signed URL, or
* "custom": an OpenAI-compatible server the person names (a gateway that serves the GPT-Live API), reached like OpenAI. */
-export type LiveProvider = "openai" | "azure" | "fish" | "gemini" | "elevenlabs" | "custom";
+export type LiveProvider = "openai" | "azure" | "fish" | "gemini" | "elevenlabs" | "custom" | "codex";
/** `live`: the key saved for Live calls only; `openai`: the OpenAI API key from Settings → API keys, used when there is no `live` key;
* `fishAudio`: the Fish Audio key from Settings → API keys, the only key a Fish Audio call uses;
diff --git a/server/index.ts b/server/index.ts
index 2d5930c9d1..b8e6b425f9 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -322,7 +322,7 @@ import { createDecider, deciderReady, describeDecider } from "./decider/index.ts
import { createStopLineRoutes } from "./routes/stop-line.ts"; import { createSuggestedReplyRoutes } from "./routes/suggested-reply.ts"; import { lightModelFor } from "./suggested-reply/light-model.ts"; import { createSkillBurgerRoutes } from "./skill-burger/routes.ts"; import { migrateBotBurgers, skillBurgerEnabled } from "./skill-burger/store.ts"; import { createSkillBurgerRuns } from "./skill-burger/runs.ts"; import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";
import { autoRoomDefault, roomTurnMembers } from "./room-routing-members.ts";
import { liveHistoryFrom, LiveSessionError, type LiveBot, type LiveHistoryMessage } from "./live-call.ts";
-import { LiveCallController, LiveCallSignedOutError } from "./live-call-controller.ts"; import { liveSessionWiring } from "./live-session-wiring.ts";
+import { localLiveCodex } from "./live-codex.ts"; import { LiveCallController, LiveCallSignedOutError } from "./live-call-controller.ts"; import { liveSessionWiring } from "./live-session-wiring.ts";
import { liveCallSettings, liveSettingsFor, liveSettingsForClient, saveLiveSettings } from "./live-settings.ts"; import { azureLiveCallRefusal, liveScopeRefusal } from "./live-access.ts";
import { recordLiveCall, spokenLineFields, titleLiveCall } from "./live-call-record.ts"; import { finalTurnBlock, noteGroupTurn, roomRoundPasses, roomTurnsPerMember, turnsPerMemberPatch, turnsSince } from "./room-round-turns.ts";
import { narrateTool, toUtterances } from "./tts/speech-text.ts";
@@ -12296,7 +12296,7 @@ function liveCallTitle(botId: string, threadId: string, excerpt: string): Promis
const gate = threadTitleGate(bot);
return gate.ok ? generateThreadTitle(gate.instance, excerpt, "call") : null;
}
-const liveWiring = liveSessionWiring({ bot: liveBotFor, history: liveHistoryFor, cloudHome: Boolean(CLOUD_HOME), othersOnLoopback: adminActivityRecording, saveAgent: (agent) => { saveConfig({ live: agent }); Object.assign(cfg, loadConfig()); }, language: appLanguage, fishAgentLanguage: () => cfg.live?.fishAgentLanguage });
+const liveWiring = liveSessionWiring({ codex: () => localLiveCodex(cfg, DESKTOP_MANAGED && !CLOUD_HOME && !HOSTED_WORKSPACE), bot: liveBotFor, history: liveHistoryFor, cloudHome: Boolean(CLOUD_HOME), othersOnLoopback: adminActivityRecording, saveAgent: (agent) => { saveConfig({ live: agent }); Object.assign(cfg, loadConfig()); }, language: appLanguage, fishAgentLanguage: () => cfg.live?.fishAgentLanguage });
const liveCalls = new LiveCallController({
store,
send: async ({ auth, botId, threadId, text, callId }) => {
diff --git a/server/live-access.ts b/server/live-access.ts
index d4004581dc..d777bd6162 100644
--- a/server/live-access.ts
+++ b/server/live-access.ts
@@ -1,8 +1,11 @@
// Who may hold a Live call through Azure OpenAI, a custom endpoint, Fish Audio, Gemini or ElevenLabs. LIVE_DATA_CHANNEL in live-call.ts says why Azure is
// limited; on the relayed providers the harness hears the call only through its client's own reports (FishRelay in live-fish.ts).
+import type { LiveClient } from "../shared/wire.ts";
import type { AppConfig } from "./config.ts";
import type { RequestAuth } from "./request-auth.ts";
+import { liveProvider } from "./live-config.ts";
+export const LIVE_CODEX_REFUSAL = "Codex Live calls require the local macOS app with Codex set up in Settings → AI.";
export const LIVE_AZURE_REFUSAL = "Live calls here go through Azure OpenAI, so only an admin or the owner of this server can start one. Ask an admin if you need a call.";
export const LIVE_CUSTOM_REFUSAL = "Live calls here go through a custom endpoint, so only an admin or the owner of this server can start one. Ask an admin if you need a call.";
export const LIVE_FISH_REFUSAL = "Live calls here go through Fish Audio, so only an admin or the owner of this server can start one. Ask an admin if you need a call.";
@@ -36,10 +39,15 @@ export function elevenLabsLiveCallRefusal(auth: RequestAuth, place: LiveCallPlac
return azureLiveCallRefusal(auth, place, LIVE_ELEVENLABS_REFUSAL);
}
+export function codexLiveCallRefusal(auth: RequestAuth, local: boolean, client: LiveClient = "desktop"): string | null {
+ return local && client === "desktop" && auth.kind === "loopback" && !auth.companionDevice && auth.trust !== "service" && auth.scopes.includes("admin")
+ ? null : LIVE_CODEX_REFUSAL;
+}
+
/** The words for a session without the admin scope, which never reaches a Live route. Only the words: the request is refused either way. */
export function liveScopeRefusal(cfg: Pick<AppConfig, "live">, method: string, path: string): string | null {
if (method.toUpperCase() !== "POST" || path !== "/api/live/session") return null;
- const provider = cfg.live?.provider;
- return provider === "azure" ? LIVE_AZURE_REFUSAL : provider === "fish" ? LIVE_FISH_REFUSAL : provider === "gemini" ? LIVE_GEMINI_REFUSAL
+ const provider = liveProvider(cfg.live);
+ return provider === "codex" ? LIVE_CODEX_REFUSAL : provider === "azure" ? LIVE_AZURE_REFUSAL : provider === "fish" ? LIVE_FISH_REFUSAL : provider === "gemini" ? LIVE_GEMINI_REFUSAL
: provider === "elevenlabs" ? LIVE_ELEVENLABS_REFUSAL : provider === "custom" ? LIVE_CUSTOM_REFUSAL : null;
}
diff --git a/server/live-call-controller.test.ts b/server/live-call-controller.test.ts
index c1c4c0262d..207c265aac 100644
--- a/server/live-call-controller.test.ts
+++ b/server/live-call-controller.test.ts
@@ -99,6 +99,29 @@ describe("LiveCallController lifecycle", () => {
expect(t.frames.map((f) => f?.status)).toEqual(["connecting", "live"]);
});
+ it("uses Codex without an API key and refuses a phone before starting the session", async () => {
+ const endpoint: LiveEndpoint = { provider: "codex", apiBase: "", model: "" };
+ const t = setup({
+ settings: () => ({ provider: "codex", key: "", endpoint, voice: "marin", readTypedReplies: true, idleMinutes: 5 }),
+ codexRefusal: (_auth, client) => client === "desktop" ? null : "Desktop only.",
+ });
+ await expect(t.controller.start({ auth: owner, ...BOT, client: "ios", sdp: "offer-sdp" })).rejects.toMatchObject({ status: 403 });
+ expect(t.deps.createSession).not.toHaveBeenCalled();
+ await t.start();
+ expect(t.deps.createSession).toHaveBeenCalledWith({ key: "", endpoint, sdp: "offer-sdp", botId: "bot1", threadId: "t1", voice: "juniper" });
+ t.socket().receive({ type: "session.input_transcript.delta", delta: "Calculate 17 times 23", start_ms: 10, end_ms: 20 });
+ t.socket().receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-1" }, offset_ms: 20 });
+ await vi.advanceTimersByTimeAsync(DELEGATION_SETTLE_MS);
+ expect(t.deps.send).toHaveBeenCalledWith(expect.objectContaining({ botId: BOT.botId, threadId: BOT.threadId, text: "Calculate 17 times 23" }));
+ t.message({ id: "approval", kind: "options", card: { title: "Approval needed", subtitle: "echo hello", options: ["Allow", "Deny"], requestId: "r1", tool: "Bash" } });
+ await vi.advanceTimersByTimeAsync(0);
+ t.socket().receive({ type: "session.input_transcript.delta", delta: "yes", start_ms: 2000, end_ms: 2100 });
+ t.socket().receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-2" }, offset_ms: 2100 });
+ await vi.advanceTimersByTimeAsync(CONSENT_SETTLE_MS + DELEGATION_SETTLE_MS);
+ expect(t.deps.respond).not.toHaveBeenCalled();
+ expect(t.deps.send).toHaveBeenCalledTimes(1);
+ });
+
it("speaks in the called bot's own Live voice; a bot without one keeps the app's", async () => {
const voices: Record<string, string> = { bot1: "cedar" };
const own = setup({ botVoice: (botId) => voices[botId] });
diff --git a/server/live-call-controller.ts b/server/live-call-controller.ts
index 520a06ebae..d82f6460be 100644
--- a/server/live-call-controller.ts
+++ b/server/live-call-controller.ts
@@ -9,7 +9,7 @@ import { signInWaits } from "../shared/sign-in-request.ts";
import type { LiveCallRecord, LiveCallState, LiveClient, LiveElevenLabsTransport, LiveEndReason, LiveFishTransport, LiveGeminiTransport, LiveProvider } from "../shared/wire.ts";
import { FISH_AGENT_VOICE } from "./live-fish.ts";
import { LIVE_NEEDS_KEY, liveAuthHeaders, liveCallSummaryLine, liveProviderName, LiveSessionError, liveVoice, spokenHangUp, type LiveEndpoint } from "./live-call.ts";
-import { LIVE_CUSTOM_REFUSAL } from "./live-access.ts";
+import { LIVE_CODEX_REFUSAL, LIVE_CUSTOM_REFUSAL } from "./live-access.ts";
import { scrubHeldSecrets } from "./redact.ts";
import type { RequestAuth } from "./request-auth.ts";
import type { Message, StoreChange } from "./store.ts";
@@ -42,7 +42,7 @@ export interface LiveSocket {
}
export type LiveActivity = "idle" | "working" | "waiting";
-export type LiveSessionAnswer = { sessionId: string; sdp: string } | { sessionId: string; fish: LiveFishTransport } | { sessionId: string; gemini: LiveGeminiTransport }
+export type LiveSessionAnswer = { sessionId: string; sdp: string; socket?: LiveSocket } | { sessionId: string; fish: LiveFishTransport } | { sessionId: string; gemini: LiveGeminiTransport }
| { sessionId: string; elevenlabs: LiveElevenLabsTransport };
export type LiveCallStarted =
| { call: LiveCallState; sdp: string; fish?: undefined; gemini?: undefined; elevenlabs?: undefined }
@@ -77,6 +77,7 @@ export interface LiveCallDeps {
botVoice?(botId: string): string | undefined;
/** Why this caller may not hold a call through Azure OpenAI; null when they may. Required, so no wiring can leave it out. */
azureRefusal(auth: RequestAuth): string | null;
+ codexRefusal?(auth: RequestAuth, client: LiveClient): string | null;
/** The same for the relayed providers, where the harness hears the call only through its client's reports. Required too. */
fishRefusal(auth: RequestAuth): string | null;
geminiRefusal(auth: RequestAuth): string | null;
@@ -186,8 +187,16 @@ export class LiveCallController {
return this.call && this.call.state.status !== "ended" ? { ...this.call.state } : null;
}
+ codexRefusal(auth: RequestAuth, client: LiveClient = "desktop"): string | null {
+ return this.deps.codexRefusal ? this.deps.codexRefusal(auth, client) : LIVE_CODEX_REFUSAL;
+ }
+
async start(input: { auth: RequestAuth; device?: string; botId: string; botName: string; threadId: string; client: LiveClient; sdp?: string; relays?: readonly LiveRelayClient[] }): Promise<LiveCallStarted> {
const settings = this.deps.settings();
+ if (settings.provider === "codex") {
+ const refusal = this.codexRefusal(input.auth, input.client);
+ if (refusal) throw new LiveSessionError(refusal, 403);
+ }
// First: someone refused here is not told about a running call, or sent to set Azure or a relayed service up.
// The chosen relayed service comes before a key's endpoint, so its refusal and its mismatch check apply.
const relayedChoice = relayedProvider(settings.provider);
@@ -212,10 +221,10 @@ export class LiveCallController {
if (input.device && this.revokedDevices.has(input.device)) throw new LiveCallSignedOutError();
const key = settings.key.trim();
const endpoint = settings.endpoint;
- if (settings.setupProblem || !key || !endpoint) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
+ if (settings.setupProblem || !endpoint || (!key && endpoint.provider !== "codex")) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
if (relayed !== relayedProvider(endpoint.provider)) throw new LiveSessionError(settings.setupProblem || LIVE_NEEDS_KEY, 409);
const botVoice = this.deps.botVoice?.(input.botId);
- const voice = relayed === "gemini" ? geminiLiveVoice(botCallVoice(botVoice, settings.geminiVoice, true))
+ const voice = endpoint.provider === "codex" ? "juniper" : relayed === "gemini" ? geminiLiveVoice(botCallVoice(botVoice, settings.geminiVoice, true))
: relayed ? FISH_AGENT_VOICE : liveVoice(botCallVoice(botVoice, settings.voice, false));
const call = this.newCall(input, key, endpoint, voice);
// Taken before the first await: a second start in the same tick is refused.
@@ -228,8 +237,10 @@ export class LiveCallController {
this.deps.log(`[live] call failed bot=${input.botId} client=${input.client} status=${error instanceof LiveSessionError ? error.status : "error"}`);
throw error;
}
+ const socket = "socket" in session ? session.socket : undefined;
if (this.call !== call) {
- this.closeOrphan(session.sessionId, key, endpoint);
+ if (socket) socket.close();
+ else this.closeOrphan(session.sessionId, key, endpoint);
throw new LiveSessionError("The call was cancelled.", 503);
}
try {
@@ -244,11 +255,14 @@ export class LiveCallController {
// Set before attach: a sideband that fails at once runs finish, which clears this interval.
call.idleTimer = setInterval(() => this.guarded(call, () => this.checkIdle(call)), IDLE_CHECK_MS);
call.idleTimer.unref?.();
- this.attach(call);
+ this.attach(call, socket);
} catch (error) {
const sidebandOpened = call.socket !== null;
this.finish(call, "error", "The call could not start.");
- if (!sidebandOpened) this.closeOrphan(session.sessionId, key, endpoint);
+ if (!sidebandOpened) {
+ if (socket) socket.close();
+ else this.closeOrphan(session.sessionId, key, endpoint);
+ }
throw error;
}
const state = { ...call.state };
@@ -335,10 +349,10 @@ export class LiveCallController {
};
}
- private attach(call: Call): void {
+ private attach(call: Call, connected?: LiveSocket): void {
let socket: LiveSocket;
try {
- socket = this.deps.openSocket(this.deps.attachUrl(call.sessionId, call.endpoint), call.key, call.endpoint);
+ socket = connected ?? 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 ${liveProviderName(call.endpoint.provider)}.`);
return;
@@ -365,6 +379,10 @@ export class LiveCallController {
if (call.pendingEnd) this.finish(call, call.pendingEnd);
else this.finish(call, "sideband-lost", `The call connection to ${liveProviderName(call.endpoint.provider)} dropped.`);
};
+ if (connected) {
+ if (socket.readyState === SOCKET_OPEN) socket.onopen(undefined);
+ else socket.onclose(undefined);
+ }
}
private closeOrphan(sessionId: string, key: string, endpoint: LiveEndpoint): void {
@@ -498,7 +516,7 @@ export class LiveCallController {
call.transcript.addInput(String(event.delta ?? ""), Number(event.start_ms), Number(event.end_ms));
call.heardThroughMs = Math.max(call.heardThroughMs, Number(event.end_ms) || 0);
this.touch(call);
- if (call.approval && !call.approval.submitted) this.scheduleConsentCheck(call);
+ if (call.endpoint.provider !== "codex" && call.approval && !call.approval.submitted) this.scheduleConsentCheck(call);
return;
case "session.output_transcript.delta":
call.transcript.addOutput(Number(event.start_ms), Number(event.end_ms));
@@ -537,7 +555,7 @@ export class LiveCallController {
private async delegate(call: Call, id: string, offsetMs: number): Promise<void> {
if (call.state.status !== "live" || call.goodbye) return;
- const heard = call.transcript.takeRequestParts(offsetMs);
+ const heard = call.transcript.takeRequestParts(offsetMs, call.endpoint.provider === "codex" ? 0 : undefined);
const said = heard.text;
// Only the person's own words, never what the voice said back, and all of them: "don't" may be lost in the echo.
if (spokenHangUp(heard.withoutEcho) && spokenHangUp(said)) {
@@ -547,7 +565,8 @@ export class LiveCallController {
return;
}
if (call.approval && !call.approval.submitted) {
- await this.decide(call, heard.withoutEcho, id, said);
+ if (call.endpoint.provider === "codex") this.append(call, "commentary", "Answer the approval request in the chat.", id);
+ else await this.decide(call, heard.withoutEcho, id, said);
return;
}
const question = call.question;
@@ -782,7 +801,8 @@ export class LiveCallController {
} else if (kind === "approval") {
call.approval = { requestId: card.requestId, messageId: message.id, submitted: false };
call.transcript.consumeAll();
- this.append(call, "instructions", LIVE_COPY.permissionRequest(spokenApprovalPrompt(card)));
+ const prompt = call.endpoint.provider === "codex" ? "The bot needs approval. Review the request in the chat." : LIVE_COPY.permissionRequest(spokenApprovalPrompt(card));
+ this.append(call, "instructions", prompt);
} else {
call.question = { requestId: card.requestId, messageId: message.id, submitted: false };
call.transcript.consumeAll();
diff --git a/server/live-call.ts b/server/live-call.ts
index f00f582834..b1631f4d36 100644
--- a/server/live-call.ts
+++ b/server/live-call.ts
@@ -56,7 +56,7 @@ export interface LiveEndpoint {
export function liveProviderName(provider: LiveProvider): string {
return provider === "azure" ? "Azure OpenAI" : provider === "fish" ? "Fish Audio" : provider === "gemini" ? "Gemini" : provider === "elevenlabs" ? "ElevenLabs"
- : provider === "custom" ? "The custom endpoint" : "OpenAI";
+ : provider === "codex" ? "Codex" : provider === "custom" ? "The custom endpoint" : "OpenAI";
}
/** Only a loopback http URL is accepted, read at call time. */
diff --git a/server/live-codex.test.ts b/server/live-codex.test.ts
new file mode 100644
index 0000000000..35d898a3a5
--- /dev/null
+++ b/server/live-codex.test.ts
@@ -0,0 +1,74 @@
+import { existsSync, mkdtempSync, readFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { afterEach, beforeEach, expect, it } from "vitest";
+import { createCodexLiveSession } from "./live-codex.ts";
+import { removeTempDir } from "./testing/cleanup.ts";
+
+const cli = fileURLToPath(new URL("./testing/fake-codex-live-cli.ts", import.meta.url));
+let dir: string;
+let receipt: string;
+let close: (() => void) | undefined;
+
+beforeEach(() => {
+ dir = mkdtempSync(join(tmpdir(), "mausbot-live-codex-test-"));
+ receipt = join(dir, "requests.ndjson");
+});
+
+afterEach(() => {
+ close?.();
+ close = undefined;
+ removeTempDir(dir);
+});
+
+function start(mode: string) {
+ return createCodexLiveSession({ cli, sdp: "v=0\r\noffer", voice: "juniper", environment: {
+ CODEX_HOME: dir, FAKE_CODEX_LIVE_MODE: mode, FAKE_CODEX_LIVE_RECEIPT: receipt, OPENAI_API_KEY: "synthetic-key",
+ } });
+}
+
+function requests() {
+ return existsSync(receipt) ? readFileSync(receipt, "utf8").trim().split("\n").map((line) => JSON.parse(line)) : [];
+}
+
+it("negotiates WebRTC with the CLI login, relays user speech and stops the isolated call", async () => {
+ const { socket, sdp } = await start("mcp");
+ close = socket.close;
+ expect(sdp).toBe("v=0\r\nanswer");
+ expect(socket.readyState).toBe(1);
+ const events: Array<{ type: string; delta?: string }> = [];
+ await new Promise<void>((resolve) => {
+ socket.onmessage = ({ data }) => {
+ const event = JSON.parse(String(data));
+ events.push(event);
+ if (event.type === "session.delegation.created") socket.send('{"type":"session.close"}');
+ if (event.type === "session.closed") resolve();
+ };
+ socket.send(JSON.stringify({ type: "session.commentary.append", content: "The answer is 391." }));
+ });
+ expect(events.map(({ type }) => type)).toEqual(["session.input_transcript.delta", "session.delegation.created", "session.closed"]);
+ expect(events[0]?.delta).toBe("Calculate seventeen times twenty-three");
+ const sent = requests();
+ expect(sent.every(({ hasApiKey }) => !hasApiKey)).toBe(true);
+ expect(new Set(sent.filter(({ method }) => method === "config/read").map(({ pid }) => pid)).size).toBe(2);
+ expect(sent.filter(({ method }) => method === "thread/start")).toMatchObject([{ params: {
+ ephemeral: true, environments: [], sandbox: "read-only", approvalPolicy: "never",
+ } }]);
+ expect(sent).toContainEqual(expect.objectContaining({ method: "thread/realtime/start", params: expect.objectContaining({
+ includeStartupContext: false, transport: { type: "webrtc", sdp: "v=0\r\noffer" },
+ }) }));
+ expect(sent).toContainEqual(expect.objectContaining({ method: "thread/realtime/appendSpeech", params: {
+ threadId: "synthetic-thread", text: "The answer is 391.",
+ } }));
+ expect(sent).toContainEqual(expect.objectContaining({ method: "thread/realtime/stop" }));
+});
+
+it.each([["api-key", 401], ["unsafe", 502]] as const)("refuses %s before starting a voice thread", async (mode, status) => {
+ await expect(start(mode)).rejects.toMatchObject({ status });
+ expect(requests().map(({ method }) => method)).not.toContain("thread/start");
+});
+
+it("propagates a refused realtime start without leaving a call open", async () => {
+ await expect(start("unsupported")).rejects.toMatchObject({ status: 502 });
+});
diff --git a/server/live-codex.ts b/server/live-codex.ts
new file mode 100644
index 0000000000..89e0fb679e
--- /dev/null
+++ b/server/live-codex.ts
@@ -0,0 +1,200 @@
+import { randomUUID } from "node:crypto";
+import { mkdtempSync, rmdirSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { instanceConfigs, type AppConfig } from "./config.ts";
+import { stripWorkspaceCredentialEnv } from "./credential-env.ts";
+import { codexShellDisabled, GUEST_CONFINED_CODEX_ARGS } from "./drivers/codex-guest.ts";
+import { codexLaunch } from "./drivers/codex-process.ts";
+import { CodexConnection } from "./drivers/codex-warm.ts";
+import { augmentedPath } from "./env-path.ts";
+import { killCliTree, spawnCli } from "./procs.ts";
+import { LiveSessionError, MAX_SDP_BYTES } from "./live-call.ts";
+import type { LiveSocket } from "./live-call-controller.ts";
+
+const START_TIMEOUT_MS = 25_000;
+const START_FAILED = "Codex could not start Live calls. Update Codex CLI and check its ChatGPT sign-in.";
+const AUTH_REQUIRED = "Sign in to Codex with ChatGPT in Settings → AI to use Live calls.";
+const THREAD_SCOPE_FAILED = "Codex could not start a Live call with its tools disabled. Update Codex CLI and try again.";
+const VOICE_PROMPT = "You are the voice for a MausBot call. MausBot sends the person's requests to their bot. Briefly acknowledge in the person's language while waiting, and read only the bot's replies when MausBot sends them. Leave work and tool calls to the bot.";
+const DISABLED_FEATURES = ["apps", "plugins", "hooks", "multi_agent", "multi_agent_v2", "image_generation"] as const;
+
+export interface LiveCodexCli {
+ cli: string;
+ environment?: NodeJS.ProcessEnv;
+}
+
+export function localLiveCodex(cfg: AppConfig, desktop: boolean): LiveCodexCli | null {
+ if (!desktop || process.platform !== "darwin") return null;
+ const instance = instanceConfigs(cfg).codex;
+ if (instance?.driver !== "codex" || instance.enabled === false) return null;
+ const options = instance.config as { cli?: string; authMode?: string; endpoint?: unknown; managed?: unknown } | undefined;
+ if (options?.authMode === "chatgpt-plan" || options?.endpoint || options?.managed) return null;
+ return { cli: options?.cli || "codex", environment: instance.environment };
+}
+
+type VoiceConfig = {
+ features?: Record<string, unknown>;
+ web_search?: string;
+ mcp_servers?: Record<string, { enabled?: boolean }>;
+ experimental_realtime_webrtc_call_base_url?: string;
+ experimental_realtime_ws_base_url?: string;
+};
+
+type VoiceNotice = { method?: string; params?: { threadId?: string; sdp?: string; role?: string; text?: string; turn?: { id?: string } } };
+
+function until<T>(work: Promise<T>, signal: AbortSignal): Promise<T> {
+ if (signal.aborted) return Promise.reject(signal.reason);
+ return new Promise((resolve, reject) => {
+ const abort = () => reject(signal.reason);
+ signal.addEventListener("abort", abort, { once: true });
+ void work.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
+ });
+}
+
+function openCodexVoiceProcess(input: LiveCodexCli, cwd: string, deadline: AbortSignal, disabledMcp: string[], onNotice: (note: VoiceNotice) => void, onExit: () => void) {
+ const env: NodeJS.ProcessEnv = { ...process.env, ...input.environment, PATH: augmentedPath() };
+ stripWorkspaceCredentialEnv(env);
+ for (const key of ["OPENAI_API_KEY", "OPENMAUSBOT_CODEX_API_KEY", "OPENMAUSBOT_CHATGPT_TOKEN"]) delete env[key];
+ const args = ["app-server", ...GUEST_CONFINED_CODEX_ARGS, ...DISABLED_FEATURES.flatMap((name) => ["--disable", name])];
+ if (disabledMcp.length) {
+ const disabled = disabledMcp.map((name) => `${JSON.stringify(name)}={enabled=false}`).join(",");
+ args.push("-c", `mcp_servers={${disabled}}`);
+ }
+ const connection = new CodexConnection(spawnCli(...codexLaunch(input.cli, args), { cwd, env, stdio: "pipe" }));
+ const exit = new AbortController();
+ const signal = AbortSignal.any([deadline, exit.signal]);
+ const failed = () => {
+ if (exit.signal.aborted) return;
+ exit.abort(new LiveSessionError(START_FAILED, 502));
+ onExit();
+ };
+ connection.child.stdin.on("error", failed);
+ connection.attach({
+ error: failed, close: failed,
+ message: (message) => { if (!connection.absorb(message)) onNotice(message); },
+ });
+ return {
+ ask: async <T>(method: string, params: object, duringCall = false): Promise<T> => {
+ const limit = duringCall ? AbortSignal.any([exit.signal, AbortSignal.timeout(8_000)]) : signal;
+ const result = await until(connection.ask(method, params), limit);
+ if (result === undefined) throw new LiveSessionError(START_FAILED, 502);
+ return result as T;
+ },
+ notify: (method: string) => connection.write({ jsonrpc: "2.0", method }),
+ close: () => {
+ exit.abort(new LiveSessionError(START_FAILED, 502));
+ return killCliTree(connection.child);
+ },
+ signal,
+ };
+}
+
+function assertVoiceConfig(config: VoiceConfig | undefined): asserts config is VoiceConfig {
+ if (!config || !codexShellDisabled(config) || config.web_search !== "disabled" || DISABLED_FEATURES.some((name) => config.features?.[name] !== false)) {
+ throw new LiveSessionError(THREAD_SCOPE_FAILED, 502);
+ }
+ if (config.experimental_realtime_webrtc_call_base_url || config.experimental_realtime_ws_base_url) {
+ throw new LiveSessionError("Remove custom Codex voice endpoints to use the ChatGPT Live call service.", 502);
+ }
+}
+
+const enabledMcp = (config: VoiceConfig): string[] => Object.entries(config.mcp_servers ?? {}).filter(([, server]) => server.enabled !== false).map(([name]) => name);
+
+export async function createCodexLiveSession(input: LiveCodexCli & { sdp: string; voice: string }): Promise<{ sessionId: string; sdp: string; socket: LiveSocket }> {
+ const sessionId = randomUUID();
+ const deadline = AbortSignal.timeout(START_TIMEOUT_MS);
+ const cwd = mkdtempSync(join(tmpdir(), "mausbot-codex-voice-"));
+ const launchedAt = Date.now();
+ let process: ReturnType<typeof openCodexVoiceProcess> | undefined;
+ let threadId = "", sdp = "";
+ let started = false, ready = false, closed = false, stopping = false;
+ let offset = 0, sequence = 0;
+ let resolveReady!: () => void;
+ let rejectReady!: (error: Error) => void;
+ const connected = new Promise<void>((resolve, reject) => { resolveReady = resolve; rejectReady = reject; });
+ void connected.catch(() => undefined);
+
+ const close = async () => {
+ if (closed) return;
+ closed = true;
+ await process?.close();
+ try { rmdirSync(cwd); } catch {}
+ };
+ const finish = (failed: boolean) => {
+ if (closed) return;
+ if (!ready) rejectReady(new LiveSessionError(START_FAILED, 502));
+ if (failed) socket.onclose?.(undefined);
+ else socket.onmessage?.({ data: JSON.stringify({ type: "session.closed", reason: "remote_hangup" }) });
+ void close();
+ };
+ const socket: LiveSocket = {
+ get readyState() { return closed ? 3 : ready ? 1 : 0; },
+ onopen: null, onmessage: null, onerror: null, onclose: null,
+ send(data) {
+ if (closed || stopping) return;
+ const event = JSON.parse(data) as { type: string; content?: string };
+ if (event.type === "session.close") {
+ stopping = true;
+ void process?.ask("thread/realtime/stop", { threadId }, true).then(() => finish(false), () => finish(true));
+ } else if ((event.type === "session.commentary.append" || event.type === "session.instructions.append") && event.content) {
+ void process?.ask("thread/realtime/appendSpeech", { threadId, text: event.content }, true).catch(() => finish(true));
+ }
+ },
+ close: () => { void close(); },
+ };
+ const emit = (event: object) => socket.onmessage?.({ data: JSON.stringify(event) });
+ const onNotice = ({ method, params }: VoiceNotice) => {
+ if (!threadId || params?.threadId !== threadId || closed) return;
+ if (method === "thread/realtime/started") started = true;
+ if (method === "thread/realtime/sdp" && typeof params.sdp === "string" && Buffer.byteLength(params.sdp) <= MAX_SDP_BYTES) sdp = params.sdp;
+ if (method === "thread/realtime/closed" || method === "thread/realtime/error") finish(method === "thread/realtime/error");
+ if (method === "turn/started" && typeof params.turn?.id === "string") {
+ void process?.ask("turn/interrupt", { threadId, turnId: params.turn.id }, true).catch(() => finish(true));
+ }
+ if (started && sdp && !closed) resolveReady();
+ if (!ready || stopping || method !== "thread/realtime/transcript/done" || params.role !== "user" || typeof params.text !== "string" || !params.text.trim()) return;
+ offset = Math.max(offset + 1, Date.now() - launchedAt);
+ emit({ type: "session.input_transcript.delta", delta: params.text, start_ms: offset, end_ms: offset + 1 });
+ emit({ type: "session.delegation.created", delegation: { target: "client", id: `codex-${++sequence}` }, offset_ms: offset });
+ };
+ const startProcess = async (disabledMcp: string[]) => {
+ const child = openCodexVoiceProcess(input, cwd, deadline, disabledMcp, onNotice, () => { if (ready) finish(true); });
+ process = child;
+ await child.ask("initialize", { clientInfo: { name: "openmausbot_voice", version: "0.1.0" }, capabilities: { experimentalApi: true } });
+ child.notify("initialized");
+ const { config } = await child.ask<{ config?: VoiceConfig }>("config/read", { cwd, includeLayers: false });
+ assertVoiceConfig(config);
+ return { child, config };
+ };
+ try {
+ let voiceProcess = await startProcess([]);
+ const mcp = enabledMcp(voiceProcess.config);
+ if (mcp.length) {
+ await voiceProcess.child.close();
+ voiceProcess = await startProcess(mcp);
+ if (enabledMcp(voiceProcess.config).length) throw new LiveSessionError(THREAD_SCOPE_FAILED, 502);
+ }
+ const { child } = voiceProcess;
+ const { account } = await child.ask<{ account?: { type?: string } }>("account/read", { refreshToken: false });
+ if (account?.type !== "chatgpt") throw new LiveSessionError(AUTH_REQUIRED, 401);
+ const { thread, sandbox } = await child.ask<{ thread?: { id?: string }; sandbox?: { type?: string } }>("thread/start", {
+ cwd, ephemeral: true, environments: [], sandbox: "read-only", approvalPolicy: "never", modelProvider: "openai",
+ });
+ if (typeof thread?.id !== "string" || !thread.id || sandbox?.type !== "readOnly") throw new LiveSessionError(THREAD_SCOPE_FAILED, 502);
+ threadId = thread.id;
+ await child.ask("thread/realtime/start", {
+ threadId, outputModality: "audio", version: "v3", voice: input.voice,
+ voiceSessionId: sessionId, includeStartupContext: false, clientManagedHandoffs: true,
+ transport: { type: "webrtc", sdp: input.sdp }, prompt: VOICE_PROMPT,
+ });
+ await until(connected, child.signal);
+ if (closed || child.signal.aborted) throw new LiveSessionError(START_FAILED, 502);
+ ready = true;
+ return { sessionId, sdp, socket };
+ } catch (error) {
+ await close();
+ if (error instanceof LiveSessionError) throw error;
+ throw new LiveSessionError(START_FAILED, 502);
+ }
+}
diff --git a/server/live-config.ts b/server/live-config.ts
index 6a1a448a59..27a59609d5 100644
--- a/server/live-config.ts
+++ b/server/live-config.ts
@@ -1,5 +1,6 @@
// Live calls' settings in config.json: schema, type and environment overrides, kept out of server/config.ts.
import { z } from "zod";
+import type { LiveProvider } from "../shared/wire.ts";
export const LIVE_KEY_NEEDS_ENDPOINT = "Save the Azure endpoint first: a Live key works only with the endpoint it was saved for.";
export const LIVE_KEY_NEEDS_CUSTOM_ENDPOINT = "Save the custom endpoint first: a Live key works only with the endpoint it was saved for.";
@@ -10,6 +11,7 @@ export const liveConfigSchema = z.object({
key: z.string().optional(),
keyFor: z.string().max(300).optional(),
provider: z.enum(["openai", "azure", "fish", "gemini", "elevenlabs", "custom"]).optional(),
+ useCodex: z.boolean().optional(),
azureEndpoint: z.string().trim().max(300).optional(),
azureDeployment: z.string().trim().max(64).optional(),
customEndpoint: z.string().trim().max(300).optional(),
@@ -28,7 +30,9 @@ export const liveConfigSchema = z.object({
export interface LiveConfig {
key?: string;
keyFor?: string;
- provider?: "openai" | "azure" | "fish" | "gemini" | "elevenlabs" | "custom";
+ provider?: Exclude<LiveProvider, "codex">;
+ /** Use the local CLI for Live calls. Older releases still read the saved service and its key. */
+ useCodex?: boolean;
azureEndpoint?: string;
azureDeployment?: string;
customEndpoint?: string;
@@ -44,6 +48,10 @@ export interface LiveConfig {
idleMinutes?: number;
}
+export function liveProvider(live: LiveConfig | undefined): LiveProvider | undefined {
+ return live?.useCodex ? "codex" : live?.provider;
+}
+
/** Where a key saved now may go: "openai", "azure:<host>" or "custom:<host>"; null while Azure or a custom endpoint is chosen
* with no endpoint to tie it to. Fish Audio, Gemini and ElevenLabs calls never use this key, so with any of them chosen it stays OpenAI's. */
export function liveKeyTarget(live: LiveConfig | undefined): string | null {
@@ -85,7 +93,11 @@ export function liveConfigWithEnv(live: LiveConfig | undefined, env: NodeJS.Proc
next.key = envKey;
}
const provider = env.OMB_LIVE_PROVIDER?.trim().toLowerCase();
- if (provider === "openai" || provider === "azure" || provider === "fish" || provider === "gemini" || provider === "elevenlabs" || provider === "custom") next.provider = provider;
+ if (provider === "codex") next.useCodex = true;
+ if (provider === "openai" || provider === "azure" || provider === "fish" || provider === "gemini" || provider === "elevenlabs" || provider === "custom") {
+ next.provider = provider;
+ if (next.useCodex) next.useCodex = false;
+ }
if (env.OMB_AZURE_OPENAI_LIVE_ENDPOINT !== undefined) next.azureEndpoint = env.OMB_AZURE_OPENAI_LIVE_ENDPOINT.trim();
if (env.OMB_AZURE_OPENAI_LIVE_DEPLOYMENT !== undefined) next.azureDeployment = env.OMB_AZURE_OPENAI_LIVE_DEPLOYMENT.trim();
if (env.OMB_CUSTOM_LIVE_ENDPOINT !== undefined) next.customEndpoint = env.OMB_CUSTOM_LIVE_ENDPOINT.trim();
@@ -105,7 +117,7 @@ export function liveConfigWithEnv(live: LiveConfig | undefined, env: NodeJS.Proc
/** The non-secret Live settings a settings patch mirrors into the environment. */
export function liveSettingEnv(live: LiveConfig | undefined): Array<[value: string | undefined, name: string]> {
return [
- [live?.provider, "OMB_LIVE_PROVIDER"],
+ [liveProvider(live), "OMB_LIVE_PROVIDER"],
[live?.azureEndpoint, "OMB_AZURE_OPENAI_LIVE_ENDPOINT"],
[live?.azureDeployment, "OMB_AZURE_OPENAI_LIVE_DEPLOYMENT"],
[live?.customEndpoint, "OMB_CUSTOM_LIVE_ENDPOINT"],
diff --git a/server/live-session-wiring.ts b/server/live-session-wiring.ts
index 936498d8aa..e0ab377229 100644
--- a/server/live-session-wiring.ts
+++ b/server/live-session-wiring.ts
@@ -1,8 +1,9 @@
+import { createCodexLiveSession, type LiveCodexCli } from "./live-codex.ts";
import { productName } from "./brand.ts";
import type { LiveCallDeps } from "./live-call-controller.ts";
import { openLiveSocket, relayedProvider } from "./live-call-controller.ts";
-import { createLiveSession, liveAttachUrl, type LiveBot, type LiveEndpoint, type LiveHistoryMessage } from "./live-call.ts";
-import { elevenLabsLiveCallRefusal, fishLiveCallRefusal, geminiLiveCallRefusal } from "./live-access.ts";
+import { createLiveSession, liveAttachUrl, LiveSessionError, type LiveBot, type LiveEndpoint, type LiveHistoryMessage } from "./live-call.ts";
+import { codexLiveCallRefusal, elevenLabsLiveCallRefusal, fishLiveCallRefusal, geminiLiveCallRefusal } from "./live-access.ts";
import type { LiveConfig } from "./live-config.ts";
import { createFishLiveSession, endFishLiveSession, fishKeyPrint, FishRelays, fishSpeakingLanguage, setFishAgentLanguage, setUpFishAgent } from "./live-fish.ts";
import { createElevenLabsLiveSession, setUpElevenLabsAgent } from "./live-elevenlabs.ts";
@@ -18,6 +19,7 @@ export interface LiveSessionWiringInput {
saveAgent(agent: Required<Pick<LiveConfig, "fishAgentId" | "fishAgentFor" | "fishAgentLanguage">> | Required<Pick<LiveConfig, "elevenlabsAgentId" | "elevenlabsAgentFor">>): void;
/** The app's language, which a Fish Audio agent speaks; English when unset. */
language?(): string | undefined;
+ codex?(): LiveCodexCli | null;
/** The language the saved Fish Audio agent was last set to speak (`LiveConfig.fishAgentLanguage`). */
fishAgentLanguage?(): string | undefined;
/** The name a person reads, which names the agent on their account; the brand's own by default. */
@@ -29,7 +31,7 @@ export interface LiveSessionWiringInput {
/** How a Live call's session starts and is followed, per provider: GPT-Live's WebRTC session and sideband on OpenAI or
* Azure, or a Fish Audio agent, Gemini Live session or ElevenLabs agent conversation followed through its client's relay. */
export function liveSessionWiring(input: LiveSessionWiringInput): {
- calls: Pick<LiveCallDeps, "fishRefusal" | "geminiRefusal" | "elevenlabsRefusal" | "createSession" | "openSocket" | "attachUrl">;
+ calls: Pick<LiveCallDeps, "codexRefusal" | "fishRefusal" | "geminiRefusal" | "elevenlabsRefusal" | "createSession" | "openSocket" | "attachUrl">;
fishRelay: LiveRouteDeps["fishRelay"];
} {
const relays = new FishRelays();
@@ -98,10 +100,16 @@ export function liveSessionWiring(input: LiveSessionWiringInput): {
return {
fishRelay: (sessionId, token) => relays.find(sessionId, token),
calls: {
+ codexRefusal: (auth, client) => codexLiveCallRefusal(auth, Boolean(input.codex?.()), client),
fishRefusal: (auth) => fishLiveCallRefusal(auth, { othersOnLoopback: input.othersOnLoopback() }),
geminiRefusal: (auth) => geminiLiveCallRefusal(auth, { othersOnLoopback: input.othersOnLoopback() }),
elevenlabsRefusal: (auth) => elevenLabsLiveCallRefusal(auth, { othersOnLoopback: input.othersOnLoopback() }),
createSession: async ({ key, endpoint, sdp, botId, threadId, voice }) => {
+ if (endpoint.provider === "codex") {
+ const config = input.codex?.();
+ if (!config) throw new LiveSessionError("Set up the local Codex CLI in Settings → AI.", 503);
+ return createCodexLiveSession({ ...config, sdp, voice });
+ }
if (endpoint.provider === "gemini") {
const session = await createGeminiLiveSession({ key, endpoint, voice, bot: input.bot(botId), history: input.history(threadId), cloudHome: input.cloudHome, fetchImpl });
// Gemini has nothing to end: the session ends when the client closes it, and the token is single use.
diff --git a/server/live-settings.test.ts b/server/live-settings.test.ts
index 32b3a658e5..d2f46d3ea6 100644
--- a/server/live-settings.test.ts
+++ b/server/live-settings.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
import type { AppConfig } from "./config.ts";
import { nestedKeyStatus } from "./key-hint.ts";
import { LIVE_NEEDS_AZURE, LIVE_NEEDS_ELEVENLABS, LIVE_NEEDS_FISH, LIVE_NEEDS_GEMINI, LIVE_NEEDS_KEY } from "./live-call.ts";
-import { fishKeyFromLiveKey, LIVE_KEY_NEEDS_ENDPOINT, liveConfigWithEnv, liveKeyTarget, liveSavePatch, usableLiveKey, type LiveConfig } from "./live-config.ts";
+import { fishKeyFromLiveKey, LIVE_KEY_NEEDS_ENDPOINT, liveConfigSchema, liveConfigWithEnv, liveKeyTarget, liveSavePatch, usableLiveKey, type LiveConfig } from "./live-config.ts";
import { fishKeyPrint } from "./live-fish.ts";
import { LIVE_IDLE_MINUTES_DEFAULT, liveCallEndpoint, liveCallKey, liveCallSettings, liveSettingsFor, liveSettingsForClient, liveSetupProblem } from "./live-settings.ts";
@@ -18,6 +18,16 @@ describe("live settings", () => {
expect(JSON.stringify(settings)).not.toContain("sk-test");
});
+ it("uses Codex without forwarding the saved key and keeps the prior service readable", () => {
+ const legacy = { provider: "azure" as const, azureEndpoint: "https://example.openai.azure.com", key: "synthetic-azure-key", keyFor: "azure:example.openai.azure.com" };
+ const stored = { ...legacy, useCodex: true };
+ expect(liveConfigSchema.omit({ useCodex: true }).parse(stored)).toEqual(legacy);
+ expect(liveCallKey({ live: stored })).toBeNull();
+ expect(liveSettingsFor({ live: stored })).toMatchObject({ provider: "codex", configured: true });
+ expect(liveSettingsFor({ live: stored })).not.toHaveProperty("keySource");
+ expect(liveCallKey({ live: liveConfigWithEnv(stored, { OMB_LIVE_PROVIDER: "azure" }) })).toEqual({ key: legacy.key, source: "live" });
+ });
+
it("reports a saved Gemini voice beside the GPT-Live one, and nothing when it is cleared", () => {
expect(liveSettingsFor({ live: { voice: "cedar", geminiVoice: "Kore" } } as AppConfig)).toMatchObject({ voice: "cedar", geminiVoice: "Kore" });
expect(liveSettingsFor({ live: { geminiVoice: "" } } as AppConfig)).not.toHaveProperty("geminiVoice");
diff --git a/server/live-settings.ts b/server/live-settings.ts
index 6224d4d612..c297dac587 100644
--- a/server/live-settings.ts
+++ b/server/live-settings.ts
@@ -1,7 +1,7 @@
-import type { LiveKeySource, LiveSettings } from "../shared/wire.ts";
+import type { LiveKeySource, LiveProvider, LiveSettings } from "../shared/wire.ts";
import { saveConfig, syncCredentialEnv, type AppConfig } from "./config.ts";
import { azureLiveEndpoint, customLiveEndpoint, LIVE_NEEDS_AZURE, LIVE_NEEDS_CUSTOM, LIVE_NEEDS_ELEVENLABS, LIVE_NEEDS_FISH, LIVE_NEEDS_GEMINI, LIVE_NEEDS_KEY, openAiLiveEndpoint, type LiveEndpoint } from "./live-call.ts";
-import { liveSavePatch, usableLiveKey, type LiveConfig as LiveConfigSection } from "./live-config.ts";
+import { liveProvider, liveSavePatch, usableLiveKey, type LiveConfig as LiveConfigSection } from "./live-config.ts";
import { fishLiveEndpoint, usableFishAgent } from "./live-fish.ts";
import { voiceCredential } from "./included-services.ts";
import { elevenLabsLiveEndpoint, usableElevenLabsAgent } from "./live-elevenlabs.ts";
@@ -15,6 +15,7 @@ type LiveConfig = Pick<AppConfig, "live" | "openai" | "tts">;
* OpenAI, the Fish Audio key only to Fish Audio, the Gemini key only to Gemini and the person's own ElevenLabs key only to
* ElevenLabs. A custom endpoint gets only the key saved for it. */
export function liveCallKey(cfg: LiveConfig, env: NodeJS.ProcessEnv = process.env): { key: string; source: LiveKeySource } | null {
+ if (cfg.live?.useCodex) return null;
if (cfg.live?.provider === "fish") {
const fish = cfg.tts?.fishKey?.trim();
return fish ? { key: fish, source: "fishAudio" } : null;
@@ -38,6 +39,7 @@ export function liveCallKey(cfg: LiveConfig, env: NodeJS.ProcessEnv = process.en
/** null when Azure (or a custom endpoint) is chosen but its endpoint or deployment (model) is missing or not valid. On Fish Audio, `model` is "" until the
* harness has set up an agent on the account of the Fish Audio key. */
export function liveCallEndpoint(cfg: LiveConfig, env: NodeJS.ProcessEnv = process.env): LiveEndpoint | null {
+ if (cfg.live?.useCodex) return { provider: "codex", apiBase: "", model: "" };
if (cfg.live?.provider === "azure") return azureLiveEndpoint(cfg.live.azureEndpoint, cfg.live.azureDeployment);
if (cfg.live?.provider === "custom") return customLiveEndpoint(cfg.live.customEndpoint, cfg.live.customModel);
if (cfg.live?.provider === "fish") return fishLiveEndpoint(usableFishAgent(cfg.live, cfg.tts?.fishKey ?? ""), env);
@@ -47,7 +49,8 @@ export function liveCallEndpoint(cfg: LiveConfig, env: NodeJS.ProcessEnv = proce
}
export function liveSetupProblem(cfg: LiveConfig): string | null {
- const provider = cfg.live?.provider;
+ const provider = liveProvider(cfg.live);
+ if (provider === "codex") return null;
const missing = provider === "azure" ? LIVE_NEEDS_AZURE : provider === "fish" ? LIVE_NEEDS_FISH : provider === "gemini" ? LIVE_NEEDS_GEMINI
: provider === "elevenlabs" ? LIVE_NEEDS_ELEVENLABS : provider === "custom" ? LIVE_NEEDS_CUSTOM : LIVE_NEEDS_KEY;
if (!liveCallKey(cfg)) return missing;
@@ -55,8 +58,9 @@ export function liveSetupProblem(cfg: LiveConfig): string | null {
}
/** The environment follows the save, as for PUT /api/config: loadConfig prefers it over the file. */
-export function saveLiveSettings(cfg: Pick<AppConfig, "live">, patch: LiveConfigSection): void {
- const live = liveSavePatch(cfg.live, patch);
+export function saveLiveSettings(cfg: Pick<AppConfig, "live">, { provider, ...patch }: Omit<LiveConfigSection, "provider"> & { provider?: LiveProvider }): void {
+ const live = liveSavePatch(cfg.live, provider === "codex" ? { ...patch, useCodex: true }
+ : provider ? { ...patch, provider, useCodex: false } : patch);
saveConfig({ live });
syncCredentialEnv({ live });
}
@@ -74,11 +78,11 @@ export function liveSettingsForClient({ azureEndpoint: _endpoint, azureDeploymen
export function liveSettingsFor(cfg: AppConfig): LiveSettings {
const minutes = cfg.live?.idleMinutes;
const key = liveCallKey(cfg);
- const provider = cfg.live?.provider;
+ const provider = liveProvider(cfg.live);
return {
configured: liveSetupProblem(cfg) === null,
...(key ? { keySource: key.source } : {}),
- ...(provider === "azure" || provider === "fish" || provider === "gemini" || provider === "elevenlabs" || provider === "custom" ? { provider } : {}),
+ ...(provider === "azure" || provider === "fish" || provider === "gemini" || provider === "elevenlabs" || provider === "custom" || provider === "codex" ? { provider } : {}),
...(cfg.live?.azureEndpoint ? { azureEndpoint: cfg.live.azureEndpoint } : {}),
...(cfg.live?.azureDeployment ? { azureDeployment: cfg.live.azureDeployment } : {}),
...(cfg.live?.customEndpoint ? { customEndpoint: cfg.live.customEndpoint } : {}),
diff --git a/server/routes/live.test.ts b/server/routes/live.test.ts
index 1d1f948b6b..cb5a3c3f69 100644
--- a/server/routes/live.test.ts
+++ b/server/routes/live.test.ts
@@ -139,6 +139,15 @@ describe("live routes", () => {
expect(await request(deps(), "GET", "/api/live/call")).toMatchObject({ status: 200, body: { call: { callId: "c1" } } });
expect(await request(deps({ calls: { ...deps().calls, current: () => null } }), "GET", "/api/live/call")).toEqual({ status: 200, body: { call: null } });
});
+ it("allows the Codex service only through the eligible desktop call controller", async () => {
+ const refused = deps();
+ expect((await request(refused, "PATCH", "/api/live/settings", { provider: "codex" })).status).toBe(403);
+ expect(refused.saved).toEqual([]);
+ const desktop = deps({ calls: { ...deps().calls, codexRefusal: () => null } });
+ expect(await request(desktop, "PATCH", "/api/live/settings", { provider: "codex" })).toMatchObject({ status: 200, body: { live: { provider: "codex" } } });
+ expect(desktop.saved).toEqual([{ provider: "codex" }]);
+ });
+
it("saves non-secret settings and refuses the key", async () => {
const d = deps();
expect(await request(d, "PATCH", "/api/live/settings", { idleMinutes: 10, readTypedReplies: false })).toMatchObject({ status: 200, body: { live: { idleMinutes: 10, readTypedReplies: false } } });
diff --git a/server/routes/live.ts b/server/routes/live.ts
index c538333d7d..a4b9c1d9d5 100644
--- a/server/routes/live.ts
+++ b/server/routes/live.ts
@@ -5,11 +5,12 @@ import type { LiveFishRelayCommand, LiveFishRelayEvent, LiveProvider, LiveSettin
import { GEMINI_LIVE_VOICE_OPTIONS } from "../../shared/live-call.ts";
import { azureLiveDeployment, azureOpenAiRoot, customLiveApiBase, customLiveModel, LiveSessionError, MAX_SDP_BYTES } from "../live-call.ts";
import { LiveCallBusyError, type LiveCallController } from "../live-call-controller.ts";
+import { LIVE_CODEX_REFUSAL } from "../live-access.ts";
import { RELAY_POLL_MS } from "../live-fish.ts";
import { PASS, type RouteContext, type RouteHandler } from "./table.ts";
export interface LiveRouteDeps {
- calls: Pick<LiveCallController, "start" | "end" | "current" | "deviceRevoked">;
+ calls: Pick<LiveCallController, "start" | "end" | "current" | "deviceRevoked"> & Partial<Pick<LiveCallController, "codexRefusal">>;
/** The companion unpaired this phone: its closed-app alerts end too. */
deviceRevoked?: (device: string) => void;
resolveTarget(botId: string, threadId: string | undefined): { botId: string; botName: string; threadId: string } | null;
@@ -48,7 +49,7 @@ const relayBody = z.object({
}).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", "fish", "gemini", "elevenlabs", "custom"]).optional(),
+ provider: z.enum(["openai", "azure", "fish", "gemini", "elevenlabs", "custom", "codex"]).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(),
@@ -138,6 +139,10 @@ export function createLiveRoutes(deps: LiveRouteDeps): RouteHandler {
if (field === "customModel") return json(res, 400, { error: "The model may use letters, digits, '-', '_', '.', ':' and '/', up to 64 characters." });
return json(res, 400, { error: "Those Live settings are not valid." });
}
+ if (parsed.data.provider === "codex") {
+ const refusal = deps.calls.codexRefusal ? deps.calls.codexRefusal(auth) : LIVE_CODEX_REFUSAL;
+ if (refusal) return json(res, 403, { error: refusal });
+ }
if (!Object.keys(parsed.data).length) return json(res, 400, { error: "nothing to save" });
return json(res, 200, { live: await deps.saveSettings(parsed.data) });
}
diff --git a/server/testing/fake-codex-live-cli.ts b/server/testing/fake-codex-live-cli.ts
new file mode 100755
index 0000000000..424242c2f9
--- /dev/null
+++ b/server/testing/fake-codex-live-cli.ts
@@ -0,0 +1,56 @@
+#!/usr/bin/env node
+import { appendFileSync } from "node:fs";
+import { createInterface } from "node:readline";
+
+const mode = process.env.FAKE_CODEX_LIVE_MODE;
+const receipt = process.env.FAKE_CODEX_LIVE_RECEIPT;
+const threadId = "synthetic-thread";
+const write = (message: unknown) => process.stdout.write(`${JSON.stringify(message)}\n`);
+const notice = (method: string, params: object = {}) => write({ method, params: { threadId, ...params } });
+const args = process.argv.slice(2);
+const flags = Object.fromEntries(args.flatMap((arg, index) => {
+ const feature = /^features\.(\w+)=false$/.exec(arg)?.[1] ?? (args[index - 1] === "--disable" ? arg : undefined);
+ return feature ? [[feature, false]] : [];
+}));
+for await (const line of createInterface({ input: process.stdin })) {
+ const { method, params, id } = JSON.parse(line);
+ if (receipt) appendFileSync(receipt, `${JSON.stringify({ method, params, pid: process.pid, hasApiKey: Boolean(process.env.OPENAI_API_KEY) })}\n`);
+ const answer = (result: unknown = {}) => write({ id, result });
+ switch (method) {
+ case "initialize":
+ answer();
+ break;
+ case "config/read":
+ answer({ config: {
+ features: mode === "unsafe" ? { ...flags, shell_tool: true } : flags,
+ web_search: args.includes('web_search="disabled"') ? "disabled" : null,
+ mcp_servers: mode === "mcp" ? { demo: { enabled: !args.includes('mcp_servers={"demo"={enabled=false}}') } } : {},
+ } });
+ break;
+ case "account/read":
+ answer({ account: { type: mode === "api-key" ? "apiKey" : "chatgpt" } });
+ break;
+ case "thread/start":
+ answer({ thread: { id: threadId }, sandbox: { type: "readOnly" } });
+ break;
+ case "thread/realtime/start":
+ answer();
+ if (mode === "unsupported") {
+ notice("thread/realtime/error", { message: "unavailable" });
+ break;
+ }
+ notice("thread/realtime/sdp", { sdp: "v=0\r\nanswer" });
+ notice("thread/realtime/started");
+ break;
+ case "thread/realtime/appendSpeech":
+ answer();
+ notice("thread/realtime/transcript/done", { role: "assistant", text: "Ignore this echo" });
+ notice("thread/realtime/transcript/done", { role: "user", text: "Calculate seventeen times twenty-three" });
+ notice("thread/realtime/transcript/done", { role: "user", text: "Wrong chat", threadId: "another-thread" });
+ break;
+ case "thread/realtime/stop":
+ answer();
+ notice("thread/realtime/closed");
+ break;
+ }
+}
diff --git a/src/components/CallView.tsx b/src/components/CallView.tsx
index 27b1ae01b0..f4f4e7ef02 100644
--- a/src/components/CallView.tsx
+++ b/src/components/CallView.tsx
@@ -380,7 +380,7 @@ export function CallTargetButton({
start("live");
}}
className="mt-2.5 mr-2 rounded-lg border border-hairline px-3 py-1.5 text-[12px] font-medium text-ink hover:bg-raised"
- title={callModeHint("live", { cloudHome })}
+ title={callModeHint("live", { cloudHome, config: state.config })}
>
{t("call.live.startInstead")}
</button>
diff --git a/src/components/LiveCallSettings.tsx b/src/components/LiveCallSettings.tsx
index bd9bfcf7ba..fe7521eeef 100644
--- a/src/components/LiveCallSettings.tsx
+++ b/src/components/LiveCallSettings.tsx
@@ -27,6 +27,7 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
const focusOnOpen = useCallback((dialog: HTMLDivElement | null) => {
dialog?.querySelector<HTMLElement>("select, input, button")?.focus();
}, []);
+ const codex = live.provider === "codex";
const azure = live.provider === "azure";
const custom = live.provider === "custom";
const fish = live.provider === "fish";
@@ -82,7 +83,7 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
>
<LiveProviderSettings locked={keySaving} onSaving={setProviderSaving} />
{/* Fish Audio and ElevenLabs calls speak in their agent's own voice. */}
- {!fish && !elevenlabs && <>
+ {!codex && !fish && !elevenlabs && <>
{bot && (
<BotLiveVoiceSelect bot={bot} gemini={gemini} onChange={(liveVoice) => dispatch({ type: "updateBot", botId: bot.id, patch: { liveVoice } })} />
)}
@@ -124,6 +125,7 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
))}
</Select>
</label>
+ {!codex && <>
<div className="flex items-center justify-between gap-2 border-t border-hairline/60 pt-2">
<span className="text-ink-secondary">{t(copy.key)}</span>
<span className="flex gap-2">
@@ -144,6 +146,7 @@ export function LiveCallSettings({ bot, onClose }: { bot?: Pick<Bot, "id" | "nam
{/* Keyed by provider and endpoint: a key typed for one is never saved for another. */}
{changingKey && <LiveKeySetup key={liveKeyFormKey(state.config?.live)} compact locked={providerSaving} onSaving={setKeySaving} onSaved={() => setChangingKey(false)} />}
<div className="text-[12px] text-ink-tertiary">{liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure, custom, fish, gemini, elevenlabs })} {t(copy.cost)}</div>
+ </>}
{error && <div className="text-[12px] text-danger">{error}</div>}
</div>
);
diff --git a/src/components/LiveKeyNeeded.tsx b/src/components/LiveKeyNeeded.tsx
index 1888af6124..a371afbed4 100644
--- a/src/components/LiveKeyNeeded.tsx
+++ b/src/components/LiveKeyNeeded.tsx
@@ -13,6 +13,7 @@ export function LiveKeyNeeded() {
const { state, dispatch } = useStore();
const titleId = useId();
const live = state.config?.live;
+ const codex = live?.provider === "codex";
const azure = live?.provider === "azure";
const custom = live?.provider === "custom";
const fish = live?.provider === "fish";
@@ -28,9 +29,9 @@ export function LiveKeyNeeded() {
<h2 id={titleId} className="text-[14px] font-medium leading-[1.4] text-ink">{t(copy.needs)}</h2>
</div>
<ProviderAndKey formKey={liveKeyFormKey(live)} keyForm={keyForm} />
- {(azure || custom || fish || gemini || elevenlabs) && <DismissWhenReady ready={live?.configured === true} />}
- {!azure && !custom && !fish && !gemini && !elevenlabs && <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">{!keyForm && `${liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure, custom, fish, gemini, elevenlabs })} `}{t(copy.cost)}</p>
+ {(codex || azure || custom || fish || gemini || elevenlabs) && <DismissWhenReady ready={live?.configured === true} />}
+ {!codex && !azure && !custom && !fish && !gemini && !elevenlabs && <button type="button" className="ui-button ui-button-primary self-start" onClick={() => { dismissLiveNotice(); dispatch(openKeySettings("openai", "liveCalls")); }}>{t("call.live.openApiKeys")}</button>}
+ {!codex && <p className="text-[12px] leading-[1.45] text-ink-tertiary">{!keyForm && `${liveDisclosure({ cloudHome: state.config?.cloudHome === true, azure, custom, fish, gemini, elevenlabs })} `}{t(copy.cost)}</p>}
</section>;
}
diff --git a/src/components/LiveProviderSettings.tsx b/src/components/LiveProviderSettings.tsx
index af8c64957d..8504d50eab 100644
--- a/src/components/LiveProviderSettings.tsx
+++ b/src/components/LiveProviderSettings.tsx
@@ -1,5 +1,6 @@
import { useState } from "react";
+import { desktopCapabilitiesNow } from "@/lib/desktop";
import { t } from "@/lib/i18n";
import { api, useStore } from "@/state/store";
import type { LiveProvider, LiveSettings } from "../../shared/wire";
@@ -15,6 +16,8 @@ export function LiveProviderSettings({ locked = false, onSaving }: { locked?: bo
const { state, dispatch } = useStore();
const live: LiveSettings = state.config?.live ?? { configured: false, voice: "", readTypedReplies: true, idleMinutes: 5 };
const provider: LiveProvider = live.provider ?? "openai";
+ const desktop = desktopCapabilitiesNow();
+ const offerCodex = desktop.host.platform === "darwin" && desktop.dictation.reasonCode !== "remote-server" && !state.config?.cloudHome;
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
@@ -44,6 +47,7 @@ export function LiveProviderSettings({ locked = false, onSaving }: { locked?: bo
disabled={saving || locked}
onChange={(event) => void save({ provider: event.target.value as LiveProvider })}
>
+ {(offerCodex || provider === "codex") && <option value="codex">{t("call.live.provider.codex")}</option>}
<option value="openai">{t("call.live.provider.openai")}</option>
<option value="azure">{t("call.live.provider.azure")}</option>
<option value="fish">{t("call.live.provider.fish")}</option>
@@ -55,6 +59,7 @@ export function LiveProviderSettings({ locked = false, onSaving }: { locked?: bo
{(provider === "azure" || provider === "custom") && (
<EndpointForm key={provider} custom={provider === "custom"} live={live} disabled={saving || locked} save={save} />
)}
+ {provider === "codex" && <div className="text-[12px] leading-4 text-ink-secondary">{t("call.live.disclosureCodex")}</div>}
{provider === "fish" && <div className="text-[12px] leading-4 text-ink-secondary">{t("call.live.fishHint")}</div>}
{provider === "gemini" && <div className="text-[12px] leading-4 text-ink-secondary">{t("call.live.geminiHint")}</div>}
{provider === "elevenlabs" && <div className="text-[12px] leading-4 text-ink-secondary">{t("call.live.elevenLabsHint")}</div>}
diff --git a/src/lib/call-mode.ts b/src/lib/call-mode.ts
index 94b7125522..452aaccc12 100644
--- a/src/lib/call-mode.ts
+++ b/src/lib/call-mode.ts
@@ -51,6 +51,7 @@ export function liveKeyFormKey(live: Partial<Pick<LiveSettings, "provider" | "az
}
export function callModeHint(mode: CallMode, where: { cloudHome?: boolean; config?: ConfigStatus | null } = {}): string {
+ if (mode === "live" && where.config?.live?.provider === "codex") return t("call.live.disclosureCodex");
if (mode === "live") return `${t("call.mode.liveHint")} ${liveDisclosure(where)}`;
const capabilities = desktopCapabilitiesNow();
if (capabilities.dictation.available && scribeChosen(where.config)) return t("call.mode.turnsHintEleven");
diff --git a/src/locales/en.json b/src/locales/en.json
index cf38252006..8476d6efb2 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7125,6 +7125,8 @@
"call.live.openApiKeys": "Open AI › Other services",
"call.live.provider": "Service",
"call.live.provider.openai": "OpenAI",
+ "call.live.provider.codex": "Codex (ChatGPT sign-in)",
+ "call.live.disclosureCodex": "This desktop call uses your Codex CLI sign-in and sends your microphone audio and the bot’s spoken replies to OpenAI. Approve actions in the chat.",
"call.live.provider.azure": "Azure OpenAI",
"call.live.azureEndpoint": "Azure resource endpoint",
"call.live.azureDeployment": "GPT-Live deployment name",