Skip to content

research: Codex realtime voice on the ChatGPT plan (spike) - #55

Merged
thomaseude merged 2 commits into
mainfrom
research/codex-voice
Nov 16, 2026
Merged

thomaseude merged 2 commits into
mainfrom
research/codex-voice

Conversation

@thomaseude

@thomaseude thomaseude commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Spike: can the companion use Codex's realtime voice, so that voice draws from the ChatGPT plan quota instead of the OpenAI API key? This branch is a spike. Do not merge it as is.

Context

  • Codex 0.156 and later has an experimental thread/realtime/* API in codex app-server. Upstream PR feat(voice): add Codex voice conversations across clients pingdotgg/t3code#14865 uses it for T3's own voice mode.
  • With a ChatGPT login, Codex creates the WebRTC call at chatgpt.com/backend-api/codex/realtime/calls. The WebSocket transport requires an API key (core/src/realtime_conversation.rs in openai/codex).
  • OpenAI's pricing page (read on 2026-10-29) gives $0.05 per minute of voice. This cost comes from the plan's Codex quota, which tasks also use.

What the spike found (on the Linux VM, Codex 0.163)

Question Result
Does thread/realtime/start over WebRTC work with a ChatGPT login? Yes. OpenAI returned an SDP answer in about 1.5 s. The client sent no attestation header.
Can the voice model call the companion's tools? Not directly. The voice model has only one tool, which hands the request to the Codex thread.
Can the Codex thread call the companion's tools? Yes, as dynamicTools on thread/start. Codex sends each call as an item/tool/call request. No MCP server is needed.
Is the shell off? Yes, with config.features.shell_tool = false. The thread said that no shell was available.
How long does one tool action take? 4 to 8 s with gpt-6.1-terra at low effort. About 12 s with gpt-5.6-sol at high effort.

Changes

  • research/codex-voice/probe.mjs opens a realtime session with a hand-written SDP offer. It prints sizes and method names only.
  • research/codex-voice/brain-probe.mjs runs one text turn on the Codex thread, answers the tool call and times the turn.
  • companion/src/adapters/codex-live/ holds CodexLiveEngine, a VoiceEngine adapter:
    • It starts one codex app-server per session.
    • It starts an ephemeral thread: read-only sandbox, approval policy never, no shell, the companion's tools as dynamic tools.
    • It starts realtime v3 over WebRTC with the iPhone's offer, with clientManagedHandoffs and our instructions as prompt.
    • It sends tool calls to the core. It speaks the thread's final answer with thread/realtime/appendSpeech when the turn completes.
  • main.ts picks this engine when T3VOICE_ENGINE=codex. This switch is for the spike only.
  • 11 unit tests use a fake app-server. Lint, typecheck and all 509 unit tests pass.

Test on the iPhone (2026-10-29)

Thomas ran the spike build as the t3-voice service, with T3VOICE_ENGINE=codex, and talked to it from the iPhone app. The app did not change.

  • The session opened and the app connected. So Codex's data channel sends the events the app waits for.
  • The assistant spoke, and tool actions worked, including a spoken "oui" confirmation.
  • The session lasted 1.7 min. The companion closed the Codex app-server at the end.
  • Codex's log (~/.codex/logs_2.sqlite) shows the call at 21:33:09 to https://chatgpt.com/backend-api/codex/realtime/calls. No request went to api.openai.com for voice. The Codex login has no API key, and the service environment has no OPENAI_API_KEY.
  • The 5-hour quota of the Plus plan went from 38 % to 39 %. The week stayed at 25 %. Codex reports whole percents only, so this does not give a reliable cost per minute.

Not verified yet

  • How much of the 5-hour quota one minute of voice uses. Thomas decided that this test is enough for now.
  • The delay of one tool action by ear. On the VM, a text turn took 4 to 8 s.
  • The voice: Codex has no brise voice, so the spike uses Codex's default voice.

Open questions before a real ticket

  • The API is experimental and changed between 0.156 and 0.165. A real adapter would pin the Codex version, as the T3 adapter pins T3.
  • Voice shares the Plus quota with the coding agents. Thomas wants the companion to use the API engine when less than 20 % of the quota is left.
  • The companion counts Codex minutes in the daily dollar budget (the spike sets $0.05 per minute). This money is not spent: a real adapter would count these minutes as quota, apart from the budget.
  • The codex binary and a ChatGPT login become requirements of the server.

🤖 Generated with Claude Code

thomaseude and others added 2 commits October 29, 2026 20:18
probe.mjs opens a Codex realtime session over WebRTC with a ChatGPT
login. brain-probe.mjs checks that a Codex thread calls a dynamic tool
with its shell disabled, and times the turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodexLiveEngine runs one codex app-server per session. It starts an
ephemeral brain thread (no shell, read-only sandbox, the companion's
tools as dynamic tools) and a realtime v3 session over WebRTC with the
iPhone's offer. Brain tool calls go to the core; the brain's final
answer is spoken with appendSpeech. Voice draws from the ChatGPT plan
quota of the Codex login, not from the OpenAI key.

Spike only: main.ts picks it from an environment variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomaseude

Copy link
Copy Markdown
Owner Author

Follow-up ticket for the real engine: #56.

@thomaseude
thomaseude marked this pull request as ready for review November 16, 2026 13:47
@thomaseude
thomaseude merged commit 678ce32 into main Nov 16, 2026
2 checks passed
thomaseude added a commit that referenced this pull request Nov 16, 2026
revert: keep the Codex voice spike (#55) on its research branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant