Classes
AuthClient
Exchanges API-key credentials for a short-lived bearer access token. The token returned by createToken carries only the scopes you request and expires afterexpires_in seconds (typically 15 minutes). For
hands-off token lifecycle management, prefer the top-level
InterhumanClient, which uses a TokenManager to fetch and
refresh tokens for you.
Constructors
Constructor
Parameters
Returns
AuthClient
Methods
createToken()
Parameters
Returns
Promise<TokenResponse>
Throws
when the credentials are invalid (401), lack a requested scope (403), or the request is otherwise rejected.createClientToken()
interhumanai.stream) and
carries the caps you set, which the API enforces across upload, stream, and
realtime (the video budget spans all three). Omitted fields are left unset
(the server applies its defaults, e.g. a single concurrent session and a
300s TTL).
Parameters
Returns
Promise<ClientTokenResponse>
Throws
when the credentials are invalid (401), the key lacks a requested scope (403), or the mint rate limit is exceeded (429).revokeClientToken()
Parameters
Returns
Promise<void>
Throws
when the credentials or token are invalid (401).StaticTokenProvider
A TokenProvider that always returns the same pre-issued token.Implements
Constructors
Constructor
Parameters
Returns
StaticTokenProvider
Methods
getToken()
Returns
Promise<string>
Implementation of
TokenProvider.getToken
TokenManager
Mints access tokens from API-key credentials via AuthClient and caches them until shortly before they expire, so callers can request a valid bearer token cheaply on every call. Concurrent requests while a token is being minted share a single in-flight request.Implements
Constructors
Constructor
Parameters
Returns
TokenManager
Methods
getToken()
Returns
Promise<string>
Implementation of
TokenProvider.getToken
invalidate()
Returns
void
InterhumanClient
The main entry point. Construct it once with credentials (or a token) and use upload, stream, and realtime to call the API; token lifecycle is handled for you.Example
Constructors
Constructor
Parameters
Returns
InterhumanClient
Properties
Methods
stream()
connect().
Returns
StreamClient
realtime()
WS /v0/realtime/analyze). Each call returns a fresh client
(one per WebSocket session); register handlers and then call connect().
The endpoint requires tokens holding the realtime scope, which is not in
the client’s default scopes, so pass it explicitly (e.g.
scopes: [Scope.Upload, Scope.Stream, Scope.Realtime]). Request every scope
the client needs: the minted token grants exactly what was asked for, so
narrowing to [Scope.Realtime] alone closes off upload() and stream().
Returns
RealtimeClient
getToken()
Returns
Promise<string>
InterhumanError
Base class for every error the SDK throws.Extends
Error
Extended by
Constructors
Constructor
Parameters
Returns
InterhumanError
Overrides
InterhumanApiError
An error response from an HTTP endpoint (/v1/auth, /v1/upload/analyze).
errorId, correlationId, and link are surfaced from the canonical
ApiErrorBody when the server returned one.
Extends
Constructors
Constructor
Parameters
Returns
InterhumanApiError
Overrides
InterhumanError.constructor
Properties
InterhumanConfigError
A configuration/usage error caught before any network call. Streamerror envelopes are not thrown — they are delivered as typed
StreamErrorEvents through the stream client’s on("error", …)
surface, and transport-level socket failures arrive on "socketError" as a
base InterhumanError.
Extends
Constructors
Constructor
Parameters
Returns
InterhumanConfigError
Inherited from
InterhumanError.constructor
RealtimeClient
A typed client over the realtime WebSocket protocol. The realtime endpoint shares the stream endpoint’s session mechanics (subprotocol bearer auth, binary video frames, JSON envelopes down, and therequestClose() graceful shutdown handshake) and adds multi-track analysis,
a caller-supplied transcript (sendTranscript), and a periodic
recommendation step (realtime_recommendation.generated) enabled through the
session config’s realtime_recommendation_instructions.
The endpoint currently ships under the v0 path (/v0/realtime/analyze),
which may change when it graduates to v1, and requires credentials holding
the interhumanai.realtime scope.
Example
Extends
Constructors
Constructor
Parameters
Returns
RealtimeClient
Overrides
SessionSocketClient.constructor
Properties
Accessors
isOpen
Get Signature
Returns
boolean
Inherited from
SessionSocketClient.isOpen
Methods
sendTranscript()
transcript.updated text frame. The most recent transcript replaces any
prior one for the session and is rendered into the recommendation prompt. A
transcript that does not match the segment shape is rejected by the server
with a non-fatal error envelope; the session stays open.
Parameters
Returns
void
on()
type (e.g. "signal.detected"), "message" for every envelope,
or a lifecycle event ("open", "close", "socketError").
Type Parameters
Parameters
Returns
() =>void
Inherited from
SessionSocketClient.on
off()
Type Parameters
Parameters
Returns
void
Inherited from
SessionSocketClient.off
once()
Type Parameters
Parameters
Returns
() =>void
Inherited from
SessionSocketClient.once
connect()
Returns
Promise<void>
Inherited from
SessionSocketClient.connect
waitForSessionReady()
session.ready envelope. Resolves immediately if it has
already arrived (the envelope is retained), otherwise on the next one.
Safe to call after connect without racing the frame.
Returns
Promise<RealtimeSessionReadyEvent>
Inherited from
SessionSocketClient.waitForSessionReady
sendVideo()
Parameters
Returns
void
Inherited from
SessionSocketClient.sendVideo
updateConfig()
session.updated envelope.
Parameters
Returns
void
Inherited from
SessionSocketClient.updateConfig
requestClose()
session.close).
The server acknowledges with a session.closing envelope whose
data.max_drain_seconds is the longest you should wait for the final
session.ended envelope. After the acknowledgment the server rejects new
video, finishes analyzing the video it already accepted (emitting the
normal envelopes in order, plus signal.ended for still-active signals),
sends session.ended, and closes the socket with code 1000 — so listen
for "session.ended" (or "close") rather than calling close.
Returns
void
Inherited from
SessionSocketClient.requestClose
close()
Parameters
Returns
void
Inherited from
SessionSocketClient.close
sendJson()
Parameters
Returns
void
Inherited from
SessionSocketClient.sendJson
abstract SessionSocketClient
Base class implementing the shared live-session WebSocket protocol.
Authentication uses the Sec-WebSocket-Protocol: access_token, <token>
subprotocol pair, which is portable across browsers and Node (the standard
WebSocket constructor cannot set an Authorization header). Inbound frames
are decoded into the protocol’s envelope union and dispatched through the
typed on surface; outbound video is sent as binary frames and JSON
payloads (session config, and for realtime the transcript) as text frames.
Extended by
Type Parameters
Constructors
Constructor
Parameters
Returns
SessionSocketClient<TEventMap, TConfig>
Properties
Accessors
isOpen
Get Signature
Returns
boolean
Methods
on()
type (e.g. "signal.detected"), "message" for every envelope,
or a lifecycle event ("open", "close", "socketError").
Type Parameters
Parameters
Returns
() =>void
off()
Type Parameters
Parameters
Returns
void
once()
Type Parameters
Parameters
Returns
() =>void
connect()
Returns
Promise<void>
waitForSessionReady()
session.ready envelope. Resolves immediately if it has
already arrived (the envelope is retained), otherwise on the next one.
Safe to call after connect without racing the frame.
Returns
Promise<TEventMap["session.ready"]>
sendVideo()
Parameters
Returns
void
updateConfig()
session.updated envelope.
Parameters
Returns
void
requestClose()
session.close).
The server acknowledges with a session.closing envelope whose
data.max_drain_seconds is the longest you should wait for the final
session.ended envelope. After the acknowledgment the server rejects new
video, finishes analyzing the video it already accepted (emitting the
normal envelopes in order, plus signal.ended for still-active signals),
sends session.ended, and closes the socket with code 1000 — so listen
for "session.ended" (or "close") rather than calling close.
Returns
void
close()
Parameters
Returns
void
sendJson()
Parameters
Returns
void
StreamClient
A typed client over the stream WebSocket protocol. Authentication uses theSec-WebSocket-Protocol: access_token, <token>
subprotocol pair, which is portable across browsers and Node (the standard
WebSocket constructor cannot set an Authorization header). Inbound frames
are decoded into the StreamEvent union and dispatched through the
typed on surface inherited from SessionSocketClient; outbound video
is sent as binary frames and session config as a JSON text frame.
Example
Extends
Constructors
Constructor
Parameters
Returns
StreamClient
Overrides
SessionSocketClient.constructor
Properties
Accessors
isOpen
Get Signature
Returns
boolean
Inherited from
SessionSocketClient.isOpen
Methods
on()
type (e.g. "signal.detected"), "message" for every envelope,
or a lifecycle event ("open", "close", "socketError").
Type Parameters
Parameters
Returns
() =>void
Inherited from
SessionSocketClient.on
off()
Type Parameters
Parameters
Returns
void
Inherited from
SessionSocketClient.off
once()
Type Parameters
Parameters
Returns
() =>void
Inherited from
SessionSocketClient.once
connect()
Returns
Promise<void>
Inherited from
SessionSocketClient.connect
waitForSessionReady()
session.ready envelope. Resolves immediately if it has
already arrived (the envelope is retained), otherwise on the next one.
Safe to call after connect without racing the frame.
Returns
Promise<SessionReadyEvent>
Inherited from
SessionSocketClient.waitForSessionReady
sendVideo()
Parameters
Returns
void
Inherited from
SessionSocketClient.sendVideo
updateConfig()
session.updated envelope.
Parameters
Returns
void
Inherited from
SessionSocketClient.updateConfig
requestClose()
session.close).
The server acknowledges with a session.closing envelope whose
data.max_drain_seconds is the longest you should wait for the final
session.ended envelope. After the acknowledgment the server rejects new
video, finishes analyzing the video it already accepted (emitting the
normal envelopes in order, plus signal.ended for still-active signals),
sends session.ended, and closes the socket with code 1000 — so listen
for "session.ended" (or "close") rather than calling close.
Returns
void
Inherited from
SessionSocketClient.requestClose
close()
Parameters
Returns
void
Inherited from
SessionSocketClient.close
sendJson()
Parameters
Returns
void
Inherited from
SessionSocketClient.sendJson
UploadClient
Analyzes a complete video file and returns a single report. The request is sent asmultipart/form-data with the bearer token attached
automatically from the configured TokenProvider.
Constructors
Constructor
Parameters
Returns
UploadClient
Methods
analyze()
Parameters
Returns
Promise<AnalysisResult>
Throws
on a rejected request (auth, validation, too-large/too-short media, quota, unprocessable video, server error).Interfaces
AuthClientOptions
Options for constructing an AuthClient.Properties
TokenProvider
Anything that can supply a bearer token on demand.Methods
getToken()
Returns
Promise<string>
TokenManagerOptions
Options for a TokenManager.Properties
ApiKeyCredentials
Credentials issued in the Interhuman customer platform.Extended by
Properties
ApiKeyCredential
A full API key string used to mint and revoke client tokens.Extended by
Properties
TokenRequest
Request body forPOST /v1/auth.
Extends
Properties
TokenResponse
Response body fromPOST /v1/auth.
Properties
ClientTokenRequest
Request for minting an ephemeral, capped client token (POST /v1/client_tokens).
Call this server-side with your API key; the returned token is safe to hand
to a browser to call the upload, stream, or realtime endpoints directly.
Every cap is optional. The token grants only the requested scopes
(default interhumanai.stream); the caps are enforced on streaming sessions
(stream / realtime) and the video budget additionally spans upload.
Extends
Properties
ClientTokenResponse
Response body fromPOST /v1/client_tokens.
Properties
RevokeClientTokenRequest
Request for revoking a client token (POST /v1/client_tokens/revoke).
Extends
Properties
InterhumanClientOptions
Options for constructing an InterhumanClient.Properties
ApiErrorBody
The canonical error body returned by every HTTP error path.Properties
TranscriptSegment
One diarized utterance of a realtime transcript, as sent withsendTranscript.
Properties
RealtimeSessionConfig
Client-to-server realtime session config (sent as a JSON text frame). The last config sent fully replaces the active one; the server acknowledges with asession.updated envelope. The stream include flags are not accepted —
the realtime endpoint never emits the conversation-quality or engagement
updates those flags control.
Properties
TranscriptUpdatedFrame
The inboundtranscript.updated text frame carrying a caller-supplied
transcript. Sent by RealtimeClient.sendTranscript; the most recent
transcript replaces any prior one and is rendered into the recommendation prompt.
Properties
RealtimeSessionReadyConfigOptions
Supported realtime session-config options advertised onsession.ready.
Unlike the stream options, only the realtime controls appear here — never
the stream include / goal_dimensions options.
Properties
RealtimeSessionReadyData
session.ready payload — the same connection-level limits as the stream
session.ready, with the realtime supported-config options.
Properties
RealtimeSessionReadyEvent
Fields shared by every server→client envelope.Extends
Properties
RealtimeSessionUpdatedData
session.updated payload — the consolidated realtime config after a config
frame applied. Reports only the realtime options, never the stream-only
include / goal_dimensions fields.
Properties
RealtimeSessionUpdatedEvent
Fields shared by every server→client envelope.Extends
Properties
RealtimeRecommendationGeneratedData
realtime_recommendation.generated payload — one recommendation run’s guidance text.
Properties
RealtimeRecommendationGeneratedEvent
realtime_recommendation.generated — the periodic recommendation result. Emitted only when
realtime_recommendation_instructions has enabled recommendation, paced by realtime_recommendation_frequency.
Extends
Properties
RealtimeSignalDetectedData
Properties
RealtimeSignalDetectedEvent
A social signal was detected. The realtime payload carries norationale.
Extends
Properties
RealtimeSignalUpdatedData
Properties
RealtimeSignalUpdatedEvent
An active signal’s details changed. The realtime payload carries norationale.
Extends
Properties
RealtimeEventMap
Event payloads keyed by event name, for the typedon/off surface of the
realtime client. The envelope types map to their envelope objects; the
remaining keys are client-level lifecycle events.
Properties
SessionSocketClientOptions
Options shared by every WebSocket session client.Properties
SessionSocketEventMapBase
The lifecycle and wildcard events every session event map carries, alongside its protocol-specific envelopetype keys. TEvent is the protocol’s
envelope union and TReady its session.ready envelope.
Type Parameters
Properties
StreamEnvelopeBase
Fields shared by every server→client envelope.Extended by
ConversationQualityUpdatedEventCoverageDegradedEventCoverageDroppedEventEngagementUpdatedEventFeedbackGeneratedEventSessionClosingEventSessionEndedEventSessionReadyEventSessionUpdatedEventSignalDetectedEventSignalEndedEventSignalUpdatedEventStreamErrorEventRealtimeSessionReadyEventRealtimeSessionUpdatedEventRealtimeSignalDetectedEventRealtimeSignalUpdatedEventRealtimeRecommendationGeneratedEvent
Properties
SessionReadyConfigOptions
Supported session-config options advertised onsession.ready.
Properties
SessionReadyData
session.ready payload — session limits and supported config.
Properties
SessionReadyEvent
Fields shared by every server→client envelope.Extends
Properties
SessionUpdatedData
session.updated payload — consolidated config after a config frame applied.
Properties
SessionUpdatedEvent
Fields shared by every server→client envelope.Extends
Properties
SessionClosingData
session.closing payload — the graceful-close drain contract.
Properties
SessionClosingEvent
Acknowledges a caller-initiatedsession.close request. From this point
the server rejects new video, finishes analyzing the video it already
accepted, emits final lifecycle envelopes (signal.ended for still-active
signals), sends session.ended, and closes the socket.
Extends
Properties
SessionEndedData
session.ended payload — why the session ended.
Properties
SessionEndedEvent
The final message of a gracefully closed session: all analysis is closed and the server closes the WebSocket (code 1000) immediately after sending it. No further analysis messages follow.Extends
Properties
SignalDetectedData
Properties
SignalDetectedEvent
Fields shared by every server→client envelope.Extends
Properties
SignalUpdatedData
Properties
SignalUpdatedEvent
Fields shared by every server→client envelope.Extends
Properties
SignalEndedData
Properties
SignalEndedEvent
Fields shared by every server→client envelope.Extends
Properties
EngagementUpdatedData
Properties
EngagementUpdatedEvent
Fields shared by every server→client envelope.Extends
Properties
ConversationQualityUpdatedData
Properties
ConversationQualityUpdatedEvent
Fields shared by every server→client envelope.Extends
Properties
FeedbackGeneratedData
Properties
FeedbackGeneratedEvent
Fields shared by every server→client envelope.Extends
Properties
CoverageDroppedRange
A contiguous range of media skipped under backpressure (not billed).Properties
CoverageDroppedData
Properties
CoverageDroppedEvent
Fields shared by every server→client envelope.Extends
Properties
CoverageDegradedRange
One time range whose visual coverage was partial, in session seconds.Properties
CoverageDegradedData
Payload of CoverageDegradedEvent: the affected time ranges plus the reason. Unlikecoverage.dropped, these windows were analyzed (audio
plus whatever video decoded) and are billed normally — only the visual
coverage was partial.
Properties
CoverageDegradedEvent
Informational notice that one or more analysis windows were analyzed with partial visual coverage. The session stays open and the windows are billed normally; the ranges tell your application that visual signals over that stretch drew on partial video.Extends
Properties
StreamErrorData
Properties
StreamErrorEvent
Fields shared by every server→client envelope.Extends
Properties
StreamSessionConfig
Client-to-server session config (sent as a JSON text frame).Properties
SessionCloseRequest
Client-to-server graceful close request (sent as a JSON text frame). Tells the server the caller is done sending video; the server acknowledges withsession.closing and ends the session with session.ended.
Properties
StreamCloseInfo
Information about a closed stream connection.Properties
StreamEventMap
Event payloads keyed by event name, for the typedon/off surface. The
twelve envelope types map to their envelope objects; the remaining keys
are client-level lifecycle events.
Properties
WebSocketLike
The subset of the WHATWGWebSocket interface the SDK relies on. Both the
browser WebSocket and Node 22+‘s global WebSocket satisfy this.
Properties
Methods
send()
Parameters
Returns
void
close()
Parameters
Returns
void
addEventListener()
Parameters
Returns
void
removeEventListener()
Parameters
Returns
void
Signal
A single social signal detected over a span of the analyzed media.Properties
EngagementStateEntry
A contiguous stretch of media labeled with a single engagement state.Properties
ConversationQualityValues
The five conversation-quality dimension scores plus their mean (0–100).Properties
ConversationQualityTimelineEntry
Conversation-quality scores for one window of the timeline.Properties
ConversationQuality
Overall and time-varying conversation-quality scores.Properties
InteractionFeedback
Structured interaction feedback returned by the coach model.Properties
AnalysisResult
The full report returned byPOST /v1/upload/analyze.
Properties
AnalyzeUploadInput
Arguments for UploadClient.analyze.Properties
UploadClientOptions
Options for constructing an UploadClient.Properties
Type Aliases
Environment
RealtimeClientOptions
AnalysisGroup
visual is the visual-signals
track and audio the audio tracks.
RealtimeRecommendationFrequency
high =
every 10 seconds, medium = every 20 seconds, low = every 30 seconds.
Only takes effect once realtime_recommendation_instructions has enabled recommendation.
RealtimeEvent
VideoChunk
Listener
on/once.
Type Parameters
Parameters
Returns
void
StreamClientOptions
StreamEvent
WebSocketFactory
Parameters
Returns
WebSocketLike
ScopeValue
SignalType
tension and frustration name the same underlying negative state but keep
the detecting source legible: tension comes only from the Realtime API’s
visual track, while frustration comes from every other source (Inter-1, the
realtime audio track, and the upload and stream endpoints).
Probability
EngagementLevel
GoalDimension
IncludeFlag
FeedbackType
VideoInput
Blob/File (browsers, or Node 18+ where
Blob is global) or raw bytes plus a filename.
Union Members
Blob
Type Literal
data
filename?
"clip.mp4".
contentType?
"video/mp4".
Variables
HTTP_BASE_URLS
AnalysisGroup
Type Declaration
Visual
Audio
RealtimeRecommendationFrequency
Type Declaration
High
Medium
Low
WS_READY_STATE
readyState constants, mirrored from the WHATWG WebSocket spec.
Type Declaration
CONNECTING
OPEN
CLOSING
CLOSED
Scope
Type Declaration
Upload
POST /v1/upload/analyze.
Stream
WS /v1/stream/analyze.
Realtime
WS /v0/realtime/analyze.
GoalDimension
Type Declaration
Clarity
Authority
Energy
Rapport
Learning
IncludeFlag
Type Declaration
ConversationQualityOverall
ConversationQualityTimeline
Functions
resolveHttpBaseUrl()
baseUrl takes precedence (use it to point at a local server, e.g.
http://localhost:8080); otherwise the named environment is used,
defaulting to production. The returned URL never has a trailing slash.
Parameters
Returns
string
httpToWsBaseUrl()
https→wss,
http→ws. Any path on the base URL is preserved (so a proxy mount
point survives), with the trailing slash trimmed.
Parameters
Returns
string