Skip to content

feat(openai): support custom realtime voice endpoints - #165632

Merged
roboclaw-bot merged 2 commits into
mainfrom
openclaw/realtime-openai-base-url
Oct 5, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
openclaw/realtime-openai-base-url

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #114146. Consolidated reports: #164054, #164338, #164339, #164055.

What Problem This Solves

OpenAI-compatible realtime voice servers cannot be selected because the OpenAI voice bridge always connects to OpenAI's endpoint.

User Impact

Users can set talk.realtime.providers.openai.baseUrl to a full realtime WebSocket URL and use transport: "gateway-relay". The same provider option works for Gateway-side Voice Call and other backend voice bridges. Existing OpenAI and Azure configurations are unchanged.

This adds exactly one configuration option, explicitly approved by @jacobtomlinson. The override is for the GA Realtime protocol, not GPT-Live or browser WebRTC. Mixed Azure routing and unsupported transport/model combinations fail before provider I/O rather than silently sending a custom key to OpenAI. It does not register a DashScope provider or guarantee that a third-party service supports OpenClaw's events, audio formats, voices, and tools.

Why This Change Was Made

The OpenAI provider owns URL normalization and preserves the parsed endpoint path and existing non-model query encoding. Standard URL parsing applies to raw unescaped characters. HTTP(S) aliases become WS(S), and the selected model replaces only the model query parameter. The existing direct server-side API-key flow needs no client-secret minting or additional auth toggle. URL userinfo, fragments, invalid schemes, and ambiguous Azure combinations are rejected without echoing the URL.

Requested by @jacobtomlinson; thanks to @starship863 and @wangyan411303 for the reports.

Work sessions

Evidence

  • Reproduced 17 failures on base 06131c40d09f3249b5ac253c414aa861be1de82b through the provider's real creation/configuration entry points.
  • Four focused OpenAI files: 120 passed, 16.58 s runner wall time with --maxWorkers=1. After the query-encoding correction, all 34 bridge tests passed again in 8.22 s (9.51 s including wrapper).
  • Test execution costs in the four-file run: bridge connection 2.640 s, provider routing 3.318 s, browser auth 1.833 s, projection 0.009 s. Exact-head CI run 37331889991 passed; its affected extension-bundle job took 163 s including setup (not per-file test time).
  • Real local WebSocket smoke: Talk config normalization → provider selection → exact custom path/query → direct bearer auth → GA session readiness → bidirectional audio bytes. This is a synthetic compatible endpoint, not live DashScope validation.
  • pnpm tsgo:extensions and pnpm tsgo:extensions:test passed. Type-aware Oxc lint on all seven changed TypeScript files passed, as did coercion-helper, deprecated-API, import-cycle (zero cycles), and git diff --check guards.
  • node scripts/check-docs-config-examples.mjs passed: 1,305 configuration examples validated, including the new example.
  • Hosted input scanning identified an unnecessary synthetic password in the userinfo-rejection fixture. Removed that password while retaining the username/userinfo rejection case; all six invalid-URL cases passed afterward. No scanner policy or exception changed. A local TruffleHog 3.97.0 scan reports no findings, but does not establish parity with hosted 3.97.4.
  • One intermediate retest failed during compiler snapshot sealing because scanner scratch files were created concurrently; it ran no tests. With the workspace namespace held stable, the six-case retest passed.
  • check:changed stops at three inherited mock-export failures in unchanged src/agents/auth-profiles/usage.test.ts and src/agents/bash-tools.exec-host-node.integration.test.ts. The exact failures reproduce with check-test-mock-exports.mts --staged --base HEAD on the untouched base index; no baseline suppression was changed.

Independent AutoReview (P0–P2): repaired query reserialization that changed existing %20/~ encoding and added regression coverage. The remaining apostrophe-encoding suggestion was rejected after inspecting ws 8.21.3: its own constructor applies new URL(address) and sends parsedUrl.pathname + parsedUrl.search (lib/websocket.js:700–715,767), so raw apostrophes must be URL-encoded by the caller. The docs clarify this contract; no raw-request-target bypass was added.

Allow one provider-owned baseUrl for Gateway-relayed Realtime WebSockets while preserving default OpenAI and Azure routing. Keep keys server-side and reject incompatible browser/GPT-Live routes.

Related: #114146

Co-authored-by: jacobtomlinson <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 5, 2026 15:12
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: openai size: M labels Oct 5, 2026
The userinfo rejection test needs only a username. Remove its unnecessary synthetic password after the hosted input scanner identified the literal; do not change scanner policy or the runtime guard.

Co-authored-by: jacobtomlinson <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 11:33 AM ET / 15:33 UTC (Revision 2).

ClawSweeper review

What this changes

The OpenAI plugin adds a custom realtime WebSocket endpoint setting for Gateway-side voice connections, with URL validation, transport restrictions, documentation, and regression coverage.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release still lack the custom realtime endpoint setting. No concrete introduced correctness or security defect was found.

