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

TTSOptions.md

145 lines3.2 KB

1---
2id: TTSOptions
3title: TTSOptions
4---
5​
6Defined in: [packages/ai/src/types.ts:2965](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2965)
7​
8Options for text-to-speech generation.
9These are the common options supported across providers.
10​
11## Type Parameters
12​
13### TProviderOptions
14​
15`TProviderOptions` *extends* `object` = `object`
16​
17## Properties
18​
19### abortSignal?
20​
21```ts
22optional abortSignal?: AbortSignal;
23```
24​
25Defined in: [packages/ai/src/types.ts:3005](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L3005)
26​
27Effective abort signal composed by the activity from caller `abortSignal`
28and/or `timeout`. Adapters should forward this to the provider SDK when
29supported. Request-specific — never store on a global client config.
30​
31***
32​
33### format?
34​
35```ts
36optional format?: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm";
37```
38​
39Defined in: [packages/ai/src/types.ts:2989](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2989)
40​
41The output audio format
42​
43***
44​
45### logger
46​
47```ts
48logger: InternalLogger;
49```
50​
51Defined in: [packages/ai/src/types.ts:2999](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2999)
52​
53Internal logger threaded from the generateSpeech() entry point. Adapters
54must call logger.request() before the SDK call and logger.errors() in
55catch blocks.
56​
57***
58​
59### model
60​
61```ts
62model: string;
63```
64​
65Defined in: [packages/ai/src/types.ts:2967](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2967)
66​
67The model to use for TTS generation
68​
69***
70​
71### modelOptions?
72​
73```ts
74optional modelOptions?: TProviderOptions;
75```
76​
77Defined in: [packages/ai/src/types.ts:2993](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2993)
78​
79Model-specific options for TTS generation
80​
81***
82​
83### speed?
84​
85```ts
86optional speed?: number;
87```
88​
89Defined in: [packages/ai/src/types.ts:2991](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2991)
90​
91The speed of the generated audio (0.25 to 4.0)
92​
93***
94​
95### text
96​
97```ts
98text: string;
99```
100​
101Defined in: [packages/ai/src/types.ts:2973](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2973)
102​
103The text to convert to speech. When the caller passed `turns`, the
104activity fills this with the turn texts joined by newlines so adapters
105that only read `text` still receive the full script.
106​
107***
108​
109### timestamps?
110​
111```ts
112optional timestamps?: boolean;
113```
114​
115Defined in: [packages/ai/src/types.ts:2985](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2985)
116​
117Ask for `alignment` / `segments` on the result. Rejected by the activity
118unless the adapter declares `capabilities.timestamps`, because on some
119providers this is a different endpoint rather than free metadata.
120​
121***
122​
123### turns?
124​
125```ts
126optional turns?: TTSTurn[];
127```
128​
129Defined in: [packages/ai/src/types.ts:2979](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2979)
130​
131Multi-voice dialogue turns, when the caller asked for dialogue. Only
132adapters that declare `capabilities.maxSpeakers` ever see this — the
133activity rejects `turns` for the rest.
134​
135***
136​
137### voice?
138​
139```ts
140optional voice?: string;
141```
142​
143Defined in: [packages/ai/src/types.ts:2987](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L2987)
144​
145The voice to use for generation