Skip to content

feat(voice): add GPT-Live 1.1 as a Realtime provider - #434

Merged
panuhorsmalahti merged 4 commits into
mainfrom
feat/gpt-live-provider
Dec 2, 2026
Merged

panuhorsmalahti merged 4 commits into
mainfrom
feat/gpt-live-provider

Conversation

@panuhorsmalahti

@panuhorsmalahti panuhorsmalahti commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What problem this solves

The voice ran only on gpt-realtime-2.1. GPT-Live 1.1 (gpt-live-1.1) is a full-duplex voice that takes its own turns and hands work to a backend model, and it serves only /v1/live/sessions, so it needs a provider of its own behind the Realtime provider seam.

Why this change was made

An operator can set REALTIME_PROVIDER=openai-live (voice model OPENAI_LIVE_MODEL, default gpt-live-1.1) and get voice chats and meetings where the agent decides when to speak and stops by itself when talked over. The voice bills per minute instead of per audio token, and the agent's tools run on a full reasoning model (OPENAI_LIVE_BACKEND_MODEL, default gpt-6-sol).

User impact

  • Nothing changes unless REALTIME_PROVIDER=openai-live is set. It uses the same endpoint and key as openai-realtime. Dictation keeps the Realtime transcriber.
  • With it, voice_start's mode and the meeting response modes do not apply: the model decides when to speak.
  • While somebody signs in on the agent's computer, a Live call hears silence and refuses every tool call.
  • A managed install needs its gateway to serve …/live/sessions beside …/realtime. Direct OpenAI works now.

This is the provider-seam version of the feature #232 built on the TypeScript runtime.

Evidence

I probed the Live API directly before writing the provider: tool calls via response.item.create + response.create, barge-in, session.thinking/instructions.append, input_image to the backend, and a text answer for the call summary. The API refuses voice instructions over 16,384 tokens (Instructions must not exceed 16384 tokens.), which is why the voice's copy is cut on whole lines.

I then ran this branch's prism-server with REALTIME_PROVIDER=openai-live against the real API, with a WebSocket voice client speaking two say clips into a call in a new conversation:

[Meeting:Heard] " Hi, please run a shell command to list the files in your workspace and tell me how many there are"
[Meeting] Executing tool shell_exec
[Meeting:Heard] " Thanks. Now remember that my favorite color is teal"
[Meeting] Executing tool memory_write
[Meeting] Live session closed after 67s of voice

The agent's audio, transcribed: "Hmm, let me check that real quick. There aren't any files in my workspace right now, so the count is zero. Okay, I'll remember that your favorite color is teal." memory_entries then held "The user's favorite color is teal.", the conversation got its "Voice call summary" message, and llm_calls holds the backend's priced rows with cache reads counted.

The first call ran without the delegation rule: the voice said "I'll remember that" and called no tool. Adding the rule fixed it.

For review:

  • The voice is priced in the provider at $0.05 a minute (VOICE_USD_PER_MINUTE, from OpenAI's pricing page), because models.dev lists no price for gpt-live-1.1 and the catalog prices tokens only. Each session.usage.updated records the seconds since the last one as a reported row. A 37 s call made three rows totalling $0.0308, and GET /agents/spending listed gpt-live-1.1 at that amount with no unpriced calls. The constant has to be changed by hand if OpenAI reprices.
  • The socket runner now drives RealtimeSession and DictationSession too, and RoomReadings, ModelAudio and VoiceTools came out of VoiceConversation. Both providers share them.
  • ddslop leftovers, left on purpose: each session's listener list, the two provider impls, and the small "hand a call's output back" glue in each conversation.
  • A screen recording's narration is played back to the voice model, because the backend refuses audio (Audio input is not available.). In a probe, a 4.3 s question replayed in one burst was heard and handed to the backend about 2.5 s later. A recording nobody spoke over (no one stretch of 200 ms above about -44 dBFS, with at most 40 ms of quiet in it, so scattered clicks and keystrokes don't count) asks the backend to answer the pictures instead.
  • Live streams its voice in real time, silence included, so the browser's voice worklet counts a played sample as the agent speaking only above about -60 dBFS.
  • A partial session.update of delegation.responses.tools keeps the backend's model and instructions (probed), and response.create takes no per-response settings (Unknown parameter: 'response'), so the call summary drops the backend's tools with a session.update first.
  • No web e2e scenario: the e2e voice suite runs against a mock Realtime server. Unit tests drive LiveSession and LiveConversation over a real local socket with frames shaped as the API sent them.

