AbsoluteJS

@absolutejs/voice-openai

@absolutejs/voice-openaiv0.0.7-beta.45betaVoice & Media

OpenAI realtime adapter for @absolutejs/voice

#Installation

BASH
bun add @absolutejs/voice-openai

#Capabilities

Overview

Input transcription log probabilities are requested by default and normalized as Transcript.tokens, with aggregate transcript confidence available for provider-neutral routing and calibration. Set inputTranscriptionLogprobs: false to omit the optional Realtime field.

OpenAI realtime adapter for @absolutejs/voice.

Setup

This adapter uses OpenAI's official Realtime WebSocket API and normalizes it into the core RealtimeAdapter contract.

What It Maps

conversation.item.input_audio_transcription.delta -> partial

conversation.item.input_audio_transcription.completed -> final

completed input transcription -> normalized endOfTurn

Show 5 more

response.output_audio.delta -> audio

realtime error events -> normalized error

websocket close -> normalized close

For string input, the adapter emits a local final transcript immediately and then requests an OpenAI response. For audio input, it buffers PCM audio and commits the turn after a short inactivity window.

The response transcript events (response.audio_transcript., response.output_audio_transcript., response.output_text.) are disabled by default to keep the adapter focused on user-input STT. Enable them only if your application intentionally consumes assistant output transcripts.

Input Audio Format

OpenAI Realtime currently expects pcm16 audio at 24kHz mono for streaming audio input. This adapter enforces that requirement when you call send(audio).

Output audio is normalized as raw pcm_s16le at 24kHz mono.

Options

Supported options include:

apiKey

model

Show 10 more

emitResponseTranscripts

voice

instructions

inputTranscriptionModel

inputTranscriptionLanguage

inputTranscriptionPrompt

maxOutputTokens

autoCommitSilenceMs

noiseReduction

responseMode

API Key

Set OPENAI_API_KEY in your runtime environment, or pass the key explicitly in the adapter config.

OpenAI references used for this adapter design:

https://developers.openai.com/api/reference/resources/realtime

Show 1 more

https://developers.openai.com/api/docs/models

Outcomes

What you can build

Build on the supported package contract

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

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/voice-openai 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-openai example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Setup

Partial snippet

Working example for Setup.

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

const realtime = openai({
  apiKey: process.env.OPENAI_API_KEY!,
  model: "gpt-realtime-mini",
  voice: "marin",
  instructions: "Be concise and clear.",
  inputTranscriptionModel: "gpt-4o-mini-transcribe",
});

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

@absolutejs/voice-openai@absolutejs/voice-openai/manifest@absolutejs/voice-openai/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.

9 symbols
openaiexportPermalinkSource
TS
openai
Exported from @absolutejs/voice-openai