AbsoluteJS

@absolutejs/voice-soniox

@absolutejs/voice-sonioxv0.0.1-beta.5betaVoice & Media

Soniox real-time speech-to-text adapter for @absolutejs/voice

#Installation

BASH
bun add @absolutejs/voice-soniox

#Capabilities

Overview

Soniox real-time speech-to-text adapter for @absolutejs/voice.

Speaks Soniox's real-time WebSocket protocol directly: connect → send a JSON start-config message carrying the api_key and audio shape → stream binary audio frames → consume token-by-token transcript messages with is_final flags → emit partial / final / endOfTurn events. No Soniox SDK dep.

Use

For mixed-language callers, pair with languageStrategy:

Options

Option — Required — Default — Notes

apiKey — yes — — — Soniox API key (sent in the start-config message body, not as a header).

model — no — stt-rt-preview — Soniox real-time model id.

Show 9 more

languageHints — no — — — Seed list, overridden when STTAdapterOpenOptions.languageStrategy resolves a list.

enableLanguageIdentification — no — — — Tag each token with the detected language.

enableSpeakerDiarization — no — — — Tag each token with a speaker id.

enableEndpointDetection — no — — — Surface finished: true end-of-utterance hints (→ endOfTurn).

context — no — — — Context string passed to Soniox to bias recognition.

clientReferenceId — no — — — Caller-defined id forwarded to Soniox for billing analytics.

baseUrl — no — wss://stt-rt.soniox.com — Override for staging / enterprise endpoints.

connectTimeoutMs — no — 8000 — WebSocket open + config timeout.

webSocket.factory — no — new WebSocket(url) — Inject a fake socket for tests.

Notes

Audio sent before the start-config is sent is buffered and flushed once the socket is open.

Tokens are bucketed by is_final per message: non-final tokens combine into a partial event, final tokens into a final event (a single message can produce both).

Average per-token confidence is lifted onto the transcript; start_ms / end_ms are forwarded as startedAtMs / endedAtMs; per-token language and speaker are lifted from the first / lead token in the bucket.

Show 3 more

finished: true messages emit endOfTurn with reason: "vendor".

session.close(reason) sends the documented empty-string end-of-stream sentinel and then closes the socket cleanly.

Supported encodings on STTAdapterOpenOptions.format.encoding: pcm_s16le, mulaw / pcm_mulaw, alaw / pcm_alaw.

Outcomes

What you can build

Build on the supported package contract

Use @absolutejs/voice-soniox through its supported public entry points.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/voice-soniox version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/voice-soniox example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Use

Partial snippet

Working example for Use.

TS
import { voice } from "@absolutejs/voice";
import { soniox } from "@absolutejs/voice-soniox";

const app = voice({
  stt: soniox({
    apiKey: process.env.SONIOX_API_KEY!,
    // optional:
    model: "stt-rt-preview", // default
    languageHints: ["en", "es"],
    enableLanguageIdentification: true,
    enableSpeakerDiarization: true,
    enableEndpointDetection: true,
    context: "Customer support call about billing.",
  }),
  // ... tts + other options ...
});

#Use 2

Partial snippet

For mixed-language callers, pair with languageStrategy:

TS
soniox({
  apiKey,
  enableLanguageIdentification: true,
});
// open(...) with languageStrategy: { mode: 'allow-switching', primaryLanguage: 'en', secondaryLanguages: ['hi'] }

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

@absolutejs/voice-soniox@absolutejs/voice-soniox/manifest@absolutejs/voice-soniox/manifest.json

#Package commands

Scripts declared by this package manifest.

bun run buildrm -rf dist && bun build ./src/index.ts ./src/manifest.ts --outdir dist --target bun --external @absolutejs/manifest --external '@absolutejs/manifest/*' --external @absolutejs/voice --external '@absolutejs/voice/*' --external @sinclair/typebox --external '@sinclair/typebox/*' && tsc --emitDeclarationOnly --project tsconfig.json && absolute-manifest emit
bun run check:packagebun run format && bun run typecheck && bun run test && bun run verify-package && bun run build && bun run verify-package --artifacts
bun run formatprettier --write "./**/*.{js,ts,json,md}"
bun run testbun test
bun run typecheckbun run tsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

4 symbols
sonioxexportPermalinkSource
TS
soniox
Exported from @absolutejs/voice-soniox