Endpoint
api_key query parameter or the Authorization: Bearer YOUR_API_KEY header. The connection will be rejected with a 4001 close code if the key is invalid or expired.
Connection Limits
Concurrent WebSocket connections are limited by your plan tier:
Exceeding your limit returns close code
4029.
Binary Protocol
Send media data as binary WebSocket frames. A prefix byte discriminates between audio and video:Audio Format
The recommended audio format is:Other sample rates (8 kHz, 44.1 kHz, 48 kHz) are accepted but will be resampled server-side, which adds latency. 16 kHz mono gives the best balance of accuracy and speed.
Video Frames
Send JPEG or PNG frames with a0x01 prefix byte. Frames are analyzed at the configured frame_interval_seconds (default 5s, minimum 3s). Each frame must be under 5MB.
Connection Lifecycle
1
Connect
Open a WebSocket connection to the streaming endpoint with your API key.
2
Receive Ready
The server sends a
ready event with your session_id and default config.3
Configure (optional)
Send a JSON
config message to adjust analysis settings.4
Stream Media
Send binary audio chunks (and optionally video frames) continuously. The server transcribes audio and analyzes video at configured intervals.
5
Receive Events
The server sends JSON text frames containing transcriptions, safety alerts, and video frame analysis results.
6
End Session
Send a
{"type": "end"} message or close the connection. The server flushes remaining data and sends a session_summary event.Client Messages (JSON)
Config
Update session settings at any time. The server responds with aconfig_updated event.
End
Gracefully close the session. The server flushes remaining data and sends a summary.Server Events
ready
Sent immediately after authentication succeeds.
transcription
Emitted after each audio flush with transcribed text and timestamped segments.
alert
Safety concern detected in the latest audio flush.
bullying, unsafe, grooming, emotions, visual.
frame_analysis
Emitted for each analyzed video frame when enable_video is true.
session_summary
Sent when the session ends (via end message or connection close).
config_updated
Confirmation after a config message is processed.
error
Sent when something goes wrong.
Code Example
Credits
Credits are deducted as each flush or frame is processed. Use the
interval_seconds and frame_interval_seconds settings to control how frequently credits are consumed.