WS /typesafe/ws answers the same questions per frame instead of per request, for a
caller reading a video or an image stream. Questions are sent once; after that a frame is
one binary message and the reply one decision, carrying the same answers and usage a
posted read returns.
Example
The Python SDK covers the socket directly:stream(transport="ws") opens one session,
sends the questions once, and pipelines the reads.
websockets is installed alongside here because the vlmrun[ws] extra, which will
pull it in for you, ships in the next SDK release. The --ws and --fps CLI flags
arrive with it; the Python tab works on the current release today.VLMRun(...) already points at https://gateway.vlm.run/v1, so nothing extra is needed
for the hosted Gateway. To reach a different one, set VLMRUN_GATEWAY_URL: the socket URL
is derived from it, so https://gw.internal/v1 becomes wss://gw.internal/typesafe/ws.
FrameDecision carries index, timestamp_s, and the response, so a sampled frame
keeps its place on the timeline. Results are ordered by input, not by which answer arrived
first.
Why the socket
The saving is round trips, so it grows with frame count. 60 frames from a 60 s clip:
Tokens and cost are identical either way. Ask for the concurrency you want: a session that
does not is throttled to 2.
Node’s built-in global
WebSocket follows the browser API and cannot set request
headers, so it has no way to send Authorization. Use ws, which can.Decision
cached_tokens and bills at the cache rate.
Messages
session.create takes model and questions, plus optional state, detail, steps,
samples, reasoning_effort, and three pacing knobs: window (frames per read, up to 8),
stride (frames between reads), and max_inflight (reads at once, default 2, max 8).
Backpressure
Raisestride before max_inflight: reading fewer frames costs less and usually answers
the same question, since consecutive frames rarely change a decision.
Limits and billing
The socket is not in the OpenAPI schema, as no WebSocket route is.
Related
System One
Question types, inputs, confidence, and cost levers.
System One API
The posted route, whose answer and usage shapes this reuses.