Priority: P2
Reviewed head: d503a71a95d8305bc9f3af23315e38f25b494662

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful routing regressions and preserved defaults; no actionable blocker was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this bot-authored PR. Its captured body reports a real local WebSocket run through the changed provider and bridge, covering custom routing, bearer auth, readiness, and audio exchange; live DashScope compatibility is explicitly unclaimed. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this bot-authored PR. Its captured body reports a real local WebSocket run through the changed provider and bridge, covering custom routing, bearer auth, readiness, and audio exchange; live DashScope compatibility is explicitly unclaimed. No stored-data contract changes.
Evidence reviewed 10 items Pinned introduction scope: Reviewed the merge-base-to-head introduced patch. Base-branch drift and the stale GitHub test merge were not attributed to this PR.
Still necessary on current main: Fetched main selects Azure routing or the fixed OpenAI endpoint; its connection owner does not consume a custom realtime baseUrl. The related context establishes no merged replacement.
Latest release comparison: The v2026.9.8 bridge likewise uses Azure or the fixed OpenAI realtime endpoint. Local release-blob retrieval failed with HTTP 403, so the same tagged source was inspected through the read-only GitHub contents API.
Findings None None.
Security None None.

How this fits together

Talk and backend voice consumers pass provider settings to the OpenAI realtime voice plugin. The plugin selects authentication and transport, opens the voice connection, and exchanges audio and session events.

flowchart TD
  A[Talk and backend voice settings] --> B[OpenAI voice provider]
  B --> C[Validate endpoint and transport]
  C --> D[Reject incompatible combinations]
  C --> E[Gateway WebSocket bridge]
  F[Server-side API key] --> E
  E --> G[Configured realtime server]
  G --> H[Audio and session events]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +61, Tests +133, Docs +46. Total +240 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 66 5 +61
Tests 3 133 0 +133
Docs 1 46 0 +46
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 245 5 +240

Review metrics

Metric Value Why it matters
Configuration surface 1 optional provider setting The new baseUrl setting uses the existing provider configuration bag and preserves routing when omitted.
Production versus test growth production +61 net lines; tests +133 lines Production growth implements endpoint validation and transport selection; regression coverage protects routing and credential boundaries.

Technical review

Best possible solution:

Keep endpoint selection and validation in the existing OpenAI Gateway bridge, preserve default routes, and leave vendor-specific protocol support to provider plugins.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a defect reproduction: this adds a capability. Current-main source confirms the existing bridge lacks the requested custom endpoint setting.

Is this the best way to solve the issue?

Yes: extending the existing provider-owned WebSocket route is focused, and rejecting incompatible browser and GPT-Live paths preserves their credential and protocol contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fb84dd57fd57.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded provider improvement that enables custom realtime servers while preserving existing default configurations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this bot-authored PR. Its captured body reports a real local WebSocket run through the changed provider and bridge, covering custom routing, bearer auth, readiness, and audio exchange; live DashScope compatibility is explicitly unclaimed. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction scope: Reviewed the merge-base-to-head introduced patch. Base-branch drift and the stale GitHub test merge were not attributed to this PR. (d503a71a95d8)
  • Still necessary on current main: Fetched main selects Azure routing or the fixed OpenAI endpoint; its connection owner does not consume a custom realtime baseUrl. The related context establishes no merged replacement. (extensions/openai/realtime-voice-bridge.ts:474, fb84dd57fd57)
  • Latest release comparison: The v2026.9.8 bridge likewise uses Azure or the fixed OpenAI realtime endpoint. Local release-blob retrieval failed with HTTP 403, so the same tagged source was inspected through the read-only GitHub contents API. (extensions/openai/realtime-voice-bridge.ts:473, fc23bc864e45)
  • Provider-owned validation and compatibility: Normalization accepts HTTP(S) and WS(S), converts HTTP aliases, rejects userinfo and fragments without echoing URLs, and rejects mixed Azure settings. Omitted or blank baseUrl retains existing routing; no configuration writer or stored-data migration is introduced. (extensions/openai/realtime-voice-session-policy.ts:156, d503a71a95d8)
  • Credential and protocol boundaries: Custom endpoints retain the GA relay default. Browser session creation rejects the override before authentication or broker calls, and GPT-Live bridge creation rejects it before provider I/O. The existing Gateway-held bearer-key connection path serves the configured endpoint. (extensions/openai/realtime-voice-provider-factory.ts:155, d503a71a95d8)
  • Existing configuration owner: The existing Talk resolver applies provider normalization before bridge creation, and the protocol already permits provider-owned extra configuration fields. This adds no parallel provider-selection API or persisted-format change. (src/talk/provider-resolver.ts:138, d503a71a95d8)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-05T15:26:23.605Z sha d503a71 :: needs maintainer review before merge. :: none

@roboclaw-bot
roboclaw-bot merged commit 11e9107 into main Oct 5, 2026
115 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/realtime-openai-base-url branch October 5, 2026 15:37
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
* feat(openai): support custom realtime voice endpoints

Allow one provider-owned baseUrl for Gateway-relayed Realtime WebSockets while preserving default OpenAI and Azure routing. Keep keys server-side and reject incompatible browser/GPT-Live routes.

Related: openclaw#114146

Co-authored-by: jacobtomlinson <[email protected]>

* test(openai): avoid a password-shaped URL fixture

The userinfo rejection test needs only a username. Remove its unnecessary synthetic password after the hosted input scanner identified the literal; do not change scanner policy or the runtime guard.

Co-authored-by: jacobtomlinson <[email protected]>

---------

Co-authored-by: jacobtomlinson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: openai P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant