realtime-api
Use and debug speech-to-speech's OpenAI Realtime-compatible WebSocket/WebRTC API, session lifecycle, tool calls, cancellation, and LLM proxy endpoints.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- realtime-api
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use and debug speech-to-speech's OpenAI Realtime-compatible WebSocket/WebRTC API, session lifecycle, tool calls, cancellation, and LLM proxy endpoints.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/python-client-and-proxy.md4.7 KB
- 参考文档references/realtime-protocol.md6.9 KB
- 参考文档references/troubleshooting.md4.8 KB
- 参考文档references/webrtc-transport.md4.4 KB
03 SKILL.md 正文
Realtime API
Use this sub-skill when the task involves a client, service, gateway, or test
that speaks to speech-to-speech over its OpenAI Realtime-compatible API.
Route by surface
- WebSocket clients: read Realtime protocol
for
/v1/realtime, event ordering, PCM chunking, and turn lifecycle. - Python/OpenAI SDK clients or the packaged audio client: read Python client and proxy.
- WebRTC clients: read WebRTC transport
before using
/v1/realtime/calls, RTP audio, or TURN/ICE settings. - LLM side-task proxy: read
Python client and proxy
before enabling
/v1/chat/completionsor/v1/responseson the speech server. - Command selection, server host/port,
serve/local/talk: route to cli-and-server. - STT/LLM/TTS models, direct audio-input model compatibility, voices, and optional extras: route to components-and-backends.
- Browser demo connection modes and web tools: route to browser-demo.
Operating sequence
- Confirm the server endpoint. WebSocket clients use a full URL ending in
/v1/realtime; WebRTC clients POST SDP to/v1/realtime/calls. - Send or inspect
session.updatebefore response generation. Session updates deep-merge explicit fields: changing output voice does not reset input turn detection or tools unless those fields are explicitly replaced or cleared. - Stream microphone PCM over WebSocket with
input_audio_buffer.append, or use RTP media over WebRTC. Do not sendinput_audio_buffer.appendon the WebRTC data channel. - Observe response serialization: only one
response.createmay be active at a time; wait forresponse.doneor implement a client-side response queue. - For barge-in/cancel bugs, track both protocol events and server-side generation/response-key behavior. See troubleshooting.
- Use the bundled probe when only endpoint readiness is needed:
scripts/realtime_endpoint_probe.py.
Key invariants
- Pipeline audio is 16 kHz PCM16 internally; WebSocket sends base64 PCM chunks as JSON events, while WebRTC uses RTP/Opus on the media track.
session.createdis the first event after a WebSocket connection or data channel open. Successfulsession.updatereceivessession.updated.- Assistant output may interleave text and tool calls. Tool results are sent as
conversation.item.createwithtype: function_call_output; sendresponse.createafterward only when the tool result needs a spoken/text follow-up. - Barge-in is cooperative: VAD emits speech events, the send loop cancels the active generation, stale LLM/TTS output is discarded, and clients clear unplayed audio.
- The LLM proxy is unauthenticated by this package. Enable it only on loopback, a trusted network, or behind a gateway that owns access control.
Detailed event schemas, client patterns, transport differences, and recovery steps are bundled in the linked references above.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.