Skip to main content

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 after expires_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
new AuthClient(options?): AuthClient;
Parameters
ParameterType
optionsAuthClientOptions
Returns
AuthClient

Methods

createToken()
createToken(request): Promise<TokenResponse>;
Mint an access token for the given credentials and scopes.
Parameters
ParameterType
requestTokenRequest
Returns
Promise<TokenResponse>
Throws
when the credentials are invalid (401), lack a requested scope (403), or the request is otherwise rejected.
createClientToken()
createClientToken(request): Promise<ClientTokenResponse>;
Mint a short-lived, capped client token for direct browser use. Call this from your backend with your API key; the returned token is safe to hand to a browser to call the upload, stream, or real-time endpoints directly. It grants the requested scopes (default interhumanai.stream) and carries the caps you set, which the API enforces across upload, stream, and real-time (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
ParameterType
requestClientTokenRequest
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()
revokeClientToken(request): Promise<void>;
Revoke a previously minted client token. Call this from your backend with the same API key that minted the token. Once revoked, the token is rejected on new requests and any live streaming session it opened is torn down on its next chunk. Revoking an already-expired token is a harmless no-op.
Parameters
ParameterType
requestRevokeClientTokenRequest
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
new StaticTokenProvider(token): StaticTokenProvider;
Parameters
ParameterType
tokenstring
Returns
StaticTokenProvider

Methods

getToken()
getToken(): Promise<string>;
Return a currently-valid bearer token, minting/refreshing as needed.
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
new TokenManager(options): TokenManager;
Parameters
ParameterType
optionsTokenManagerOptions
Returns
TokenManager

Methods

getToken()
getToken(): Promise<string>;
Return a valid bearer token, minting or refreshing transparently.
Returns
Promise<string>
Implementation of
TokenProvider.getToken
invalidate()
invalidate(): void;
Drop any cached token so the next getToken mints a fresh one.
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

const client = new InterhumanClient({
  credentials: { keyId: "...", keySecret: "..." },
});
const report = await client.upload.analyze({ file: bytes, filename: "clip.mp4" });

Constructors

Constructor
new InterhumanClient(options): InterhumanClient;
Parameters
ParameterType
optionsInterhumanClientOptions
Returns
InterhumanClient

Properties

PropertyModifierTypeDescription
authreadonlyAuthClientLow-level auth client for minting tokens directly via /v1/auth.
uploadreadonlyUploadClientUpload-mode analysis client (POST /v1/upload/analyze).

Methods

stream()
stream(): StreamClient;
Create a new StreamClient for a live analysis session. Each call returns a fresh client (one per WebSocket session); register handlers and then call connect().
Returns
StreamClient
realtime()
realtime(): RealtimeClient;
Create a new RealtimeClient for a real-time multi-track analysis session (WS /v0/realtime/analyze). Each call returns a fresh client (one per WebSocket session); register handlers and then call connect(). For the current temporary release the endpoint accepts tokens holding either the stream or the realtime scope, so the default scopes work as-is; pass scopes: [Scope.Realtime] to mint realtime-scoped tokens explicitly.
Returns
RealtimeClient
getToken()
getToken(): Promise<string>;
Return a currently-valid bearer token (minting/refreshing as needed).
Returns
Promise<string>

InterhumanError

Base class for every error the SDK throws.

Extends

  • Error

Extended by

Constructors

Constructor
new InterhumanError(message): InterhumanError;
Parameters
ParameterType
messagestring
Returns
InterhumanError
Overrides
Error.constructor

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
new InterhumanApiError(args): InterhumanApiError;
Parameters
ParameterType
args{ status: number; body?: ApiErrorBody; message?: string; }
args.statusnumber
args.body?ApiErrorBody
args.message?string
Returns
InterhumanApiError
Overrides
InterhumanError.constructor

Properties

PropertyModifierTypeDescription
statusreadonlynumberHTTP status code.
errorId?readonlystringMachine-readable error code (e.g. "ih2001"), when present.
correlationId?readonlystringCorrelation id for support, when present.
link?readonlystringDocumentation link for the error, when present.
body?readonlyApiErrorBodyThe raw parsed error body, when the server returned JSON.

InterhumanConfigError

A configuration/usage error caught before any network call. Stream error 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
new InterhumanConfigError(message): InterhumanConfigError;
Parameters
ParameterType
messagestring
Returns
InterhumanConfigError
Inherited from
InterhumanError.constructor

RealtimeClient

A typed client over the real-time WebSocket protocol. The real-time endpoint shares the stream endpoint’s session mechanics (subprotocol bearer auth, binary video frames, JSON envelopes down, and the requestClose() graceful shutdown handshake) and adds multi-track analysis, a caller-supplied transcript (sendTranscript), a live server transcript (transcript.generated), and a periodic feedback step (realtime_feedback.generated) enabled through the session config’s realtime_feedback_instructions. Unlike the stream endpoint it never emits engagement.updated or conversation_quality.updated. Temporary release: the endpoint currently ships under the v0 path (/v0/realtime/analyze) and accepts credentials holding either the interhumanai.stream or the interhumanai.realtime scope, so existing stream-scoped keys work without a new permission. Both aspects may change when the endpoint graduates to v1. The previous hyphenated spelling (/v0/real-time/analyze) still works as a temporary compatibility alias, but new integrations should use /v0/realtime/analyze.

Example

const realtime = client.realtime();
realtime.on("signal.detected", (e) => console.log(e.data.signal_type));
realtime.on("realtime_feedback.generated", (e) => console.log(e.data.text));
await realtime.connect();
await realtime.waitForSessionReady();
realtime.updateConfig({
  realtime_feedback_instructions: "Goal: help me close a sales call.",
  realtime_feedback_frequency: "medium",
});
realtime.sendVideo(chunk);
realtime.requestClose(); // graceful: drains (incl. feedback), then session.ended + close

Extends

Constructors

Constructor
new RealtimeClient(options): RealtimeClient;
Parameters
ParameterType
optionsSessionSocketClientOptions
Returns
RealtimeClient
Overrides
SessionSocketClient.constructor

Properties

PropertyModifierTypeDefault valueDescriptionOverrides
endpointPathreadonly"/v0/realtime/analyze""/v0/realtime/analyze"Endpoint path appended to the WebSocket base URL (e.g. /v1/stream/analyze).SessionSocketClient.endpointPath
clientNamereadonly"RealtimeClient""RealtimeClient"Concrete class name used in configuration error messages.SessionSocketClient.clientName
displayNamereadonly"Real-time""Real-time"Human-readable surface name used in error messages (e.g. "Stream").SessionSocketClient.displayName
scopeHintreadonly"The credentials may be invalid or lack the stream or realtime scope.""The credentials may be invalid or lack the stream or realtime scope."Appended to the connect-rejection message to hint at the likely scope issue.SessionSocketClient.scopeHint

Accessors

isOpen
Get Signature
get isOpen(): boolean;
Whether the underlying socket is open.
Returns
boolean
Inherited from
SessionSocketClient.isOpen

Methods

sendTranscript()
sendTranscript(transcript): void;
Send (or replace) the caller-supplied transcript as a transcript.updated text frame. The most recent transcript replaces any prior one for the session and is rendered into the feedback 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
ParameterType
transcriptTranscriptSegment[]
Returns
void
on()
on<K>(event, handler): () => void;
Subscribe to an event. Returns an unsubscribe function. Use a specific envelope type (e.g. "signal.detected"), "message" for every envelope, or a lifecycle event ("open", "close", "socketError").
Type Parameters
Type Parameter
K extends keyof RealtimeEventMap
Parameters
ParameterType
eventK
handlerListener<RealtimeEventMap[K]>
Returns
() => void
Inherited from
SessionSocketClient.on
off()
off<K>(event, handler): void;
Unsubscribe a previously registered handler.
Type Parameters
Type Parameter
K extends keyof RealtimeEventMap
Parameters
ParameterType
eventK
handlerListener<RealtimeEventMap[K]>
Returns
void
Inherited from
SessionSocketClient.off
once()
once<K>(event, handler): () => void;
Subscribe to the next occurrence of an event, then auto-unsubscribe.
Type Parameters
Type Parameter
K extends keyof RealtimeEventMap
Parameters
ParameterType
eventK
handlerListener<RealtimeEventMap[K]>
Returns
() => void
Inherited from
SessionSocketClient.once
connect()
connect(): Promise<void>;
Open the connection and resolve once it is established. Rejects if the connection closes or errors before opening (e.g. invalid credentials).
Returns
Promise<void>
Inherited from
SessionSocketClient.connect
waitForSessionReady()
waitForSessionReady(): Promise<RealtimeSessionReadyEvent>;
Wait for the 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()
sendVideo(chunk): void;
Send a chunk of WebM or fragmented-MP4 video as a binary frame.
Parameters
ParameterType
chunkVideoChunk
Returns
void
Inherited from
SessionSocketClient.sendVideo
updateConfig()
updateConfig(config): void;
Send (or replace) the session config. Each frame fully replaces the active config; the server acknowledges with a session.updated envelope.
Parameters
ParameterType
configRealtimeSessionConfig
Returns
void
Inherited from
SessionSocketClient.updateConfig
requestClose()
requestClose(): void;
Request a graceful end-of-analysis shutdown (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()
close(code?, reason?): void;
Close the connection immediately, without the graceful drain handshake.
Parameters
ParameterType
code?number
reason?string
Returns
void
Inherited from
SessionSocketClient.close
sendJson()
protected sendJson(payload): void;
Send an arbitrary JSON payload as a text frame.
Parameters
ParameterType
payloadunknown
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 real-time the transcript) as text frames.

Extended by

Type Parameters

Type ParameterDescription
TEventMap extends SessionSocketEventMapBase<unknown, unknown>Event payloads keyed by event name (envelope types plus the lifecycle events of SessionSocketEventMapBase).
TConfig extends objectThe client→server session-config shape.

Constructors

Constructor
new SessionSocketClient<TEventMap, TConfig>(options): SessionSocketClient<TEventMap, TConfig>;
Parameters
ParameterType
optionsSessionSocketClientOptions
Returns
SessionSocketClient<TEventMap, TConfig>

Properties

PropertyModifierTypeDescription
endpointPathabstractstringEndpoint path appended to the WebSocket base URL (e.g. /v1/stream/analyze).
clientNameabstractstringConcrete class name used in configuration error messages.
displayNameabstractstringHuman-readable surface name used in error messages (e.g. "Stream").
scopeHintabstractstringAppended to the connect-rejection message to hint at the likely scope issue.

Accessors

isOpen
Get Signature
get isOpen(): boolean;
Whether the underlying socket is open.
Returns
boolean

Methods

on()
on<K>(event, handler): () => void;
Subscribe to an event. Returns an unsubscribe function. Use a specific envelope type (e.g. "signal.detected"), "message" for every envelope, or a lifecycle event ("open", "close", "socketError").
Type Parameters
Type Parameter
K extends string | number | symbol
Parameters
ParameterType
eventK
handlerListener<TEventMap[K]>
Returns
() => void
off()
off<K>(event, handler): void;
Unsubscribe a previously registered handler.
Type Parameters
Type Parameter
K extends string | number | symbol
Parameters
ParameterType
eventK
handlerListener<TEventMap[K]>
Returns
void
once()
once<K>(event, handler): () => void;
Subscribe to the next occurrence of an event, then auto-unsubscribe.
Type Parameters
Type Parameter
K extends string | number | symbol
Parameters
ParameterType
eventK
handlerListener<TEventMap[K]>
Returns
() => void
connect()
connect(): Promise<void>;
Open the connection and resolve once it is established. Rejects if the connection closes or errors before opening (e.g. invalid credentials).
Returns
Promise<void>
waitForSessionReady()
waitForSessionReady(): Promise<TEventMap["session.ready"]>;
Wait for the 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()
sendVideo(chunk): void;
Send a chunk of WebM or fragmented-MP4 video as a binary frame.
Parameters
ParameterType
chunkVideoChunk
Returns
void
updateConfig()
updateConfig(config): void;
Send (or replace) the session config. Each frame fully replaces the active config; the server acknowledges with a session.updated envelope.
Parameters
ParameterType
configTConfig
Returns
void
requestClose()
requestClose(): void;
Request a graceful end-of-analysis shutdown (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()
close(code?, reason?): void;
Close the connection immediately, without the graceful drain handshake.
Parameters
ParameterType
code?number
reason?string
Returns
void
sendJson()
protected sendJson(payload): void;
Send an arbitrary JSON payload as a text frame.
Parameters
ParameterType
payloadunknown
Returns
void

StreamClient

A typed client over the stream 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 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

const stream = client.stream();
stream.on("signal.detected", (e) => console.log(e.data.signal_type));
await stream.connect();
await stream.waitForSessionReady();
stream.updateConfig({ include: ["conversation_quality_overall"] });
stream.sendVideo(chunk);
stream.requestClose(); // graceful: drains, then session.ended + close

Extends

Constructors

Constructor
new StreamClient(options): StreamClient;
Parameters
ParameterType
optionsSessionSocketClientOptions
Returns
StreamClient
Overrides
SessionSocketClient.constructor

Properties

PropertyModifierTypeDefault valueDescriptionOverrides
endpointPathreadonly"/v1/stream/analyze""/v1/stream/analyze"Endpoint path appended to the WebSocket base URL (e.g. /v1/stream/analyze).SessionSocketClient.endpointPath
clientNamereadonly"StreamClient""StreamClient"Concrete class name used in configuration error messages.SessionSocketClient.clientName
displayNamereadonly"Stream""Stream"Human-readable surface name used in error messages (e.g. "Stream").SessionSocketClient.displayName
scopeHintreadonly"The credentials may be invalid or lack the stream scope.""The credentials may be invalid or lack the stream scope."Appended to the connect-rejection message to hint at the likely scope issue.SessionSocketClient.scopeHint

Accessors

isOpen
Get Signature
get isOpen(): boolean;
Whether the underlying socket is open.
Returns
boolean
Inherited from
SessionSocketClient.isOpen

Methods

on()
on<K>(event, handler): () => void;
Subscribe to an event. Returns an unsubscribe function. Use a specific envelope type (e.g. "signal.detected"), "message" for every envelope, or a lifecycle event ("open", "close", "socketError").
Type Parameters
Type Parameter
K extends keyof StreamEventMap
Parameters
ParameterType
eventK
handlerListener<StreamEventMap[K]>
Returns
() => void
Inherited from
SessionSocketClient.on
off()
off<K>(event, handler): void;
Unsubscribe a previously registered handler.
Type Parameters
Type Parameter
K extends keyof StreamEventMap
Parameters
ParameterType
eventK
handlerListener<StreamEventMap[K]>
Returns
void
Inherited from
SessionSocketClient.off
once()
once<K>(event, handler): () => void;
Subscribe to the next occurrence of an event, then auto-unsubscribe.
Type Parameters
Type Parameter
K extends keyof StreamEventMap
Parameters
ParameterType
eventK
handlerListener<StreamEventMap[K]>
Returns
() => void
Inherited from
SessionSocketClient.once
connect()
connect(): Promise<void>;
Open the connection and resolve once it is established. Rejects if the connection closes or errors before opening (e.g. invalid credentials).
Returns
Promise<void>
Inherited from
SessionSocketClient.connect
waitForSessionReady()
waitForSessionReady(): Promise<SessionReadyEvent>;
Wait for the 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()
sendVideo(chunk): void;
Send a chunk of WebM or fragmented-MP4 video as a binary frame.
Parameters
ParameterType
chunkVideoChunk
Returns
void
Inherited from
SessionSocketClient.sendVideo
updateConfig()
updateConfig(config): void;
Send (or replace) the session config. Each frame fully replaces the active config; the server acknowledges with a session.updated envelope.
Parameters
ParameterType
configStreamSessionConfig
Returns
void
Inherited from
SessionSocketClient.updateConfig
requestClose()
requestClose(): void;
Request a graceful end-of-analysis shutdown (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()
close(code?, reason?): void;
Close the connection immediately, without the graceful drain handshake.
Parameters
ParameterType
code?number
reason?string
Returns
void
Inherited from
SessionSocketClient.close
sendJson()
protected sendJson(payload): void;
Send an arbitrary JSON payload as a text frame.
Parameters
ParameterType
payloadunknown
Returns
void
Inherited from
SessionSocketClient.sendJson

UploadClient

Analyzes a complete video file and returns a single report. The request is sent as multipart/form-data with the bearer token attached automatically from the configured TokenProvider.

Constructors

Constructor
new UploadClient(options): UploadClient;
Parameters
ParameterType
optionsUploadClientOptions
Returns
UploadClient

Methods

analyze()
analyze(input): Promise<AnalysisResult>;
Analyze a video file in upload mode.
Parameters
ParameterType
inputAnalyzeUploadInput
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

PropertyTypeDescription
baseUrl?stringExplicit base URL (e.g. http://localhost:8080). Overrides environment.
environment?EnvironmentNamed environment to target. Defaults to "production".
fetch?{ (input, init?): Promise<Response>; (input, init?): Promise<Response>; }Custom fetch implementation. Defaults to the global fetch.

TokenProvider

Anything that can supply a bearer token on demand.

Methods

getToken()
getToken(): Promise<string>;
Return a currently-valid bearer token, minting/refreshing as needed.
Returns
Promise<string>

TokenManagerOptions

Options for a TokenManager.

Properties

PropertyTypeDescription
authClientAuthClient-
credentialsApiKeyCredentials-
scopesScopeValue[]Scopes to request when minting tokens.
refreshSkewSeconds?numberRefresh a cached token this many seconds before its stated expiry, to absorb clock skew and request latency. Defaults to 30.
now?() => numberInjectable clock (milliseconds). Defaults to Date.now. Test seam.

ApiKeyCredentials

Credentials issued in the Interhuman customer platform.

Extended by

Properties

PropertyTypeDescription
keyIdstringAPI key ID from the dashboard.
keySecretstringAPI key secret from the dashboard.

ApiKeyCredential

A full API key string used to mint and revoke client tokens.

Extended by

Properties

PropertyTypeDescription
apiKeystringYour full API key from the dashboard (ih_<env>_<publicId>_<entropy>).

TokenRequest

Request body for POST /v1/auth.

Extends

Properties

PropertyTypeDescriptionInherited from
keyIdstringAPI key ID from the dashboard.ApiKeyCredentials.keyId
keySecretstringAPI key secret from the dashboard.ApiKeyCredentials.keySecret
scopesScopeValue[]Requested scopes; at least one is required.-

TokenResponse

Response body from POST /v1/auth.

Properties

PropertyTypeDescription
access_tokenstringThe minted bearer access token (a JWT).
token_typestringToken type; always "Bearer".
expires_innumberSeconds until the token expires (typically 900).
scopestringSpace-separated list of granted scopes.

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 real-time endpoints directly. Every cap is optional. The token grants only the requested scopes (default interhumanai.stream); the caps are enforced on streaming sessions (stream / real-time) and the video budget additionally spans upload.

Extends

Properties

PropertyTypeDescriptionInherited from
apiKeystringYour full API key from the dashboard (ih_<env>_<publicId>_<entropy>).ApiKeyCredential.apiKey
scopes?ScopeValue[]Scopes to grant the token. Defaults to ["interhumanai.stream"].-
expiresIn?numberRequested lifetime in seconds. Clamped to 60–3600; defaults to 300.-
maxDurationSeconds?numberMax wall-clock duration, in seconds, of a session opened with this token.-
maxBytes?numberMax cumulative video bytes a session opened with this token may send.-
maxConcurrent?numberMax number of concurrent sessions opened with this token. Defaults to 1 (one session at a time) when omitted server-side.-
maxVideoSeconds?numberMax total seconds of video the token may process across upload/stream/real-time.-
allowedOrigins?string[]Allow-list of browser Origin values permitted to use this token.-

ClientTokenResponse

Response body from POST /v1/client_tokens.

Properties

PropertyTypeDescription
access_tokenstringThe minted client token (a JWT).
token_typestringToken type; always "Bearer".
expires_innumberSeconds until the token expires.
scopestringSpace-separated list of granted scopes.
max_duration_seconds?number | nullPer-token max session duration that will be enforced, if any.
max_bytes?number | nullPer-token max cumulative session bytes that will be enforced, if any.
max_concurrent?number | nullPer-token max concurrent sessions that will be enforced, if any.
max_video_seconds?number | nullPer-token total video-seconds budget that will be enforced, if any.
allowed_origins?string[] | nullPer-token allow-list of browser origins that will be enforced, if any.

RevokeClientTokenRequest

Request for revoking a client token (POST /v1/client_tokens/revoke).

Extends

Properties

PropertyTypeDescriptionInherited from
apiKeystringYour full API key from the dashboard (ih_<env>_<publicId>_<entropy>).ApiKeyCredential.apiKey
tokenstringThe client token to revoke (as returned in access_token).-

InterhumanClientOptions

Options for constructing an InterhumanClient.

Properties

PropertyTypeDescription
credentials?ApiKeyCredentialsAPI-key credentials. The client exchanges these at /v1/auth and refreshes the resulting token automatically. Provide either credentials or accessToken.
accessToken?stringA pre-issued bearer access token, used as-is. Provide either accessToken or credentials.
scopes?ScopeValue[]Scopes requested when minting tokens from credentials. Defaults to upload + stream. Ignored when accessToken is supplied.
environment?EnvironmentNamed environment to target. Defaults to "production".
baseUrl?stringExplicit base URL (e.g. http://localhost:8080). Overrides environment.
fetch?{ (input, init?): Promise<Response>; (input, init?): Promise<Response>; }Custom fetch implementation. Defaults to the global fetch.
webSocket?WebSocketFactoryCustom WebSocket factory for the stream and real-time clients. Defaults to the global WebSocket (browsers, Node 22+).
refreshSkewSeconds?numberSeconds before stated expiry to refresh a minted token. Defaults to 30.

ApiErrorBody

The canonical error body returned by every HTTP error path.

Properties

PropertyTypeDescription
error_idstringMachine-readable error code, e.g. "ih2001".
correlation_id?string | nullConnection/request correlation id; quote it when contacting support.
link?string | nullURL with more information about this error, when available.
message?string | nullHuman-readable explanation, when available.

TranscriptSegment

One diarized utterance of a real-time transcript. The same shape is used for the transcript you send (sendTranscript) and the live transcript the server streams back (transcript.generated).

Properties

PropertyTypeDescription
startnumberStart time of the utterance, in seconds.
endnumberEnd time of the utterance, in seconds.
textstringThe spoken text of this segment.
speakernumberZero-based index identifying the speaker of this segment.

RealtimeSessionConfig

Client-to-server real-time session config (sent as a JSON text frame). The last config sent fully replaces the active one; the server acknowledges with a session.updated envelope. The stream include flags are not accepted — the real-time endpoint never emits the conversation-quality or engagement updates those flags control.

Properties

PropertyTypeDescription
analysis_groups?AnalysisGroup[]Analysis surfaces to run for this session, any subset of what the server advertises on session.ready under supported_session_config_options.analysis_groups. Must be non-empty when present: an empty array — like selecting a group the server has not enabled — is rejected with an error envelope. When omitted, the server default is audio + visual (not video), clamped to what the deployment allows.
realtime_feedback_frequency?RealtimeFeedbackFrequencyHow often feedback runs once enabled. Has no effect until a non-empty realtime_feedback_instructions enables feedback.
realtime_feedback_instructions?stringConfiguration block for the periodic feedback step, and the switch that enables it: feedback runs only when this is a non-empty string (there is no default prompt). It sets the goal, domain/context, and the focus, tone, or output style of the guidance. It is treated as untrusted configuration data — it shapes the guidance but cannot override the server’s feedback task or output contract.

TranscriptUpdatedFrame

The inbound transcript.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 feedback prompt.

Properties

PropertyTypeDescription
type"transcript.updated"-
transcriptTranscriptSegment[]The full transcript as {start, end, text, speaker} segments, in spoken order.

RealtimeSessionReadyConfigOptions

Supported real-time session-config options advertised on session.ready. Unlike the stream options, only the real-time controls appear here — never the stream include / goal_dimensions options.

Properties

PropertyTypeDescription
realtime_feedback_instructions"string"Always the literal "string": realtime_feedback_instructions takes free-form text, so its accepted JSON type is advertised instead of a value list.
realtime_feedback_frequencyRealtimeFeedbackFrequency[]Accepted realtime_feedback_frequency values.
analysis_groupsAnalysisGroup[]Analysis groups this deployment allows — the valid values for the config’s analysis_groups field, so you can pick a subset without round-tripping a rejection.

RealtimeSessionReadyData

session.ready payload — the same connection-level limits as the stream session.ready, with the real-time supported-config options.

Properties

PropertyTypeDescription
session_idle_timeout_secondsnumberIdle seconds tolerated before the server closes the session (0 = disabled).
session_max_duration_secondsnumberMaximum total session duration in seconds (0 = disabled).
max_segment_duration_secondsnumber | nullMax probed duration of one inbound chunk, or null when only the size cap binds.
min_segment_size_bytesnumberMinimum size in bytes of one inbound chunk.
max_segment_size_bytesnumberMaximum size in bytes of one inbound chunk.
supported_session_config_optionsRealtimeSessionReadyConfigOptions-

RealtimeSessionReadyEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
type"session.ready"--
dataRealtimeSessionReadyData--
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id

RealtimeSessionUpdatedData

session.updated payload — the consolidated real-time config after a config frame applied. Reports only the real-time options, never the stream-only include / goal_dimensions fields.

Properties

PropertyTypeDescription
realtime_feedback_instructionsstring | nullThe applied realtime_feedback_instructions, echoed back verbatim; null when unset.
realtime_feedback_frequencyRealtimeFeedbackFrequency | nullThe active feedback frequency; null when unset.
analysis_groupsAnalysisGroup[]The effective analysis-group selection in force, already clamped to what the deployment allows (the server default when you have not chosen one).

RealtimeSessionUpdatedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
type"session.updated"--
dataRealtimeSessionUpdatedData--
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id

TranscriptGeneratedEvent

transcript.generated — the server’s own live transcription of the analyzed audio, emitted when the deployment’s transcription track produced new speech. Each event carries only text not already sent, so concatenating the text of successive events reconstructs the running transcript without duplication. speaker is always 0 (single-speaker transcription).

Extends

Properties

PropertyTypeDescriptionInherited from
type"transcript.generated"--
dataTranscriptSegment--
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id

RealtimeFeedbackGeneratedData

realtime_feedback.generated payload — one feedback run’s guidance text.

Properties

PropertyTypeDescription
textstringThe guidance text returned by the feedback model — one short recommendation for the responding speaker, or the literal NO_GUIDANCE when the signals warrant no adjustment.
startnumberStart of the analyzed interval this feedback covers (seconds, session time).
endnumberEnd of the analyzed interval this feedback covers (seconds, session time).

RealtimeFeedbackGeneratedEvent

realtime_feedback.generated — the periodic feedback result. Emitted only when realtime_feedback_instructions has enabled feedback, paced by realtime_feedback_frequency.

Extends

Properties

PropertyTypeDescriptionInherited from
type"realtime_feedback.generated"--
dataRealtimeFeedbackGeneratedData--
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id

RealtimeEventMap

Event payloads keyed by event name, for the typed on/off surface of the real-time client. The envelope types map to their envelope objects; the remaining keys are client-level lifecycle events.

Properties

PropertyTypeDescription
session.readyRealtimeSessionReadyEvent-
session.updatedRealtimeSessionUpdatedEvent-
session.closingSessionClosingEvent-
session.endedSessionEndedEvent-
signal.detectedSignalDetectedEvent-
signal.updatedSignalUpdatedEvent-
signal.endedSignalEndedEvent-
transcript.generatedTranscriptGeneratedEvent-
realtime_feedback.generatedRealtimeFeedbackGeneratedEvent-
coverage.droppedCoverageDroppedEvent-
errorStreamErrorEvent-
messageRealtimeEventFires for every server→client envelope, regardless of type.
openvoidFires once when the WebSocket connection opens.
closeStreamCloseInfoFires once when the connection closes.
socketErrorErrorTransport-level socket error (distinct from the error envelope).

SessionSocketClientOptions

Options shared by every WebSocket session client.

Properties

PropertyTypeDescription
tokenProviderTokenProviderSupplies the bearer token used to authenticate the connection.
baseUrl?stringExplicit base URL (e.g. http://localhost:8080). Overrides environment.
environment?EnvironmentNamed environment to target. Defaults to "production".
webSocket?WebSocketFactoryCustom WebSocket factory. Defaults to the global WebSocket (browsers, Node 22+). Supply one backed by the ws package on older Node.

SessionSocketEventMapBase

The lifecycle and wildcard events every session event map carries, alongside its protocol-specific envelope type keys. TEvent is the protocol’s envelope union and TReady its session.ready envelope.

Type Parameters

Type Parameter
TEvent
TReady

Properties

PropertyTypeDescription
session.readyTReadyThe session.ready envelope — first frame after the handshake.
messageTEventFires for every server→client envelope, regardless of type.
openvoidFires once when the WebSocket connection opens.
closeStreamCloseInfoFires once when the connection closes.
socketErrorErrorTransport-level socket error (distinct from the error envelope).

StreamEnvelopeBase

Fields shared by every server→client envelope.

Extended by

Properties

PropertyTypeDescription
timestampstringISO 8601 timestamp identifying when the event occurred.
correlation_idstringConnection correlation id; quote it when contacting support.

SessionReadyConfigOptions

Supported session-config options advertised on session.ready.

Properties

PropertyTypeDescription
includeIncludeFlag[]-
goal_dimensionsGoalDimension[] | nullnull when the feedback feature is disabled.

SessionReadyData

session.ready payload — session limits and supported config.

Properties

PropertyTypeDescription
session_idle_timeout_secondsnumberIdle seconds tolerated before the server closes the session (0 = disabled).
session_max_duration_secondsnumberMaximum total session duration in seconds (0 = disabled).
max_segment_duration_secondsnumber | nullMax probed duration of one inbound chunk, or null when only the size cap binds.
min_segment_size_bytesnumberMinimum size in bytes of one inbound chunk.
max_segment_size_bytesnumberMaximum size in bytes of one inbound chunk.
supported_session_config_optionsSessionReadyConfigOptions-

SessionReadyEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"session.ready"--
dataSessionReadyData--

SessionUpdatedData

session.updated payload — consolidated config after a config frame applied.

Properties

PropertyType
includeIncludeFlag[]
goal_dimensionsGoalDimension[] | null

SessionUpdatedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"session.updated"--
dataSessionUpdatedData--

SessionClosingData

session.closing payload — the graceful-close drain contract.

Properties

PropertyTypeDescription
max_drain_secondsnumberMaximum seconds the server will spend draining accepted work before it closes the session; session.ended arrives no later than this. The session closes earlier when the accepted work finishes sooner.

SessionClosingEvent

Acknowledges a caller-initiated session.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

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"session.closing"--
dataSessionClosingData--

SessionEndedData

session.ended payload — why the session ended.

Properties

PropertyTypeDescription
reason"client_shutdown"client_shutdown = the caller requested a graceful close.

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

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"session.ended"--
dataSessionEndedData--

SignalDetectedData

Properties

PropertyTypeDescription
signal_typeSignalType-
startnumberSeconds, absolute session-cumulative time.
probabilityProbability | null-
rationalestring | null-

SignalDetectedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"signal.detected"--
dataSignalDetectedData--

SignalUpdatedData

Properties

PropertyType
signal_typeSignalType
startnumber
probabilityProbability | null
rationalestring | null

SignalUpdatedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"signal.updated"--
dataSignalUpdatedData--

SignalEndedData

Properties

PropertyTypeDescription
signal_typeSignalType-
endnumberSeconds, absolute session-cumulative time.

SignalEndedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"signal.ended"--
dataSignalEndedData--

EngagementUpdatedData

Properties

PropertyType
stateEngagementLevel
startnumber

EngagementUpdatedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"engagement.updated"--
dataEngagementUpdatedData--

ConversationQualityUpdatedData

Properties

PropertyTypeDescription
overallConversationQualityValues | nullNon-null when conversation_quality_overall was requested.
timeline| ConversationQualityTimelineEntry[] | nullNon-null when conversation_quality_timeline was requested and the period had signals.

ConversationQualityUpdatedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"conversation_quality.updated"--
dataConversationQualityUpdatedData--

FeedbackGeneratedData

Properties

PropertyTypeDescription
feedbackstringComma-separated relevant signal types observed since the previous emission.

FeedbackGeneratedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"feedback.generated"--
dataFeedbackGeneratedData--

CoverageDroppedRange

A contiguous range of media skipped under backpressure (not billed).

Properties

PropertyType
startnumber
endnumber

CoverageDroppedData

Properties

PropertyType
rangesCoverageDroppedRange[]

CoverageDroppedEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"coverage.dropped"--
dataCoverageDroppedData--

StreamErrorData

Properties

PropertyTypeDescription
codestringMachine-readable error code (e.g. "ih6002").
messagestring-
linkstring | null-
segmentnumber | nullInbound caller-chunk index when applicable, else null.

StreamErrorEvent

Fields shared by every server→client envelope.

Extends

Properties

PropertyTypeDescriptionInherited from
timestampstringISO 8601 timestamp identifying when the event occurred.StreamEnvelopeBase.timestamp
correlation_idstringConnection correlation id; quote it when contacting support.StreamEnvelopeBase.correlation_id
type"error"--
dataStreamErrorData--

StreamSessionConfig

Client-to-server session config (sent as a JSON text frame).

Properties

PropertyTypeDescription
include?IncludeFlag[]Conversation-quality sections to include in result messages.
goal_dimensions?GoalDimension[]Goal dimensions for this session (drive periodic feedback).

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 with session.closing and ends the session with session.ended.

Properties

PropertyType
type"session.close"

StreamCloseInfo

Information about a closed stream connection.

Properties

PropertyType
codenumber
reasonstring

StreamEventMap

Event payloads keyed by event name, for the typed on/off surface. The twelve envelope types map to their envelope objects; the remaining keys are client-level lifecycle events.

Properties

PropertyTypeDescription
session.readySessionReadyEvent-
session.updatedSessionUpdatedEvent-
session.closingSessionClosingEvent-
session.endedSessionEndedEvent-
signal.detectedSignalDetectedEvent-
signal.updatedSignalUpdatedEvent-
signal.endedSignalEndedEvent-
engagement.updatedEngagementUpdatedEvent-
conversation_quality.updatedConversationQualityUpdatedEvent-
feedback.generatedFeedbackGeneratedEvent-
coverage.droppedCoverageDroppedEvent-
errorStreamErrorEvent-
messageStreamEventFires for every server→client envelope, regardless of type.
openvoidFires once when the WebSocket connection opens.
closeStreamCloseInfoFires once when the connection closes.
socketErrorErrorTransport-level socket error (distinct from the error envelope).

WebSocketLike

The subset of the WHATWG WebSocket interface the SDK relies on. Both the browser WebSocket and Node 22+‘s global WebSocket satisfy this.

Properties

PropertyModifierType
readyStatereadonlynumber
binaryTypepublicstring

Methods

send()
send(data): void;
Parameters
ParameterType
datastring | Blob | ArrayBufferLike | ArrayBufferView<ArrayBufferLike>
Returns
void
close()
close(code?, reason?): void;
Parameters
ParameterType
code?number
reason?string
Returns
void
addEventListener()
addEventListener(type, listener): void;
Parameters
ParameterType
typestring
listener(event) => void
Returns
void
removeEventListener()
removeEventListener(type, listener): void;
Parameters
ParameterType
typestring
listener(event) => void
Returns
void

Signal

A single social signal detected over a span of the analyzed media.

Properties

PropertyTypeDescription
typeSignalType-
startnumberStart time in seconds.
endnumberEnd time in seconds.
probabilityProbability | null-
rationalestring | null-

EngagementStateEntry

A contiguous stretch of media labeled with a single engagement state.

Properties

PropertyType
stateEngagementLevel
startnumber
endnumber

ConversationQualityValues

The five conversation-quality dimension scores plus their mean (0–100).

Properties

PropertyType
quality_indexnumber
claritynumber
authoritynumber
energynumber
rapportnumber
learningnumber

ConversationQualityTimelineEntry

Conversation-quality scores for one window of the timeline.

Properties

PropertyType
startnumber
endnumber
valuesConversationQualityValues

ConversationQuality

Overall and time-varying conversation-quality scores.

Properties


InteractionFeedback

Structured interaction feedback returned by the coach model.

Properties

PropertyType
typeFeedbackType
message?string | null
active_dimensions?GoalDimension[]
primary_signal?SignalType | null
reason?string | null

AnalysisResult

The full report returned by POST /v1/upload/analyze.

Properties

PropertyType
signalsSignal[]
engagement_stateEngagementStateEntry[]
feedback?InteractionFeedback | null
conversation_quality?ConversationQuality | null

AnalyzeUploadInput

Arguments for UploadClient.analyze.

Properties

PropertyTypeDescription
fileVideoInputThe video file to analyze (mp4/avi/mov/mkv/mpeg-ts/webm, ≥3s, ≤32MB).
filename?stringFilename used when file is a Blob without a name. Defaults to "video".
include?IncludeFlag[]Optional response sections to include. When omitted, conversation-quality scores are not returned.
goalDimensions?GoalDimension[]Optional goal dimensions for this interaction. Supplying at least one triggers interaction feedback. Ignored when conversationContext is set.
conversationContext?stringOptional free-text scenario description. When set, it is the sole source of context for feedback generation and goalDimensions is ignored.
signal?AbortSignalOptional AbortSignal to cancel the request.

UploadClientOptions

Options for constructing an UploadClient.

Properties

PropertyTypeDescription
tokenProviderTokenProviderSupplies the bearer token attached to each request.
baseUrl?stringExplicit base URL (e.g. http://localhost:8080). Overrides environment.
environment?EnvironmentNamed environment to target. Defaults to "production".
fetch?{ (input, init?): Promise<Response>; (input, init?): Promise<Response>; }Custom fetch implementation. Defaults to the global fetch.

Type Aliases

Environment

type Environment = "production" | "staging";
A named Interhuman API environment.

RealtimeClientOptions

type RealtimeClientOptions = SessionSocketClientOptions;
Options for constructing a RealtimeClient.

AnalysisGroup

type AnalysisGroup = "video" | "visual" | "audio";
Top-level analysis surfaces a real-time session can run. Each group maps to one or more server-side analysis tracks: video is the Inter-1 social-signal analysis, visual the visual-signals track, and audio the audio tracks.

RealtimeFeedbackFrequency

type RealtimeFeedbackFrequency = "high" | "medium" | "low";
How often the feedback step runs, measured in analyzed video: high = every 10 seconds, medium = every 20 seconds, low = every 30 seconds. Only takes effect once realtime_feedback_instructions has enabled feedback.

RealtimeEvent

type RealtimeEvent = 
  | RealtimeSessionReadyEvent
  | RealtimeSessionUpdatedEvent
  | SessionClosingEvent
  | SessionEndedEvent
  | SignalDetectedEvent
  | SignalUpdatedEvent
  | SignalEndedEvent
  | TranscriptGeneratedEvent
  | RealtimeFeedbackGeneratedEvent
  | CoverageDroppedEvent
  | StreamErrorEvent;
Discriminated union of every real-time server→client envelope.

VideoChunk

type VideoChunk = Uint8Array | ArrayBuffer | ArrayBufferView | Blob;
A chunk of WebM or fragmented-MP4 video to stream to the server.

Listener

type Listener<T> = (payload) => void;
An event handler registered via on/once.

Type Parameters

Type Parameter
T

Parameters

ParameterType
payloadT

Returns

void

StreamClientOptions

type StreamClientOptions = SessionSocketClientOptions;
Options for constructing a StreamClient.

StreamEvent

type StreamEvent = 
  | SessionReadyEvent
  | SessionUpdatedEvent
  | SessionClosingEvent
  | SessionEndedEvent
  | SignalDetectedEvent
  | SignalUpdatedEvent
  | SignalEndedEvent
  | EngagementUpdatedEvent
  | ConversationQualityUpdatedEvent
  | FeedbackGeneratedEvent
  | CoverageDroppedEvent
  | StreamErrorEvent;
Discriminated union of every server→client envelope.

WebSocketFactory

type WebSocketFactory = (url, protocols?) => WebSocketLike;
Constructs a WebSocketLike from a URL and optional subprotocols.

Parameters

ParameterType
urlstring
protocols?string | string[]

Returns

WebSocketLike

ScopeValue

type ScopeValue = 
  | "interhumanai.upload"
  | "interhumanai.stream"
  | "interhumanai.realtime";
OAuth-style scopes an API key can carry.

SignalType

type SignalType = 
  | "agreement"
  | "confidence"
  | "confusion"
  | "disagreement"
  | "disengagement"
  | "engagement"
  | "frustration"
  | "hesitation"
  | "interest"
  | "skepticism"
  | "stress"
  | "uncertainty";
Social signal types the model can detect.

Probability

type Probability = "high" | "medium" | "low";
Confidence level attached to a detected signal.

EngagementLevel

type EngagementLevel = "engaged" | "neutral" | "disengaged";
Engagement state of the analyzed subject.

GoalDimension

type GoalDimension = "clarity" | "authority" | "energy" | "rapport" | "learning";
Conversation-quality dimensions a caller can flag as a session goal.

IncludeFlag

type IncludeFlag = "conversation_quality_overall" | "conversation_quality_timeline";
Optional response sections the caller may request.

FeedbackType

type FeedbackType = "feedback" | "no_feedback";
Discriminator for the structured interaction-feedback result.

VideoInput

type VideoInput = 
  | Blob
  | {
  data: Uint8Array | ArrayBuffer | Blob;
  filename?: string;
  contentType?: string;
};
The video to analyze. Either a Blob/File (browsers, or Node 18+ where Blob is global) or raw bytes plus a filename.

Union Members

Blob
Type Literal
{
  data: Uint8Array | ArrayBuffer | Blob;
  filename?: string;
  contentType?: string;
}
data
data: Uint8Array | ArrayBuffer | Blob;
Raw video bytes.
filename?
optional filename?: string;
Filename to report in the multipart part, e.g. "clip.mp4".
contentType?
optional contentType?: string;
MIME type, e.g. "video/mp4".

Variables

HTTP_BASE_URLS

const HTTP_BASE_URLS: Record<Environment, string>;
HTTP base URLs per named environment.

AnalysisGroup

AnalysisGroup: {
  Video: "video";
  Visual: "visual";
  Audio: "audio";
};
Named analysis-group constants.

Type Declaration

Video
readonly Video: "video" = "video";
Inter-1 social-signal analysis.
Visual
readonly Visual: "visual" = "visual";
The visual-signals track.
Audio
readonly Audio: "audio" = "audio";
The audio tracks.

RealtimeFeedbackFrequency

RealtimeFeedbackFrequency: {
  High: "high";
  Medium: "medium";
  Low: "low";
};
Named feedback-frequency constants.

Type Declaration

High
readonly High: "high" = "high";
Feedback runs every 10 seconds of analyzed video.
Medium
readonly Medium: "medium" = "medium";
Feedback runs every 20 seconds of analyzed video.
Low
readonly Low: "low" = "low";
Feedback runs every 30 seconds of analyzed video.

WS_READY_STATE

const WS_READY_STATE: {
  CONNECTING: 0;
  OPEN: 1;
  CLOSING: 2;
  CLOSED: 3;
};
readyState constants, mirrored from the WHATWG WebSocket spec.

Type Declaration

CONNECTING
readonly CONNECTING: 0 = 0;
OPEN
readonly OPEN: 1 = 1;
CLOSING
readonly CLOSING: 2 = 2;
CLOSED
readonly CLOSED: 3 = 3;

Scope

const Scope: {
  Upload: "interhumanai.upload";
  Stream: "interhumanai.stream";
  Realtime: "interhumanai.realtime";
};
Named scope constants.

Type Declaration

Upload
readonly Upload: "interhumanai.upload" = "interhumanai.upload";
Grants access to POST /v1/upload/analyze.
Stream
readonly Stream: "interhumanai.stream" = "interhumanai.stream";
Grants access to WS /v1/stream/analyze.
Realtime
readonly Realtime: "interhumanai.realtime" = "interhumanai.realtime";
Grants access to WS /v0/realtime/analyze.

GoalDimension

GoalDimension: {
  Clarity: "clarity";
  Authority: "authority";
  Energy: "energy";
  Rapport: "rapport";
  Learning: "learning";
};
Named goal-dimension constants.

Type Declaration

Clarity
readonly Clarity: "clarity" = "clarity";
Authority
readonly Authority: "authority" = "authority";
Energy
readonly Energy: "energy" = "energy";
Rapport
readonly Rapport: "rapport" = "rapport";
Learning
readonly Learning: "learning" = "learning";

IncludeFlag

IncludeFlag: {
  ConversationQualityOverall: "conversation_quality_overall";
  ConversationQualityTimeline: "conversation_quality_timeline";
};
Named include-flag constants.

Type Declaration

ConversationQualityOverall
readonly ConversationQualityOverall: "conversation_quality_overall" = "conversation_quality_overall";
ConversationQualityTimeline
readonly ConversationQualityTimeline: "conversation_quality_timeline" = "conversation_quality_timeline";

Functions

resolveHttpBaseUrl()

function resolveHttpBaseUrl(options): string;
Resolve the HTTP base URL for a client. 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

ParameterType
options{ baseUrl?: string; environment?: Environment; }
options.baseUrl?string
options.environment?Environment

Returns

string

httpToWsBaseUrl()

function httpToWsBaseUrl(httpBaseUrl): string;
Derive the WebSocket origin from an HTTP base URL: httpswss, httpws. Any path on the base URL is preserved (so a proxy mount point survives), with the trailing slash trimmed.

Parameters

ParameterType
httpBaseUrlstring

Returns

string