Copilot AI balanced review requested due to automatic review settings December 2, 2026 08:15

@prismith-it-89130 prismith-it-89130 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the new Live provider, its session and conversation, and the code moved out of VoiceConversation into ModelAudio, RoomReadings, VoiceTools and run_realtime_socket. The extracted modules keep the old behaviour: the reader loops, the tool-run bookkeeping and the roster logic match line by line. Endpoint resolution, the Responses usage field name and the instruction cut are correct.

Two findings block the merge:

  1. With REALTIME_PROVIDER=openai-live, dictation connects to /v1/realtime with model=gpt-live-1.1, a model that the PR says serves only /v1/live/sessions.
  2. Tool calls from a Live session do not check INFERENCE_GATE, so the agent keeps running tools during a secure takeover of the computer. The Realtime provider refuses at that point.

Counts: 2 Major, 3 Minor, 1 Nit.

Not on a diff line:

  • Minor: the voice chat and meeting telemetry events (voice_chat_service.rs:1153-1161, meeting_bot_service.rs:1407-1419) carry no prop that names the Realtime provider, so a Live call cannot be told apart from a Realtime call in product data. They also report response_mode for a Live call, where the mode does not apply. Add a realtime_provider prop from RealtimeProviderName::as_str().
  • Nit: in the PR body, "ddslop leftovers" is a term a reader cannot parse.

Not verified: this review read the code only; it did not build the tree, run the tests, or call the OpenAI APIs. The Live API's handling of a partial session.update, a response.create sent while a function call has no output, and whether the Realtime endpoint refuses gpt-live-1.1 are unverified; finding 1 relies on the PR's own statement about the model.

Comment thread backend/src/config.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Live tool dispatch and backend continuations bypass the inference gate during secure sign-in, allowing new work during a protected window.

6 open issues
What changed in this PR

Adds optional GPT-Live 1.1 support through the existing voice-provider interface, with autonomous turn-taking and a separate reasoning backend.

Changes:

  • Adds Live session handling, tool delegation and configuration.
  • Shares socket handling, audio conversion and room state between providers.
  • Adds protocol tests, backend usage accounting and operator documentation.
