mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-04 21:15:50 +00:00
Adds a WebSocket relay at /puterai/openai/v1/realtime on the api host, one upstream OpenAI connection per client, frames passed through 1:1. The client socket is accepted before auth so socket.io's 1 s unhandled-upgrade timeout can't kill slow handshakes; failures arrive as OpenAI-shaped error events and a 1008 close. Usage is metered per response.done at the model's token rates, sessions are capped per user (realtime.maxConnectionsPerUser), and each node logs counters, event-loop delay and memory every 30 s. puter.js gets puter.ai.assistant.connect(), returning a session with send/on/off/close over the same OpenAI events. realtime.upstreamUrl points the relay at a mock for load tests; tools/realtime-stress has the mock upstream, a load generator with a JSON report, and an agent runbook. The relay README lists its quirks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>