AbsoluteJS

@absolutejs/voice-openai-whisper

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

OpenAI Whisper buffered-batch speech-to-text adapter for @absolutejs/voice

#Installation

BASH
bun add @absolutejs/voice-openai-whisper

#Capabilities

Overview

Buffered OpenAI transcription adapter for @absolutejs/voice. It collects raw audio for a turn, wraps PCM input in a WAV container, and sends one transcription request when you flush or close the session.

Buffering behavior

This is a batch adapter, not a realtime streaming transport. send() appends audio to the current turn. flush() transcribes the accumulated buffer and emits final followed by endOfTurn. Closing flushes by default; set flushOnClose: false when the caller owns that lifecycle explicitly.

The default buffer ceiling is 20 MiB. Set maxBufferedBytes to a lower bound for latency or memory control, and flush between turns. Exceeding the bound throws before more audio is retained.

Options

apiKey — required OpenAI API key.

model — defaults to whisper-1; transcription models are accepted.

language — optional language hint; fixed language strategies from voice core

Show 7 more

take precedence.

prompt, temperature, and responseFormat — forwarded to the transcription

endpoint.

organization — sends the OpenAI-Organization header.

baseUrl — targets an OpenAI-compatible endpoint.

fetch — injects a custom fetch implementation for policy, tracing, or tests.

flushOnClose and maxBufferedBytes — control buffering lifecycle.

Errors and events

HTTP failures and malformed provider responses emit a non-recoverable error. Successful responses emit normalized final and endOfTurn events through the standard @absolutejs/voice STTAdapter contract. The adapter does not emit partial transcripts because the provider request happens only at flush time.

Outcomes

What you can build

Build on the supported package contract

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

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/voice-openai-whisper 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-whisper 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 { openaiWhisper } from "@absolutejs/voice-openai-whisper";

const stt = openaiWhisper({
  apiKey: process.env.OPENAI_API_KEY!,
  model: "gpt-4o-mini-transcribe",
  language: "en",
});

const session = stt.open({
  format: {
    channels: 1,
    encoding: "pcm_s16le",
    sampleRateHz: 16_000,
  },
});

session.on("final", ({ transcript }) => {
  console.log(transcript.text);
});

await session.send(audioChunk);
await session.flush();
await session.close("turn-complete");

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

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

5 symbols
openaiWhisperexportPermalinkSource
TS
openaiWhisper
Exported from @absolutejs/voice-openai-whisper