The code in this post uses the current Interhuman API (
WS /v2/stream/analyze and POST /v2/upload/analyze) through the first-party SDKs: @interhumanai/sdk for TypeScript and interhumanai for Python. The open-source repository predates the SDKs, so its transport code differs from the samples here; its scoring code is the same.The shape of it
Three pieces, one job each. Your server mints a short-lived client token with your API key. The browser connects directly to Interhuman with it, streams recorded chunks up as it captures them, and receives analysis events back. The caps on the token (lifetime, session duration, bytes, media seconds, allowed origins) are enforced by Interhuman itself.This is the demo’s architecture, chosen because it’s the lightest to run. It is not the only one. If you’d rather keep every byte under your control, proxy the WebSocket through your own backend and forward frames upstream to Interhuman instead of connecting the browser directly. That’s the more common shape for a production app that wants server-side auth, logging, rate limiting, or retention. Interhuman works the same either way.
1. Mint a client token, server-side
Your API key never leaves the server. The one server responsibility is handing the browser a short-lived, capped client token it can open a session with. The SDK’sAuthClient mints one:
POST /api/stream/session) that returns the token. That’s the entire backend. Size the caps to the session you expect: they are your blast radius if a token leaks, and Build with the stream endpoint lists every one.
2. Stream from the browser
Record withMediaRecorder on a timeslice, and send each chunk the moment it’s produced. The SDK’s StreamClient opens the WebSocket, authenticates with the client token (browsers can’t set an Authorization header on a WebSocket, so it sends the token in the access_token subprotocol pair), and gives you typed events.
MediaRecorder produces it. No buffering, no re-slicing, no reassembly. The next section is why that rule exists, and it’s worth understanding once so you never fight it.
Under the hood: what MediaRecorder hands you
A WebM file isn’t a flat blob of video. It’s a nested binary structure (EBML, from the same family as Matroska and MKV), with a header describing the codecs and tracks, followed by one or more Clusters that each hold a chunk of frames. A player reads the header once, up front, to know what it’s looking at. The detail that matters for streaming is what a timeslice does to that layout. This is exactly why the live-streaming path is the clean one. When you forward each chunk the instant it’s produced, in order, on one session, the sequence reconstructs perfectly on Interhuman’s side: the first frame establishes the header, and each later frame continues from it. The browser is already producing valid segments, so you just relay them. It’s also why you don’t want to parse or rebuild the container yourself. Browser recordings are live-muxed: Chrome has no idea how long you’ll talk, so it writes the Segment and each Cluster with an unknown size (a special all-ones bit pattern in the EBML length field) rather than a known byte count. A parser that only handles known-size elements — which is what a unit test againstffmpeg-generated fixtures quietly validates — will mis-cut real Chrome output and produce a segment the API rejects with ih5004 (“malformed segment”). The live path sidesteps all of it, which is the whole point of streaming segments verbatim.
The full guidance is in Build with the stream endpoint: mint a capped client token server-side, stream directly from the browser, and never re-slice or reinterpret the media container in between.
Size limits worth knowing
Two numbers shape the design. The stream endpoint caps a single WebSocket message at 32 MB, and large single messages fail unreliably even under the cap. So the stream wants many small frames — one per recorder chunk — rather than one big one. The Pitch Practice records at a 1 Mbps video bitrate, which is ample for face-and-voice delivery analysis: each 3-second chunk is roughly 400 KB, and a whole three-minute pitch comes to around 25 MB.POST /v2/upload/analyze takes a file of up to 100 MB and 30 minutes, so a saved pitch fits with room to spare. A larger file is refused with ih4003.
The saved-video path
Live streaming covers the common case. The Pitch Practice also lets founders re-analyze a pitch they saved locally earlier, where there’s no live recorder to stream from — just a finished blob. The demo replays the saved chunks into a new stream, rebuilding the header for each one. On the current API, don’t: a finished file is what the upload endpoint is for. Submit the whole blob as an analysis job, and read the job when it finishes. Nothing parses or re-slices the container. The browser can submit it directly, like the stream. Have your token route mint a second client token with the upload scope (scopes: [Scope.Upload]). Every poll of the job sends that token too, so give it a lifetime that covers the upload, any retry waits, and the analysis — expiresIn: 1800 is comfortable for a three-minute pitch. Then:
idempotencyKey and newIdempotencyKey() need @interhumanai/sdk 4.0.0 or later. A job stays readable until its expires_at, 24 hours after submission. Read the result and keep what you need before expires_at. Upload jobs has the job envelope, and Error handling has the full retry guidance.
For a deeper read of a saved recording,
inter-2-deep reads the same video files and adds reasoning to every window of its result. It uses the same interhumanai.upload scope, and by default it accepts files up to two minutes long, so a three-minute pitch needs inter-2.A note on serverless hosts
One deployment detail is worth knowing on serverless hosts: on Vercel, function request bodies cap around 4.5MB while Vercel Blob multipart parts must be at least 5MB, so a real recording can’t be proxied through a function part-by-part. The client-token pattern above already avoids the problem — the browser sends the bytes to Interhuman directly, and the token route is one small JSON request. If you also keep your own copy of the recording, upload it client-direct to Blob with a signed token, keeping the bytes out of your function entirely:Fold events into your UI
Analysis events stream back as JSON throughout the recording, and the SDK hands each one to a typed handler. Each event type maps straight onto whatever your results view needs. Register the handlers before you start the recorder, so no event arrives unheard.signal.detected / signal.ended pair: the detection carries a probability and a plain-language rationale, a signal.updated revises them while the signal is active, and the end closes it. On a real pitch, a hesitation signal landed right on the traction number, flagged as “a noticeable pause and a rising, uncertain tone right before the revenue numbers — the traction is strong but the delivery hedges it.” That’s the raw material a coaching UI turns into “say the traction number like you believe it.”
When the user stops, the recorder hands over its last chunk and the handler calls stream.requestClose(). The server finishes analyzing what it has, sends signal.ended for anything still active, then session.ended, and closes the socket — so wait for that close rather than closing the socket yourself, or you lose the trailing analysis. Showing results on close also covers a session that ends any other way, with whatever arrived.
Turning signals into a score
With the events accumulated, the score is straightforward. Delivery is a weighted blend of five fields, with a signal-only fallback when conversation quality isn’t requested.
So Interhuman gives you two kinds of output: a set of
conversation_quality dimensions (the demo uses authority, clarity, and energy, and the endpoint also returns quality_index, rapport, and learning), and a stream of discrete social signals — confidence, hesitation, stress, uncertainty, interest — each with a probability, timestamps, and a rationale. The confidence and lowHesitation breakdown fields are the app’s own summaries of those raw signals; there is no “confidence score” in the API response. The weights themselves (0.3 / 0.25 / 0.2 / 0.15 / 0.1) are entirely The Pitch Practice’s editorial call about what makes a good pitch — Interhuman supplies the dimensions and signals, and how you roll them into one headline number is yours. The fallback branch runs when you don’t request conversation quality at all, scoring purely from those two signal-derived numbers.
Content is scored separately from the transcript: an LLM rubric (message clarity, problem framing, solution value, evidence specificity, narrative, and the ask) blended with speech metrics computed from the words themselves — pace, which reads best around 150 words a minute, and filler density, which counts every “um” and “you know.”
Lift it into your own app
That’s the complete integration: a token route, a streaming client, a scoring pass, and a clear picture of the container it all rides on. No media on your servers, no infrastructure to run, and real-time behavioral signals arriving while the user is still speaking. The same three pieces drop into interview practice, sales coaching, or anywhere else a human is talking to a camera. For a microphone-only product, open the session withmodel: "inter-2-audio" and record audio alone; Choose a model has the lines that change. That model reports the six signals it can hear (agreement, confidence, frustration, hesitation, interest, and uncertainty) and no stress, so a score built from stress needs adjusting.
The Pitch Practice is open source and MIT-licensed on GitHub. You can stand up your own copy on Vercel in one click — the clone flow forks the repo into your own GitHub account, provisions a Vercel project, and prompts for the single required environment variable, INTERHUMAN_API_KEY (the optional Supabase variables add the leaderboard; the app runs fine without them):
Next steps
- Build with the stream endpoint — the architecture above, in full.
- Stream analysis reference — the message schema for
wss://api.interhuman.ai/v2/stream/analyze. - Client tokens — the caps and scopes a browser token can carry.
- TypeScript SDK and Python SDK —
AuthClient,StreamClient, typed events, and upload jobs. - Upload analysis reference — the saved-video path, with limits and retries.
- Error handling — the full catalog, including
ih5004andih6002. - The Pitch Practice on GitHub — the repo this post is drawn from.
- Social signals and Conversation quality — what the delivery score is built from.