File Description
docs/​voice-meetings.md Documents Live turn-taking and billing.
docs/​voice-chat.md Describes Live conversation behavior.
docs/​configuration.md Documents provider and backend settings.
backend/​src/​services/​meeting/​realtime_usage.rs Accounts for backend cached tokens.
backend/​src/​lib/​realtime_providers/​voice_tools.rs Extracts shared tool execution.
backend/​src/​lib/​realtime_providers/​voice_session.rs Shares instruction/catalog assembly.
backend/​src/​lib/​realtime_providers/​room_readings.rs Extracts speaker and roster state.
backend/​src/​lib/​realtime_providers/​openai_realtime/​voice_conversation/​tests.rs Adjusts imports for extracted helpers.
backend/​src/​lib/​realtime_providers/​openai_realtime/​voice_conversation.rs Uses shared conversation helpers.
backend/​src/​lib/​realtime_providers/​openai_realtime/​realtime_session.rs Uses shared socket handling.
backend/​src/​lib/​realtime_providers/​openai_realtime/​openai_endpoint.rs Adds Live URL resolution and socket runner.
backend/​src/​lib/​realtime_providers/​openai_realtime/​dictation_session.rs Uses shared socket handling.
backend/​src/​lib/​realtime_providers/​openai_live/​openai_live_provider.rs Implements the Live provider.
backend/​src/​lib/​realtime_providers/​openai_live/​mod.rs Exports Live modules.
backend/​src/​lib/​realtime_providers/​openai_live/​live_session/​tests.rs Tests Live protocol exchanges.
backend/​src/​lib/​realtime_providers/​openai_live/​live_session.rs Implements Live transport and delegations.
backend/​src/​lib/​realtime_providers/​openai_live/​live_conversation/​tests.rs Tests conversation lifecycle and tools.
backend/​src/​lib/​realtime_providers/​openai_live/​live_conversation.rs Connects Live to voice-session behavior.
backend/​src/​lib/​realtime_providers/​model_audio.rs Extracts shared audio conversion.
backend/​src/​lib/​realtime_providers/​mod.rs Exports provider and shared modules.
backend/​src/​lib/​realtime_providers/​get_realtime_provider.rs Registers Live provider selection.
backend/​src/​config/​tests.rs Tests Live defaults and overrides.
backend/​src/​config.rs Adds Live selection and model settings.
.env.example Shows Live configuration options.

Review effort: Balanced

fn create(name: RealtimeProviderName) -> Box<dyn RealtimeProvider> {
match name {
RealtimeProviderName::OpenaiRealtime => Box::new(OpenAiRealtimeProvider),
RealtimeProviderName::OpenaiLive => Box::new(OpenAiLiveProvider),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left open for the PR owner. The web suite's mock voice server speaks only Realtime frames. An openai-live configuration needs a second mock for the Live protocol (session.start, response.event delegations, session.thinking.append) and another runtime boot, which is a sizeable e2e addition. The Live protocol paths in this PR (tool runs, held items, the summary, narration replay, the sign-in refusal) have unit tests against a local WebSocket server, with frames shaped like the ones a real gpt-live-1.1 session sent.

@jansav jansav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Needs fixes: 4 findings (1 critical, 3 should fix).

Problem: Voice chats and meetings could only run on the OpenAI Realtime API. This PR adds GPT-Live 1.1 as a second Realtime provider. With it the model takes its own turns, stops by itself when someone talks over it, bills the voice per minute, and runs the agent's tools on a full Responses reasoning model.

Approach: A new openai-live provider sits behind the existing RealtimeProvider seam. It has its own Live session (the session.start / delegation protocol, holding backend items while function calls wait for output) and a conversation that drops the response policy and barge-in logic. The socket runner, audio conversion, room readings and tool execution were moved out of the Realtime conversation so both providers share them, and dictation stays on the Realtime transcriber.

Trade-off: There are now two voice providers with different protocols to maintain behind one seam. On openai-live, the spending view does not show the per-minute voice cost, and voice_start's mode and the meeting response modes do nothing, so operators lose those controls.

Reviewed by the review routine at 46dc373.

Comment thread backend/src/config.rs Resolved
REALTIME_PROVIDER=openai-live gives the agent its voice on OpenAI's Live API
(/v1/live/sessions, gpt-live-1.1), on the same endpoint and credential as
openai-realtime. The model takes its own turns and hands the agent's tools to a
Responses backend model, OPENAI_LIVE_BACKEND_MODEL (default gpt-6-sol), whose
function calls run as the agent's real tools. Dictation keeps the Realtime
transcriber.

- LiveSession speaks the protocol: session.start, context as thinking and
  instructions appends, backend items, tool outputs continued with
  response.create once every call of a response has one, and the end-of-call
  summary as a text request on the backend.
- The voice model is told to hand every tool-shaped request to the backend; a
  live call without that rule answered "I'll remember that" and saved nothing.
- The voice's copy of the instructions keeps under the API's 16,384-token cap
  by cutting the middle on whole lines; the backend always has the whole text.
- The backend's tokens are priced from the Responses usage, and the voice's
  billed seconds at $0.05 a minute from each session.usage.updated, since
  models.dev lists no price for gpt-live-1.1.
- Shared with the Realtime provider instead of copied: the socket runner
  (run_realtime_socket, also used by dictation), RoomReadings, ModelAudio,
  VoiceTools and VoiceSessionOptions::instructions_with_catalog.
- OPENAI_REALTIME_MODEL defaults to gpt-live-1.1 for openai-live.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>

@msa0311 msa0311 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three findings that the existing threads don't cover: two in the Live provider and one docs line. The open threads from jansav, Copilot and the bot still stand. The inference-gate bypass is the one that blocks.

Checked and correct: the run_realtime_socket extraction keeps the Realtime and dictation readers' behaviour (error, reset and close paths, and the go gate); live_url_from maps the managed …/realtime mount onto the gateway's …/live/sessions route, which nexus-monorepo serves for both OpenAI and Azure; tokens_of reads the Responses input_tokens_details spelling; voice_instructions cuts only at newline offsets, so it cannot split a UTF-8 character.

Comment thread docs/voice-meetings.md Resolved
…findings

- A Live call refuses every tool call while a secure sign-in holds the inference
  gate (in VoiceTools, so both providers share it), hears silence for that time, and
  asks the backend for nothing.
- OPENAI_LIVE_MODEL names the Live voice model. OPENAI_REALTIME_MODEL stays the
  Realtime model for every provider, so dictation keeps working on openai-live.
- A screen recording's narration is played back to the voice model, since the
  backend takes no audio (probed: "Audio input is not available"). A recording sent
  while a call runs is answered after that call's output, not before.
- The call summary answers the calls still running, sends the held items and drops
  the backend's tools first. response.create takes no per-response settings
  (probed: "Unknown parameter: 'response'"), so effort and token limit are not sent.
- The backend's first call pins who the agent answers, as its first words do.
- A close the server never answers aborts the reader and reports 1006.
- The instructions warning fires on the cut itself.
- docs: "Three levers".

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>

@jansav jansav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Needs fixes: 1 finding (1 should fix).

Delta: 46dc373 → 68f1dcb. Changed in the PR: .env.example, backend/src/config.rs, backend/src/config/tests.rs, backend/src/lib/realtime_providers/openai_live/live_conversation.rs, backend/src/lib/realtime_providers/openai_live/live_conversation/tests.rs, backend/src/lib/realtime_providers/openai_live/live_session.rs, backend/src/lib/realtime_providers/openai_live/live_session/tests.rs, backend/src/lib/realtime_providers/voice_tools.rs, backend/src/services/meeting/realtime_usage.rs, docs/configuration.md and 1 more.

Problem: Voice chats and meetings could only run on the OpenAI Realtime API. This PR adds GPT-Live 1.1 as a second Realtime provider, where the model takes its own turns and runs the agent's tools on a Responses reasoning model. Since the last review, the PR fixes the gaps found then: the secure sign-in gate, the dictation model, the recording narration, the call summary, and the per-minute voice spend.

Approach: The Live voice model now has its own OPENAI_LIVE_MODEL, so OPENAI_REALTIME_MODEL stays the Realtime model that dictation uses. VoiceTools::start refuses every call while the inference gate is held, for both providers, and Live sends silence in place of the call audio during that time. The summary first settles the running calls and removes the backend's tools. The recording narration is played back to the voice model as input audio, and each billed second the server reports is recorded at a fixed per-minute price.

Trade-off: The per-minute price of the Live voice is a constant in the code, so the spending view goes wrong without warning if OpenAI changes the price. On openai-live, whether a narrated recording gets an answer now depends on the voice model choosing to hand it to the backend.

Reviewed by the review routine at 68f1dcb.

@msa0311 msa0311 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at 68f1dcb. My three earlier findings are fixed (answered in their threads). One new minor finding below.

… speech

On openai-live, a recording nobody spoke over went the narration path,
since the microphone is recorded the whole time and its audio is never
empty. The voice model heard silence and nothing asked the backend to
answer. A narration now counts only when 200 ms of it is above about
-44 dBFS; otherwise the backend is asked to answer, as before.

Live streams its output audio in real time, silence included, so a
browser call showed the agent speaking for the whole call. The worklet
now counts a played voice sample as speech only above about -60 dBFS.
Silence is still played, so the timing is unchanged.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>

@jansav jansav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Needs fixes: 1 finding (1 should fix).

Delta: 68f1dcb → 4a4aaac. Changed in the PR: backend/src/lib/realtime_providers/openai_live/live_conversation.rs, backend/src/lib/realtime_providers/openai_live/live_conversation/tests.rs, web/public/voice-worklet.js, web/src/lib/voice-worklet.test.ts.

Problem: On openai-live, a screen recording that nobody spoke over still had microphone audio, so it went down the narration path and got no answer. Also, because Live streams its silences, the browser showed the agent as speaking for the whole call. This delta fixes both problems.

Approach: The backend checks the loudness of the recording's narration (20 ms RMS windows above about -44 dBFS, 200 ms in total). Only a narration that passes is replayed to the voice model; otherwise the backend is asked to answer the pictures. The voice worklet still plays every voice sample, but it marks the agent as speaking only for samples above about -60 dBFS.

Trade-off: Fixed loudness thresholds now decide behavior. Someone who speaks very quietly may get their narration dropped in favor of an answer about the pictures alone. On the Realtime provider, the speaking indicator can now drop during pauses longer than 300 ms inside one reply.

Reviewed by the review routine at 4a4aaac.

@msa0311 msa0311 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it.

Re-reviewed 68f1dcbe..4a4aaacb:

  • The worklet now plays Live's streamed silence but reports speaking only for samples above about -60 dBFS, so the call bar no longer shows "Speaking" for the whole call. The 300 ms hangover still covers the gaps between words.
  • show_recording replays the narration only when holds_speech finds at least 200 ms of windows above about -44 dBFS. Otherwise it asks the backend to answer, as it does on openai-realtime.
  • My three earlier findings are fixed.

Leaving the approval to a human reviewer: 3,590 changed lines outside tests and docs, and jansav's holds_speech finding is still open.

holds_speech counted every loud 20 ms window anywhere in a recording, so a
dozen keystrokes or clicks spread over it added up to the 200 ms of speech
and the recording got no answer. Speech now has to be one stretch of 10
loud windows, holding at most 40 ms of quiet between syllables; a longer
quiet starts the count again.

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>

@jansav jansav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: Ship it.

Delta: 4a4aaac → d26cf01. Changed in the PR: backend/src/lib/realtime_providers/openai_live/live_conversation.rs, backend/src/lib/realtime_providers/openai_live/live_conversation/tests.rs.

Problem: On openai-live, a screen recording that nobody spoke over but that had clicks or keystrokes could still count as narrated. It then took the narration path and got no answer.

Approach: holds_speech now needs one unbroken stretch of 10 loud 20 ms windows (200 ms). A stretch can hold at most 2 quiet windows (40 ms) for the dips between syllables, and a longer quiet starts the count again. Loud windows spread across the recording no longer add up to speech.

Trade-off: A narration only counts when it has 200 ms of loud audio with no quiet gap longer than 40 ms. Very short or clipped speech, such as a single quick word with long stop closures, can now be treated as no narration, and the recording then gets an answer about its pictures only.

Reviewed by the review routine at d26cf01.

@panuhorsmalahti
panuhorsmalahti merged commit 55a0782 into main Dec 2, 2026
33 checks passed
@panuhorsmalahti
panuhorsmalahti deleted the feat/gpt-live-provider branch December 2, 2026 14:19
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.

4 participants