Skip to content

Fix ClawBody for current OpenAI Realtime (GA) + OpenClaw 6.x gateway device-auth - #5

Open
KundKMC wants to merge 2 commits into
tomrikert:mainfrom
KundKMC:fix/openai-realtime-ga
Open

Fix ClawBody for current OpenAI Realtime (GA) + OpenClaw 6.x gateway device-auth#5
KundKMC wants to merge 2 commits into
tomrikert:mainfrom
KundKMC:fix/openai-realtime-ga

Conversation

@KundKMC

@KundKMC KundKMC commented Jun 14, 2026

Copy link
Copy Markdown

Summary

ClawBody currently fails to connect to both OpenAI and the OpenClaw gateway on current versions:

  1. OpenAI Realtime rejects the connection with error 4000 invalid_request_error.beta_api_shape_disabled — OpenAI disabled the beta Realtime API shape server-side.
  2. OpenClaw gateway (6.x) grants device-less clients an empty scope set / returns CONTROL_UI_DEVICE_IDENTITY_REQUIRED, so chat.send fails (and the pinned protocol version causes protocol mismatch).

This PR fixes both so ClawBody works again against OpenAI Realtime GA and OpenClaw 2026.6.x.

Changes

1. OpenAI Realtime beta → GA (openai_realtime.py)

  • client.beta.realtime.connectclient.realtime.connect
  • session.update rewritten to the GA schema: type: "realtime", nested audio.input / audio.output, output_modalities, audio format objects {type: "audio/pcm", rate: 24000}, transcription + turn_detection moved under audio.input
  • output audio event names → GA: response.audio.deltaresponse.output_audio.delta, response.audio_transcript.{delta,done}response.output_audio_transcript.{delta,done}

2. Gateway device identity for OpenClaw 6.x (device_identity.py, openclaw_bridge.py)

  • New device_identity.py: persistent Ed25519 keypair, device.id = sha256(raw pubkey).hex, signs the connect-challenge nonce (base64url), caches the device token.
  • connect() now sends device{id, publicKey, signature, signedAt, nonce} and signs the V2 device-auth payload (the gateway verifies V3 or V2 against the same signature).
  • Widened protocol negotiation to minProtocol=3, maxProtocol=4 (fixes protocol mismatch).
  • Requests operator.read + operator.write — there is no separate chat scope in 6.x (chat.send is write-scoped; the gateway rejects chat). First connect registers a pairing request; approve with openclaw devices approve <requestId>.

Testing

Verified live against OpenClaw 2026.6.5 with a physical Reachy Mini (Lite) on macOS / Apple Silicon:

  • OpenAI Realtime GA: session.created + session.updated, 8 tools registered, no more beta_api_shape_disabled.
  • Gateway: connected with scopes=['operator.read','operator.write'], agent context retrieved (~3.3k chars, no fallback identity).
  • Full voice conversation working end-to-end.

Unrelated macOS note: the reachy-mini daemon must run with media enabled, and GStreamer needs GST_REGISTRY_FORK=no on first launch.

KundKMC added 2 commits June 14, 2026 09:48
OpenAI disabled the beta Realtime API shape server-side; clawbody fails
with: error 4000 invalid_request_error.beta_api_shape_disabled.

- Use client.realtime.connect (GA) instead of client.beta.realtime.connect
- Rewrite session.update payload to GA schema:
  - type: realtime, output_modalities, nested audio.input/output
  - audio format objects {type: audio/pcm, rate: 24000}
  - turn_detection + transcription moved under audio.input
- Update output audio event names to GA:
  response.audio.delta -> response.output_audio.delta
  response.audio_transcript.{delta,done} -> response.output_audio_transcript.{delta,done}

Verified live: session.created + session.updated received, 8 tools registered.
OpenClaw 6.x rejects device-less operator clients (CONTROL_UI_DEVICE_IDENTITY_REQUIRED)
and grants device-less loopback clients an empty scope set, so chat.send fails.

- New device_identity.py: persistent Ed25519 keypair, device id = sha256(raw
  pubkey) hex, sign challenge nonce -> base64url; cache device token.
- Bridge connect now sends device{id,publicKey,signature,signedAt,nonce} and
  signs the V2 device-auth payload (gateway verifies V3 or V2 with same sig).
- Widen protocol negotiation to min=3..max=4 (fixes 'protocol mismatch').
- Request scopes operator.read+operator.write (no 'chat' scope in 6.x;
  chat.send is write-scoped). First connect -> pairing; approve via
  'openclaw devices approve <id>'. Token persisted for reconnects.

Verified live against OpenClaw 2026.6.5: connected with scopes, agent context
retrieved (3364 chars), no fallback identity.
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