Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

TTSOptions.md

145 lines3.2 KB

Defined in: packages/ai/src/types.ts:2965

Options for text-to-speech generation. These are the common options supported across providers.

Type Parameters

TProviderOptions

TProviderOptions extends object = object

Properties

abortSignal?

optional abortSignal?: AbortSignal;

Defined in: packages/ai/src/types.ts:3005

Effective abort signal composed by the activity from caller abortSignal and/or timeout. Adapters should forward this to the provider SDK when supported. Request-specific — never store on a global client config.


format?

optional format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";

Defined in: packages/ai/src/types.ts:2989

The output audio format


logger

logger: InternalLogger;

Defined in: packages/ai/src/types.ts:2999

Internal logger threaded from the generateSpeech() entry point. Adapters must call logger.request() before the SDK call and logger.errors() in catch blocks.


model

model: string;

Defined in: packages/ai/src/types.ts:2967

The model to use for TTS generation


modelOptions?

optional modelOptions?: TProviderOptions;

Defined in: packages/ai/src/types.ts:2993

Model-specific options for TTS generation


speed?

optional speed?: number;

Defined in: packages/ai/src/types.ts:2991

The speed of the generated audio (0.25 to 4.0)


text

text: string;

Defined in: packages/ai/src/types.ts:2973

The text to convert to speech. When the caller passed turns, the activity fills this with the turn texts joined by newlines so adapters that only read text still receive the full script.


timestamps?

optional timestamps?: boolean;

Defined in: packages/ai/src/types.ts:2985

Ask for alignment / segments on the result. Rejected by the activity unless the adapter declares capabilities.timestamps, because on some providers this is a different endpoint rather than free metadata.


turns?

optional turns?: TTSTurn[];

Defined in: packages/ai/src/types.ts:2979

Multi-voice dialogue turns, when the caller asked for dialogue. Only adapters that declare capabilities.maxSpeakers ever see this — the activity rejects turns for the rest.


voice?

optional voice?: string;

Defined in: packages/ai/src/types.ts:2987

The voice to use for generation