Skip to main content

@flow-state-dev/voice-openai

Classes​

OpenAIVoiceProvider​

OpenAI-backed VoiceProvider. Single-instance, reusable across requests; the underlying SDK client is shared, so HTTP-keep-alive and per-instance options (org, project) are honoured for the instance's lifetime.

Implements​

  • VoiceProvider

Constructors​

Constructor​
new OpenAIVoiceProvider(opts?): OpenAIVoiceProvider;
Parameters​
opts?​

OpenAIVoiceProviderOptions

Returns​

OpenAIVoiceProvider

Properties​

abilities​
readonly abilities: VoiceAbilities;
Implementation of​

VoiceProvider.abilities

defaultModels​
readonly defaultModels: object;

Provider-suggested default model ids per ability. Routers/pipelines fall back to these when the caller doesn't specify a model in SpeakOptions.model / TranscribeOptions.model.

speak​
speak: string;
transcribe​
transcribe: string;
Implementation of​

VoiceProvider.defaultModels

id​
readonly id: string;

Stable identifier for telemetry/registry use.

Implementation of​

VoiceProvider.id

providerName​
readonly providerName: "openai" = "openai";

Short provider name (e.g. "openai", "elevenlabs", "composite").

Implementation of​

VoiceProvider.providerName

Methods​

listVoices()​
listVoices(): Promise<VoiceInfo[]>;
Returns​

Promise<VoiceInfo[]>

Implementation of​

VoiceProvider.listVoices

speak()​
speak(o): Promise<SpeakResult>;
Parameters​
o​

SpeakOptions

Returns​

Promise<SpeakResult>

Implementation of​

VoiceProvider.speak

transcribe()​
transcribe(o): Promise<TranscribeResult>;
Parameters​
o​

TranscribeOptions

Returns​

Promise<TranscribeResult>

Implementation of​

VoiceProvider.transcribe

Interfaces​

OpenAIVoiceProviderOptions​

Constructor options for OpenAIVoiceProvider.

Properties​

apiKey?​
apiKey?: string;

OpenAI API key. Omit to fall back to the SDK's default behaviour, which reads OPENAI_API_KEY from the environment.

baseURL?​
baseURL?: string;

Override the API base URL (Azure-OpenAI compatible endpoints, proxies).

client?​
client?: OpenAI;

Escape hatch: supply a pre-configured OpenAI client. When set, all other client-configuration options (apiKey, baseURL, organization, project) are ignored — the caller owns the client.

organization?​
organization?: string;

OpenAI organization id, forwarded to the SDK.

project?​
project?: string;

OpenAI project id, forwarded to the SDK.

sttModel?​
sttModel?: string;

Default STT model for transcribe(). Defaults to "gpt-4o-mini-transcribe".

ttsModel?​
ttsModel?: string;

Default TTS model for speak(). Defaults to "gpt-4o-mini-tts".

voice?​
voice?: string;

Default voice for speak(). Defaults to "alloy".

Variables​

OPENAI_VOICE_CATALOG​

const OPENAI_VOICE_CATALOG: readonly VoiceInfo[];