@charivo/realtime-client-openai
v0.2.2
Published
OpenAI Realtime API client for Charivo
Downloads
752
Readme
@charivo/realtime-client-openai
OpenAI-specific realtime transport client for Charivo.
This is the legacy low-level OpenAI Realtime WebRTC client. For the current
OpenAI Agents SDK path, prefer @charivo/realtime-client-openai-agents.
This package normalizes OpenAI Realtime WebRTC events into the transport event
contract used by @charivo/realtime-core. It can bootstrap sessions through an
API endpoint or a custom sessionBootstrap(...) callback.
Install
pnpm add @charivo/realtime-client-openaiUsage
import { createOpenAIRealtimeClient } from "@charivo/realtime-client-openai";
const client = createOpenAIRealtimeClient({
apiEndpoint: "/api/realtime",
debug: false,
});Server Contract
The client posts JSON shaped like:
{
"transport": "webrtc",
"sdpOffer": "...",
"session": {
"provider": "openai",
"model": "gpt-realtime-mini",
"voice": "marin"
}
}The endpoint must respond with a RealtimeSessionBootstrap JSON object:
{
"adapter": "openai-webrtc",
"transport": "webrtc",
"answerSdp": "..."
}Notes
- Microphone access is required
- Audio playback is handled by WebRTC
- Lip-sync values are extracted from the incoming audio stream
- Tool calls are normalized into
tool.calltransport events only - Tool execution lives in
@charivo/realtime-core; usesendToolResult(...)to submit outputs back to OpenAI - For production apps, prefer
@charivo/realtime-client-remote
