Skip to content
OneSay Developers

SDK & API Reference

JavaScript SDK Reference

Package: @onesay/sdk; license: Apache-2.0.

Package: @onesay/sdk; license: Apache-2.0.

Environments

Each environment has its own Control API and Realtime WebSocket endpoint.

EnvironmentControl APIRealtime WebSocket
Productionhttps://api.onesay.com/v1wss://realtime.onesay.com/v1

To reach another regional node, call setCustomEndpoints with the addresses from your configuration and use environment: "custom".

Room events

Each SDK event name and the OneSay event it reports.

  • Connected -> room.connected
  • Disconnected -> room.disconnected
  • Reconnecting -> room.reconnecting
  • Reconnected -> room.reconnected
  • ParticipantJoined -> participant.joined
  • ParticipantLeft -> participant.left
  • SignalOpened -> signal.opened
  • SignalEnded -> signal.ended
  • Error -> error

Task events

Each SDK event name and the OneSay event it reports.

  • Created -> task.created
  • Started -> task.started
  • TranscriptPartial -> artifact.delta
  • TranscriptFinal -> artifact.finalized
  • Completed -> task.completed
  • Failed -> task.failed
  • Cancelled -> task.cancelled

In the browser the SDK authenticates only through the token provider you supply, never with a secret key. Task voice sends the audio you pass in, 16000 Hz mono pcm_s16le; the SDK does not open a microphone for it and never drops audio silently. Helpers convert sample buffers.

Task voice

  • Entry points: client.tasks.create, client.tasks.get, client.tasks.list, client.tasks.cancel, RealtimeClient
  • Transport: onesay.realtime.v1 WebSocket with canonical PCM frames, contiguous ACK, unacked-only replay and bounded resume
  • Results: Task and Artifact readback

Realtime RTC

  • Entry points: client.rtc.connect, client.rtc.get, client.rtc.revoke, client.rtc.endPublication, client.rtc.agents.create, client.rtc.agents.get, client.rtc.agents.stop
  • Transport: OneSay RTC session over the locked native SDK, loaded lazily on the first RTC operation
  • Results: publications, subscriptions, packets, streams, RPC, data tracks and explicit Agent executions

RTC session states

  • connected
  • reconnecting
  • closed

The session state is what this client observes. The server decides every authorization, and a revocation is complete only when the server reports it.

Capabilities

CapabilitySupportDetail
Task voice (WSS, ACK, replay, resume)supportedSupported (browser, Node)
RTC audiosupportedPublish, subscribe, mute, playback (browser)
PacketssupportedSend and receive
StreamssupportedSend and receive
RPCsupportedCall and handle
DataTracksupportedSupported (livekit-client 2.22.3)
AgentssupportedExplicit Agent executions and read-only Agent state
State, device, error, releasesupportedSession state, quality, microphone selection, OneSay errors, close
Selected-mode media encryptionconditionalConditional: where the browser can run the packaged worker

Not exposed: native room, track and participant objects; native token or connection material; native SDK types; an escape hatch to the native SDK. An unsupported capability fails with an explicit error.

See the SDK capability and compatibility page.